MailDelivery v1.0.2 - Standalone mail delivery job for Paleto Bay, Grapeseed and Sandy Shores (Extra: ESX Addon)

MailDelivery :postbox:

Current Version: v1.0.2


I decided to release this script after a beloved server that I played on shut down. At the time I created this, I was working together with the developers to add some unique functionalities to the server. This was one of them.


Important Links

Source Code: Link
Download: Link
ESX Addon: Link

Build Status Build Status


What is MailDelivery?

In short, MailDelivery is a standalone mail delivery job that lets players deliver mail all around Blaine County.

A mail delivery man always has his own unique route, designated to one of the three towns: Paleto Bay, Grapeseed, or Sandy Shores, delivering his mail to mailboxes or other interesting places.

Standalone means that it does not have built-in ESX or vRP support. It does however have events that you can listen for. An ESX Addon is available and written by @blarglebottoms . See Important Links for the download. It’s a very basic addon that makes use of these events.

Written fully in C#.


Features

  • Always receive a unique route in one of three towns with 10-12 delivery spots (out of max. 33)
  • Marked delivery spots on the map
  • Delivery spots are mailboxes, porches and other interesting spots
  • Animation when delivering mail
  • Ability to use your own custom van model if you don’t like the PostOP Boxville
  • Rental spot in case the mail man doesn’t have his own PostOP Boxville yet!
  • Rental vans are spawned in one of the free parking spots.
  • Configurable min/max pay per delivery and other settings using ConVars
  • Adaptable to your own system by using server events for payment and rental costs
  • Customize all blip sprites and colors using ConVars

Screenshots & Video

More Screenshots

More Videos

Renting Van and Going On Duty


Installation & Configuration

Installation

Installation is simple, download the resource through the link above, add start maildelivery to your server.cfg and you’re ready to go. However, if you would like to configure settings or bind this to your existing economy system, see Configuration.

Configuration

This resource triggers two events for you to conveniently integrate this job into your own system as well as various ConVars to modify settings (like minimum and maximum payments).

Server Events

There are two server events that you can use to add delivery payments and rental costs to your existing economy system (for example ESX).

Name: “MailDelivery:DeliveryMade”
Parameters: payment(integer)
Description: Fired when a delivery has been made. Contains the payment amount between the min and max payment.
Example:

AddEventHandler("MailDelivery:DeliveryMade", function(payment)
    -- add payment to players bank account
end)

Name: “MailDelivery:VanRented”
Parameters: rentalAmount(integer)
Description: When renting a van, this event gets triggered with the set rental amount.
Example:

AddEventHandler("MailDelivery:VanRented", function(rentalAmount)
    -- deduct rentalAmount from players bank account
end)
ConVars

You can configure various aspects of the job using ConVars. Below is the list of all available ConVars and their default values if not set.

These are ConVars that are accessed on the client side, so make sure to set them in your server.cfg as replicated (i.e. setr mail_min_payment 200).

Name: “mail_min_payment” (Default: 150)
Description: The minimum payment of a delivery.

Name: “mail_max_payment” (Default: 1000)
Description: The maximum payment of a delivery.

Name: “mail_rental_amount” (Default: 2000)
Description: The rental cost when renting a mail delivery van via the rental spot.

Name: “mail_rental_blip_sprite” (Default: 67)
Description: Sets the blip sprite of the rental location. By default a truck sprite.

Name: “mail_rental_blip_color” (Default: 0)
Description: Sets the blip color of the rental location. By default white.

Name: “mail_job_cooldown” (Default: 60000)
Description: Sets the cooldown time between going on/off duty. A security measure to prevent people from getting the optimal route.

Name: “mail_job_blip_sprite” (Default: 67)
Description: Sets the blip sprite of the on-duty location. By default a truck sprite.

Name: “mail_job_blip_color” (Default: 0)
Description: Sets the blip color of the on-duty location. By default white.

Name: “mail_van_model” (Default: “BOXVILLE4”)
Description: Sets the van model required to start the delivery job. Also the model for the rental spot.

Name: “mail_delivery_blip_sprite” (Default: 164)
Description: Sets the blip sprites of the delivery locations. By default a flag.

Name: “mail_delivery_blip_color” (Default: 66)
Description: Sets the blip color of the delivery locations. By default yellow.

Name: “mail_debug” (Default: false)
Description: A debug flag for developers (Only set this convar when developing!)


Changelog

v1.0.2

  • New default delivery points blip
  • Added blip customization convars
  • CI: Added Azure DevOps for faster builds. Releases process still on TravisCI

v1.0.1

  • Ability to use your own custom van model
  • Moved ConVars to client side due to new FiveM feature

v1.0.0

  • Initial release

Known Issues

None as of right now :crossed_fingers:

If you come across anything bugs/issues, please let me know in this topic or create an Issue.


Support

If you require assistance, you can ask your question on this topic. Please don’t create topics elsewhere or ask me on the FiveM Discord about this resource. Lets keep all questions and comments in one topic, so we are all aware of what’s going on.


Credits

Last, but not least, some credits to people that have helped me get into FiveM coding and helped other wise.

Thanks @Mooshe and his stream for the preliminary logic of parking spots and toggling duty (months ago).
Thanks to @Vespura for letting me use the same license :slight_smile: .
Thank you @blarglebottoms for creating the simple ESX Addon!


Final Words

I hope you enjoy the release. I want this resource to not only be one that community members can use, but also learn from. I feel there is a lack of C# resources as well as source code that developers can learn from.

If you have any requests, concerns, etc. please let me know.

You can modify or edit the code as you like, but you cannot re-release it. Please see the LICENSE.md

27 Likes

wow :heart:

Noice :smiley:

Nice!! …

looks awesome

+1

One thing that would be nice, is an option for selecting the vehicle thats given out, insted of it only being the standart GTA mail van, and to avoid using replace.

2 Likes

Siiicck! <3
Great Job

Thanks for this feature request. I’ll be allowing this in the next coming day(s)

1 Like

Will it be possible to convert this script into ESX?
(sorry for my English)

Bingo!

Is it possible? Sure.

I will however not convert this into an ESX script. This resource, as is, provides enough for you to use this on your ESX server with a little bit of server side scripting yourself.

2 Likes

Update v1.0.1


I’ve added the ability to use your own van model as you prefer. This is handled via the new ConVar mail_van_model. Example:

set mail_van_model "ADDER" // Use the Adder as the delivery van

There were also some fixes/additions to handle ConVars client side only.

New Features

  • Added the ability to use a custom van model via a new convar mail_van_model (Default: “BOXVILLE4”)

Fixes

  • Moved ConVar loading to client side due to new FiveM feature citizenfx/fivem@af718ea
  • Removed server side project as this was only used for ConVar loading.
1 Like

Hot release. :fire: . Thanks for defining standalone because I thought standalone means with ESX.

Top 10 FAQ’s For standalone scripts
Q. ESX Version?!?!!?
A. Nope

Q. vRP Version?
A. Nope

Q. How to install with ESX & VRP?
A. Like a normal resource. Whats that :laughing:

Q. This does not work with ESX
A. Your fault for running 250 resources

Sorry ESX devs, but very true

3 Likes

Hello! Thank you for the release, its very well done! Also, i noticied some frame drop after a while. Again, thanks!

Thanks for the compliment.

Personally, I have watched the resmon 1 timings and have not found any alarming signs.

Please record and share your resmon 1 output when you are experiencing this frame drop.

Sure, i’ll try tonight! :grinning:

@d0p3t Wondering could we get a extra trigger, so when they try to start the job it sends a call to the server side, so we can define a job for it, and then we can send a client call back to verify it’s the right job.

Would make it possible to integrate abit more in to excisting frameworks.

I’m going to be very busy the coming week or two, but I’ll look into it when I can.

This is an awesome script.
Good job :+1:

Unfortunately im new to creating a fivem server…
What files need to be edited in my server te get the payment working?
I am working with ESX for now!