2023-12-07 15:45:48 -08:00
|
|
|
QBCore = exports['qb-core']:GetCoreObject()
|
|
|
|
|
|
|
|
|
|
RegisterServerEvent('md-drugs:server:payfortruck', function()
|
|
|
|
|
local src = source
|
|
|
|
|
local Player = QBCore.Functions.GetPlayer(src)
|
2024-05-02 18:34:49 -07:00
|
|
|
local playerPed = GetPlayerPed(source)
|
2023-12-07 15:45:48 -08:00
|
|
|
if Player.Functions.RemoveMoney('cash', Config.TruckPrice ) or Player.Functions.RemoveMoney('bank', Config.TruckPrice ) then
|
|
|
|
|
TriggerClientEvent("md-drugs:Client:getoxylocation", src)
|
|
|
|
|
else
|
2024-05-02 18:34:49 -07:00
|
|
|
Notifys(Lang.oxy.broke, "error")
|
2023-12-07 15:45:48 -08:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RegisterServerEvent('md-drugs:server:giveoxybox', function()
|
|
|
|
|
local src = source
|
|
|
|
|
local Player = QBCore.Functions.GetPlayer(src)
|
|
|
|
|
local chance = math.random(1,100)
|
|
|
|
|
local cash = Config.OxyRunCompleteCash
|
|
|
|
|
local itemchance = math.random(1,100)
|
|
|
|
|
local item = Config.OxyRandItems[math.random(1, #Config.OxyRandItems)]
|
|
|
|
|
|
|
|
|
|
if chance <= Config.OxyRunDitchChance then
|
2024-05-02 18:34:49 -07:00
|
|
|
Notifys(Lang.oxy.hot, "error")
|
2023-12-07 15:45:48 -08:00
|
|
|
Player.Functions.AddMoney("cash", cash * 0.5)
|
|
|
|
|
if itemchance <= Config.OxyItemChance then
|
2024-05-02 18:34:49 -07:00
|
|
|
AddItem(item, Config.OxyItemAmount)
|
2023-12-07 15:45:48 -08:00
|
|
|
end
|
|
|
|
|
else
|
2024-05-02 18:34:49 -07:00
|
|
|
Notifys(Lang.oxy.next, "success")
|
2023-12-07 15:45:48 -08:00
|
|
|
TriggerClientEvent("md-drugs:client:getoxylocationroute", src)
|
|
|
|
|
Player.Functions.AddMoney("cash", cash)
|
|
|
|
|
if itemchance <= Config.OxyItemChance then
|
2024-05-02 18:34:49 -07:00
|
|
|
AddItem(item, Config.OxyItemAmount)
|
2023-12-07 15:45:48 -08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|