Hello gentlemen, I hope you are having a nice week, Well I am having a problem to see if you can help me solve it, I will thank you very much.
I am going to explain how it works, when picking up a box the user has to make a delivery and from there it generates money, but what happens, it only gives me the xp, but not the money, do you have any idea how to solve this ?.
Bad argument @ "givePlayerMoney" [Expected number at argument 2, git nill]
function createEnd()
local money = math.random(1,#Entregas)
local x,y,z = unpack(Entregas[money])
MarkerEntrega = exports["x"]:createMarker("padrao2", Vector3 {x, y, z-0.9})
addEventHandler("onClientMarkerHit", MarkerEntrega,
function(hitElement)
if hitElement == localPlayer then
local veh = getPedOccupiedVehicle(localPlayer)
if veh and getElementModel(veh) == 530 then
local box = getElementData(veh, "dock.Caixa")
if box and serviceActive then
--local money = math.random(200, 290)
local money = math.random(money1, money2)
local exp = math.random(exp1, exp2)
givePlayerMoney(localPlayer, money)
triggerServerEvent("dock.removeCaixa", localPlayer, localPlayer)
triggerServerEvent("GiveExp", localPlayer, localPlayer, exp)
notifyC("x $ "..formatNumber(money)..",00.", "success")
notifyC("x", "info")
if getBoxCount() < 1 then
generateBoxes()
end
destroyElement(source)
else
notifyC("x", 'error')
end
end
end
end)
end