2023-12-07 15:45:48 -08:00
|
|
|
QBCore = exports['qb-core']:GetCoreObject()
|
2024-11-16 23:39:34 -08:00
|
|
|
local prices = {
|
|
|
|
|
payfortruck = 500,
|
|
|
|
|
hotchance = 30,
|
|
|
|
|
itemChance = 20,
|
|
|
|
|
}
|
2024-09-24 15:07:41 -07:00
|
|
|
lib.callback.register('md-drugs:server:payfortruck', function()
|
2023-12-07 15:45:48 -08:00
|
|
|
local src = source
|
2024-11-01 00:54:21 -07:00
|
|
|
local Player = getPlayer(src)
|
2024-11-16 23:39:34 -08:00
|
|
|
if Player.Functions.RemoveMoney('cash', prices.payfortruck) or Player.Functions.RemoveMoney('bank', prices.payfortruck) then
|
2024-09-24 15:07:41 -07:00
|
|
|
Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy')
|
|
|
|
|
return true
|
2023-12-07 15:45:48 -08:00
|
|
|
else
|
2024-09-24 15:07:41 -07:00
|
|
|
Notifys(src, Lang.oxy.broke, "error")
|
|
|
|
|
return false
|
2023-12-07 15:45:48 -08:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RegisterServerEvent('md-drugs:server:giveoxybox', function()
|
|
|
|
|
local src = source
|
2024-11-01 00:54:21 -07:00
|
|
|
local Player = getPlayer(src)
|
2023-12-07 15:45:48 -08:00
|
|
|
local chance = math.random(1,100)
|
2024-11-12 01:04:42 -08:00
|
|
|
local cash = 200
|
2023-12-07 15:45:48 -08:00
|
|
|
local itemchance = math.random(1,100)
|
2024-11-12 01:04:42 -08:00
|
|
|
local itemList = {
|
|
|
|
|
{item = 'oxy', amount = 2},
|
2024-11-16 23:39:34 -08:00
|
|
|
{item = 'houselockpick', amount = 1},
|
2024-11-12 01:04:42 -08:00
|
|
|
}
|
|
|
|
|
local item = itemList[math.random(1, #itemList)]
|
2024-11-16 23:39:34 -08:00
|
|
|
if chance <= prices.hotchance then
|
2024-09-24 15:07:41 -07:00
|
|
|
Notifys(src, Lang.oxy.hot, "error")
|
2023-12-07 15:45:48 -08:00
|
|
|
Player.Functions.AddMoney("cash", cash * 0.5)
|
2024-11-16 23:39:34 -08:00
|
|
|
if itemchance <= prices.itemChance then
|
2024-11-12 01:04:42 -08:00
|
|
|
AddItem(src, item.item, item.amount)
|
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)
|
2024-11-16 23:39:34 -08:00
|
|
|
if itemchance <= prices.itemChance then
|
2024-11-12 01:04:42 -08:00
|
|
|
AddItem(src, item.item, item.amount)
|
2023-12-07 15:45:48 -08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|