MailDelivery v1.0.0 - Standalone mail delivery job for Paleto Bay, Grapeseed and Sandy Shores

roleplay
jobs
csharp

#1

MailDelivery :postbox:

Current Version: v1.0.0


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


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.

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
  • 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

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.

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_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_debug” (Default: false)
Description: A debug flag for developers (Only set this convar when developing!)


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:


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


#2

wow :heart:


#3

Noice :smiley:


#4

Nice!! …


#5

looks awesome

+1


#6

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.


#7

Siiicck! <3
Great Job


#9

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


#10

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


#11

Bingo!


#12

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.