Skip to content

Commit

Permalink
Inventory Update
Browse files Browse the repository at this point in the history
  • Loading branch information
GhzGarage committed May 20, 2024
1 parent 7438edf commit a40573f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ RegisterNetEvent('qb-tow:server:nano', function(vehNetID)
local Player = QBCore.Functions.GetPlayer(src)
local targetVehicle = NetworkGetEntityFromNetworkId(vehNetID)
if not Player then return end

local playerPed = GetPlayerPed(src)
local playerVehicle = GetVehiclePedIsIn(playerPed, true)
local playerVehicleCoords = GetEntityCoords(playerVehicle)
Expand All @@ -42,25 +41,22 @@ RegisterNetEvent('qb-tow:server:nano', function(vehNetID)
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)
if chance < 26 then
Player.Functions.AddItem('cryptostick', 1, false)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['cryptostick'], 'add')
exports['qb-inventory']:AddItem(src, 'cryptostick', 1, false, false, 'qb-tow:server:nano')
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items['cryptostick'], 'add')
end
end)

RegisterNetEvent('qb-tow:server:11101110', function(drops)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end

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'))
end

drops = tonumber(drops)
local bonus = 0
local DropPrice = math.random(150, 170)
Expand All @@ -76,8 +72,6 @@ RegisterNetEvent('qb-tow:server:11101110', function(drops)
local price = (DropPrice * drops) + bonus
local taxAmount = math.ceil((price / 100) * PaymentTax)
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')
end)
Expand Down

0 comments on commit a40573f

Please sign in to comment.