Files
md-drugs/server/oxyruns.lua
T

47 lines
1.3 KiB
Lua
Raw Normal View History

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,
}
2025-07-01 03:09:46 -07:00
ps.registerCallback('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
2025-07-17 02:06:17 -05:00
--Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy')
return true
2023-12-07 15:45:48 -08:00
else
2025-07-17 02:06:17 -05:00
ps.notify(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
2025-07-17 02:06:17 -05:00
ps.notify(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
2025-07-17 02:06:17 -05:00
ps.notify(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)