Functions

local QBCore = exports[Config.Core]:GetCoreObject()

function Notify(msg, type, time)
    if Config.Notify == "standalone" then
        BeginTextCommandThefeedPost("STRING")
        AddTextComponentSubstringPlayerName(msg)
        EndTextCommandThefeedPostTicker(true, true)
    elseif Config.Notify == "qb" then
        QBCore.Functions.Notify(msg, type, time)
    elseif Config.Notify == "okok" then
        exports['okokNotify']:Alert('Vehicleshop', msg, 5000, type, true)
    elseif Config.Notify == "ox" then
        lib.notify({ title = 'Vehicleshop', description = msg, type = type })
    end
end

function GiveKeys(veh)
    local plate = GetVehicleNumberPlateText(veh)
    local model = GetDisplayNameFromVehicleModel(GetEntityModel(veh))
    if Config.VehicleKeys == "qb" then
        TriggerEvent("vehiclekeys:client:SetOwner", plate)
    elseif Config.VehicleKeys == "qs" then
        exports['qs-vehiclekeys']:GiveKeys(plate, model)
    elseif Config.VehicleKeys == "renewed" then
        exports['Renewed-Vehiclekeys']:addKey(plate)
    elseif Config.VehicleKeys == "jaksam" then
        TriggerServerEvent("vehicles_keys:selfGiveVehicleKeys", plate)
    elseif Config.VehicleKeys == "wasabi" then
        exports.wasabi_carlock:GiveKey(plate)
    end
end

function SetFuel(veh)
    if Config.Fuel == "LegacyFuel" then
        exports["LegacyFuel"]:SetFuel(veh, 100.0)
    elseif Config.Fuel == "okokFuel" then
        exports['okokGasStation']:SetFuel(veh, 100.0)
    elseif Config.Fuel == "ox_fuel" then
        SetVehicleFuelLevel(veh, 100.0)
    elseif Config.Fuel == "ti_fuel" then
        exports["ti_fuel"]:setFuel(veh, 100.0, "RON91")
    elseif Config.Fuel == "qs-fuel" then
        exports['qs-fuelstations']:SetFuel(veh, 100.0)
    elseif Config.Fuel == "cdn-fuel" then
        SetVehicleFuelLevel(veh, 100.0)
    end
end

function SendHelpText(msg, position)
    if Config.HelpText == "qb" then
        exports['qb-core']:DrawText(msg, position)
    elseif Config.HelpText == "ox" then
        lib.showTextUI(msg)
    end
end

function RemoveHelpText()
    if Config.HelpText == "qb" then
        exports['qb-core']:HideText()
    elseif Config.HelpText == "ox" then
        lib.hideTextUI()
    end
end

function GetVehicleName(hash)
    local name = GetDisplayNameFromVehicleModel(hash)
    return name
end

function SendEmail(carName, carPrice)
    if Config.Email.phone == "qb-phone" then
        TriggerServerEvent("qb-phone:server:sendNewMail", {
            sender = "PDM Vehicleshop",
            subject = "New purchase",
            message = "Congratulations for you new purchase! Hope you enjoy the vehicle.<br>Vehicle Information:<br>Vehicle Model: "..carName.."<br>Vehicle Price: $"..carPrice,
        })
    elseif Config.Email.phone == "qs-smartphone" then
        TriggerServerEvent("qs-smartphone:server:sendNewMail", {
            sender = "PDM Vehicleshop",
            subject = "New purchase",
            message = "Congratulations for you new purchase! Hope you enjoy the vehicle.<br>Vehicle Information:<br>Vehicle Model: "..carName.."<br>Vehicle Price: $"..carPrice,
        })
    elseif Config.Email.phone == "gksphone" then
        TriggerServerEvent("gksphone:NewMail", {
            sender = "PDM Vehicleshop",
            image = '/html/static/img/icons/mail.png',
            subject = "New purchase",
            message = "Congratulations for you new purchase! Hope you enjoy the vehicle.<br>Vehicle Information:<br>Vehicle Model: "..carName.."<br>Vehicle Price: $"..carPrice,
         })
    end
end

Last updated