Files
md-drugs/server/oxyruns.lua
T

42 lines
1.7 KiB
Lua
Raw Normal View History

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)
2024-07-16 14:14:48 -07:00
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Rented A Van For OxyRuns', 'oxy')
2023-12-07 15:45:48 -08:00
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)
2024-07-16 14:14:48 -07:00
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. Config.OxyItemAmount .. ' Of ' .. item .. ' For This Drop Off', 'oxy')
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)
2024-07-16 14:14:48 -07:00
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Got ' .. Config.OxyItemAmount .. ' Of ' .. item .. ' For This Drop Off', 'oxy')
2023-12-07 15:45:48 -08:00
end
end
end)