Skip to content

Commit

Permalink
Money reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
GhzGarage committed Jan 15, 2024
1 parent 35dc9a2 commit 6caea65
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ RegisterNetEvent('qb-tow:server:DoBail', function(bool, vehInfo)
if bool then
if Player.PlayerData.money.cash >= Config.BailPrice then
Bail[Player.PlayerData.citizenid] = Config.BailPrice
Player.Functions.RemoveMoney('cash', Config.BailPrice, "tow-paid-bail")
TriggerClientEvent('QBCore:Notify', src, Lang:t("success.paid_with_cash", {value = Config.BailPrice}), 'success')
Player.Functions.RemoveMoney('cash', Config.BailPrice, 'tow-paid-bail')
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.paid_with_cash', { value = Config.BailPrice }), 'success')
TriggerClientEvent('qb-tow:client:SpawnVehicle', src, vehInfo)
elseif Player.PlayerData.money.bank >= Config.BailPrice then
Bail[Player.PlayerData.citizenid] = Config.BailPrice
Player.Functions.RemoveMoney('bank', Config.BailPrice, "tow-paid-bail")
TriggerClientEvent('QBCore:Notify', src, Lang:t("success.paid_with_bank", {value = Config.BailPrice}), 'success')
Player.Functions.RemoveMoney('bank', Config.BailPrice, 'tow-paid-bail')
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.paid_with_bank', { value = Config.BailPrice }), 'success')
TriggerClientEvent('qb-tow:client:SpawnVehicle', src, vehInfo)
else
TriggerClientEvent('QBCore:Notify', src, Lang:t("error.no_deposit", {value = Config.BailPrice}), 'error')
TriggerClientEvent('QBCore:Notify', src, Lang:t('error.no_deposit', { value = Config.BailPrice }), 'error')
end
else
if Bail[Player.PlayerData.citizenid] ~= nil then
Player.Functions.AddMoney('bank', Bail[Player.PlayerData.citizenid], "tow-bail-paid")
Player.Functions.AddMoney('bank', Bail[Player.PlayerData.citizenid], 'tow-bail-paid')
Bail[Player.PlayerData.citizenid] = nil
TriggerClientEvent('QBCore:Notify', src, Lang:t("success.refund_to_cash", {value = Config.BailPrice}), 'success')
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.refund_to_cash', { value = Config.BailPrice }), 'success')
end
end
end)
Expand All @@ -39,14 +39,14 @@ RegisterNetEvent('qb-tow:server:nano', function(vehNetID)
local playerVehicleCoords = GetEntityCoords(playerVehicle)
local targetVehicleCoords = GetEntityCoords(targetVehicle)
local dist = #(playerVehicleCoords - targetVehicleCoords)
if Player.PlayerData.job.name ~= "tow" or dist > 11.0 then
return DropPlayer(src, Lang:t("info.skick"))
if Player.PlayerData.job.name ~= 'tow' or dist > 11.0 then
return DropPlayer(src, Lang:t('info.skick'))
end

local chance = math.random(1,100)
local chance = math.random(1, 100)
if chance < 26 then
Player.Functions.AddItem("cryptostick", 1, false)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["cryptostick"], "add")
Player.Functions.AddItem('cryptostick', 1, false)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['cryptostick'], 'add')
end
end)

Expand All @@ -57,8 +57,8 @@ RegisterNetEvent('qb-tow:server:11101110', function(drops)

local playerPed = GetPlayerPed(src)
local playerCoords = GetEntityCoords(playerPed)
if Player.PlayerData.job.name ~= "tow" or #(playerCoords - vector3(Config.Locations["main"].coords.x, Config.Locations["main"].coords.y, Config.Locations["main"].coords.z)) > 6.0 then
return DropPlayer(src, Lang:t("info.skick"))
if Player.PlayerData.job.name ~= 'tow' or #(playerCoords - vector3(Config.Locations['main'].coords.x, Config.Locations['main'].coords.y, Config.Locations['main'].coords.z)) > 6.0 then
return DropPlayer(src, Lang:t('info.skick'))
end

drops = tonumber(drops)
Expand All @@ -78,17 +78,17 @@ RegisterNetEvent('qb-tow:server:11101110', function(drops)
local payment = price - taxAmount

Player.Functions.AddJobReputation(1)
Player.Functions.AddMoney("bank", payment, "tow-salary")
TriggerClientEvent('QBCore:Notify', src, Lang:t("success.you_earned", {value = payment}), 'success')
Player.Functions.AddMoney('bank', payment, 'tow-salary')
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.you_earned', { value = payment }), 'success')
end)

QBCore.Commands.Add("npc", Lang:t("info.toggle_npc"), {}, false, function(source)
TriggerClientEvent("jobs:client:ToggleNpc", source)
QBCore.Commands.Add('npc', Lang:t('info.toggle_npc'), {}, false, function(source)
TriggerClientEvent('jobs:client:ToggleNpc', source)
end)

QBCore.Commands.Add("tow", Lang:t("info.tow"), {}, false, function(source)
QBCore.Commands.Add('tow', Lang:t('info.tow'), {}, false, function(source)
local Player = QBCore.Functions.GetPlayer(source)
if Player.PlayerData.job.name == "tow" or Player.PlayerData.job.name == "mechanic" then
TriggerClientEvent("qb-tow:client:TowVehicle", source)
if Player.PlayerData.job.name == 'tow' or Player.PlayerData.job.name == 'mechanic' then
TriggerClientEvent('qb-tow:client:TowVehicle', source)
end
end)

0 comments on commit 6caea65

Please sign in to comment.