[Release] GoPostal delivery job

Hey everyone, I have enjoyed a lot of releases from this forum and thought it was my turn to give back.
I have made it myself with a lot of inspiration from different scripts. So thanks to the entire community for sharing so much good stuff.
I know the code isn’t that clean and that it probally could be done more efficiently in a lot of ways, but as my name sugests. I am a noob coder.

So here is my GoPostal Delivery script:

You can make runs to about 400 handpicked locations.
The script chooses one at random and you can deliver multiple packages with the same truck. (Amount can be altered)
After wich you need to return to the depot to restock the van or get a new one.
Pay changes depending on how far you go from the depot.
You can also cancel an ongoing run at the depot. But this will require you to pay for the lost package in full.

Multiple runs with the same van: you can alter this in line 583

Requirements:
-Missiontext (it looks nice)
-Essentialmode (only for the payments, you can replace this easy with your own payment system. (See serverside lua)
-Jobsystem (Serverside validates if you have the correct job to start van runs)
-Simplebanking (For the cancelled runs)

Installation:
Copy the delivery map to your resources and add it to citmp-server.yml
Make a database entry in jobs system. (Add the jobname & an ID of your choice to the database)

As an example from my database:
job_id job_name salary
12 Delivery guy 100

File:
delivery.rar (14.0 KB)

I hope you enjoy this script. Feel free to alter or use it anyway you see fit.

Edit: Removed some obsolete code and added simple banking to requirements

14 Likes

Thanks i will test this out in about 30 mins

RegisterServerEvent('delivery:fail')
AddEventHandler('delivery:fail', 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)

I see this in the server.lua but i don’t see where its called?

You are correct had some issues with that, couldn’t get that to work the way i wanted to. So i altered the client to do:

TriggerServerEvent(‘bank:withdrawAmende’, destination[l].money)

I guess i forgot to take that part out.
Hm that also means SimpleBanking is needed for this to work.
I’ll alter the main post, thanks :slight_smile:

1 Like

Hi, Can you hide the GoPostal blips when not in use?

So was this just meant to remove money from a users previous destination reward as they never completed the job?

RegisterServerEvent('gopostal:fail')
AddEventHandler('gopostal:fail', function(price)
  TriggerEvent('es:getPlayerFromId', source, function(user)
   -- update player money amount
   user:removeMoney(tonumber(price))
   end)
end)

i’d say that works but i don’t have a computer to test it on atm

I could test it for you i’m getting in right now

It was supposed to take money from you when you cancel a job. But somehow i couldn’t get it to go negative.
So i changed it since i had Simple banking active and used one of their functions to do so.
In theory it should have worked, but somehow it just didn’t.

I am not sure what you mean by that.
Only one blip is active and thats the depot. Unless you start a route, then it draws another blip for your destination

I think he is saying can you hide the blimp when not on that job. So when your on another job that blimp will not show to you

Well you could add a blip check.
But that would mean a constant check on your database to see if the job is active.
This would lag out your server hard.

To avoid this you’d have to edit Jobsystem to add the blip when you take the job.
Just remove the blip part in delivery at the bottom (i just added that in to make it complete)

1 Like

cant you do something like

if user.job_id ==15 then
drawblip
blah
blah
blah
??

To make things better you can change the player outfit so it changes to the gopostal ped then changes back the the one that had on before they got the truck

Yea something like that, but I suggest you put that in the job system code when you change jobs so its only called on once.

I suppose that if you have this for your other jobs you can easily adapt it for this one aswell …

Can i modify your script ? To add taking service etc…

202020202020200202020

Sorry , i will check it and look for modify ^^

You can use math.random(250, 900) for rewards

he rewards via distance

2 Likes

nice job i tested it very fun thx for share ^^ :slight_smile: