Skip to content

Commit

Permalink
Update server.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
lama-development authored Sep 14, 2022
1 parent 717d25a commit 0be3ab6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ NDCore = exports["ND_Core"]:GetCoreObject()
local deliveries = {}
local playersOnJob = {}

-- function to check if the client is actually at the job ending location before giving them the money
function isClientTooFar(location)
local distance = #(GetEntityCoords(GetPlayerPed(source)) - vector3(location.x, location.y, location.z))
-- checking from a distance of 15 because it might not be 100% correct
Expand Down Expand Up @@ -44,6 +45,7 @@ RegisterNetEvent("lama_jobs:finished", function()
else
-- calculate amount of money to give to the player
local amount = Config.PayPerDelivery * deliveries[src]
-- only give the money to the client if it is on the job and near the ending location
if playersOnJob[src] and not isClientTooFar(Config.DepotLocation) then
-- give the money to player
-- if using another framework than ND, simply change the function below to your framework's
Expand Down

0 comments on commit 0be3ab6

Please sign in to comment.