FIX Bug with TruckersJob Money

I try to fix the bug of the TruckersJob… he doesnt gave the money when i have finished the mission

i have add this in the server.lua

IT’S Good ? :stuck_out_tongue:

AddEventHandler("es:addedMoney" function(MISSION.getMoney)
function MISSION.getMoney()
   TriggerEvent("es:addedMoney", currentMission[4])
    TriggerEvent("truckerJob:getMoney", currentMission[4])
end
end)

No because the value in currentMission[4] is not given in the server file.

So i did it my self and there is the fix, it is not perfect but works so

in truckerjob.lua, replace or commrent line 203 (by defaut) :
MISSION.getMoney()
by
TriggerServerEvent(‘truckerJob:success’,currentMission[4])

and in server.lua :

RegisterServerEvent(‘truckerJob:success’)
AddEventHandler(‘truckerJob:success’, function(price)
print("Player ID " …source)
– Get the players money amount
TriggerEvent(‘es:getPlayerFromId’, source, function(user)
total = price;
– update player money amount
user:addMoney((total))
end)
end)

Inspired by taxi job.

If it work for you, a little thank will be gratefull :slight_smile:

3 Likes

Haha thx ^^ but i dont find the TriggerServerEvent(‘truckerJob:success’,currentMission[4]) in line 203 i have this

            MISSION.getMoney()

yes, like a said,

replace this line
MISSION.getMoney()

by

TriggerServerEvent(‘truckerJob:success’,currentMission[4])

Thx ur the BEST <3 dude :slight_smile:

Please keep in mind this forum is English only

Yup sry dude :cry: but i have a vry bad English…

dont work it me :sweat:

“don’t work it me” ???

Explain a little, paste the error if there is one.

If you say “don’t work it me” (abviously you mean : It doesn’t work for me) i’ll answer you “cool story bro” see…

i finished the mission but earn no money

can u came to my Ts3: ts.g-e-p-c.de for help `?

1 Like

Hi, The truck does not disappear any more after having delivered a solution for it because it is the madness at the finish thx

Thank you SO much! Worked flawlessly.

I will add though that I have to clear that trucker cache but NOT the FS_Freemode cache AND then restart couchdb before relaunching the server.

You are the man!

Plysekn you said that the taxi job inspired you to get the money working for the trucker job.

I have tried to copy this over to the taxi resource folder but cant get it to register any money at all.

I am running couchdb and everything works but taxi.

Would you mind sharing your taxi files?

OK got it working great with ES_Freeroam + Essential BUT after completing a mission the Truck turns off and does not allow me to use the truck and i am stuck on the other side of the map. if i step out of the truck the doors lock and i can no longer get back in. Options would be to teleport back to the Trucker Job to start a new one, but this isnt realistic… I would love to be able to despawn the trailers after they detach and have to drive the truck back and either keep the truck for another mission or park and despawn this as well… any help would be appreciated!

1 Like

Alrighty, have all the code changed correctly, and still doesn’t work. As this was for an older style server that is no longer supported anymore as of last week, I’m thinking this has something to do with the FXServer settings and the communication between that and this program. I have noticed fixes for a couple of the older programs and getting money to work by changing the " : " to a " ." in the get money section of the code. Then again the FXServer may not be the issue at all but it seems to be with some of the older scripts out their… Any thoughts???

See the FX archive page for porting example

use this

RegisterServerEvent('truckerJob:success')
AddEventHandler('truckerJob:success', function(price)
print("Player ID " ..source)
-- Get the players money amount
TriggerEvent('es:getPlayerFromId', source, function(user)
total = price;
-- update player money amount
user.addMoney((total))
end)
end)