45 lines
1.2 KiB
Lua
45 lines
1.2 KiB
Lua
|
|
local prices = {
|
|
payfortruck = 500,
|
|
hotchance = 30,
|
|
itemChance = 20,
|
|
}
|
|
lib.callback.register('md-drugs:server:payfortruck', function()
|
|
local src = source
|
|
if removeMoney(src, 'cash', prices.payfortruck) or removeMoney(src, 'bank', prices.payfortruck) then
|
|
Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy')
|
|
return true
|
|
else
|
|
Notifys(src, Lang.oxy.broke, "error")
|
|
return false
|
|
end
|
|
end)
|
|
|
|
|
|
RegisterServerEvent('md-drugs:server:giveoxybox', function()
|
|
local src = source
|
|
local chance = math.random(1,100)
|
|
local cash = 200
|
|
local itemchance = math.random(1,100)
|
|
local itemList = {
|
|
{item = 'oxy', amount = 2},
|
|
{item = 'houselockpick', amount = 1},
|
|
}
|
|
local item = itemList[math.random(1, #itemList)]
|
|
if chance <= prices.hotchance then
|
|
Notifys(src, Lang.oxy.hot, "error")
|
|
addMoney(src, "cash", cash * 0.5)
|
|
if itemchance <= prices.itemChance then
|
|
AddItem(src, item.item, item.amount)
|
|
end
|
|
else
|
|
Notifys(Lang.oxy.next, "success")
|
|
TriggerClientEvent("md-drugs:client:getoxylocationroute", src)
|
|
Player.Functions.AddMoney("cash", cash)
|
|
if itemchance <= prices.itemChance then
|
|
AddItem(src, item.item, item.amount)
|
|
end
|
|
end
|
|
end)
|
|
|