2 |
3 | # MailDelivery Job (v1.0.2)
4 |
5 | ##### Standalone mail delivery job for Paleto Bay, Grapeseed and Sandy Shores
6 |
7 |

8 |
9 |  [](https://travis-ci.org/d0p3t/MailDelivery) [](https://discord.gg/bSd4cYJ)
10 |
11 | [](https://dev.azure.com/d0p3t/MailDelivery/_build/latest?definitionId=1&branchName=master) [](https://vsrm.dev.azure.com/d0p3t/_apis/public/Release/badge/3b0f092f-3e8a-4624-bb9c-23ba4e3390bd/2/2)
12 |
13 |
14 |
15 | ___
16 | **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.**
17 |
18 | ---
19 |
20 | ## What is MailDelivery?
21 | In short, MailDelivery is a standalone **mail delivery job** that lets players deliver mail all around Blaine County.
22 |
23 | 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.
24 |
25 | Standalone means that it _**does not have built-in ESX or vRP support**_. It does however have events that you can listen for.
26 |
27 | Written fully in C#.
28 |
29 | ---
30 | ## Features
31 | * Always receive a **unique route** in one of three towns with 10-12 delivery spots (out of max. 33)
32 | * Marked delivery spots on the map
33 | * Delivery spots are _mailboxes_, _porches_ and _other interesting spots_
34 | * Animation when delivering mail
35 | * Ability to use your own custom van model if you don't like the PostOP Boxville
36 | * **Rental spot** in case the mail man doesn't have his own PostOP Boxville yet!
37 | * Rental vans are spawned in one of the free parking spots.
38 | * Configurable min/max pay per delivery and other settings using **ConVars**
39 | * Adaptable to your own system by using server events for payment and rental costs
40 | * **Customize** all blip sprites and colors using ConVars
41 |
42 | ___
43 |
44 | ## Installation & Configuration
45 |
46 | ### Installation
47 | 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**.
48 |
49 | ### Configuration
50 | 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).
51 |
52 | There are two server events that you can use to add delivery payments and rental costs to your existing economy system (for example ESX).
53 |
54 | **Name:** _"MailDelivery:DeliveryMade"_
55 | **Parameters:** payment(integer)
56 | **Description:** Fired when a delivery has been made. Contains the payment amount between the min and max payment.
57 | **Example:**
58 | ```lua
59 | AddEventHandler("MailDelivery:DeliveryMade", function(payment)
60 | -- add payment to players bank account
61 | end)
62 | ```
63 |
64 | **Name:** _"MailDelivery:VanRented"_
65 | **Parameters:** rentalAmount(integer)
66 | **Description:** When renting a van, this event gets triggered with the set rental amount.
67 | **Example:**
68 | ```lua
69 | AddEventHandler("MailDelivery:VanRented", function(rentalAmount)
70 | -- deduct rentalAmount from players bank account
71 | end)
72 | ```
73 |
74 | 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.
75 |
76 | **Name:** "mail_min_payment" (_Default: 150_)
77 | **Description:** The minimum payment of a delivery.
78 |
79 | **Name:** "mail_max_payment" (_Default: 1000_)
80 | **Description:** The maximum payment of a delivery.
81 |
82 | **Name:** "mail_rental_amount" (_Default: 2000_)
83 | **Description:** The rental cost when renting a mail delivery van via the rental spot.
84 |
85 | **Name:** "mail_rental_blip_sprite" (_Default: 67_)
86 | **Description:** Sets the blip sprite of the rental location. By default a truck sprite.
87 |
88 | **Name:** "mail_rental_blip_color" (_Default: 0_)
89 | **Description:** Sets the blip color of the rental location. By default white.
90 |
91 | **Name:** "mail_job_cooldown" (_Default: 60000_)
92 | **Description:** Sets the cooldown time between going on/off duty. A security measure to prevent people from getting the optimal route.
93 |
94 | **Name:** "mail_job_blip_sprite" (_Default: 67_)
95 | **Description:** Sets the blip sprite of the on-duty location. By default a truck sprite.
96 |
97 | **Name:** "mail_job_blip_color" (_Default: 0_)
98 | **Description:** Sets the blip color of the on-duty location. By default white.
99 |
100 | **Name:** "mail_van_model" (_Default: "BOXVILLE4"_)
101 | **Description:** Sets the van model required to start the delivery job. Also the model for the rental spot.
102 |
103 | **Name:** "mail_delivery_blip_sprite" (_Default: 164_)
104 | **Description:** Sets the blip sprites of the delivery locations. By default a flag.
105 |
106 | **Name:** "mail_delivery_blip_color" (_Default: 66_)
107 | **Description:** Sets the blip color of the delivery locations. By default yellow.
108 |
109 | **Name:** "mail_debug" (Default: false)
110 | **Description:** A debug flag for developers (Only set this convar when developing!)
111 |
112 | ---
113 | ## Changelog
114 | **v1.0.2**
115 | * New default delivery points blip
116 | * Added blip customization convars
117 | * CI: Added Azure DevOps for faster builds. Releases process still on TravisCI
118 |
119 | **v1.0.1**
120 | * Ability to use your own custom van model
121 | * Moved ConVars to client side due to new FiveM feature
122 |
123 | **v1.0.0**
124 | * Initial release
125 |
126 | ---
127 | ## Known Issues
128 | None as of right now :crossed_fingers:
129 |
130 | If you come across anything bugs/issues, please create an [Issue](https://github.com/d0p3t/MailDelivery/issues).
131 |
132 | ---
133 | ## Support
134 | If you require assistance, you can ask your question on the [FiveM forum topic](https://forum.fivem.net/t/maildelivery-v1-0-1-standalone-mail-delivery-job-for-paleto-bay-grapeseed-and-sandy-shores/168076). 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.
135 |
136 | ---
137 | ## Credits
138 | Last, but not least, some credits to people that have helped me get into FiveM coding and helped other wise.
139 |
140 | Thanks @Mooshe and his stream for the preliminary logic of parking spots and toggling duty (months ago).
141 | Thanks to @Vespura for letting me use the same license :)
142 |
143 | ___
144 |
145 | ## Final Words
146 | 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.
147 |
148 | If you have any requests, concerns, etc. please let me know.
149 |
150 | You can modify or edit the code as you like, but you cannot re-release it. Please see the [LICENSE.md](https://github.com/d0p3t/MailDelivery/blob/master/LICENSE.md)
--------------------------------------------------------------------------------
/__resource.lua:
--------------------------------------------------------------------------------
1 | resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9'
2 |
3 | name 'MailDelivery'
4 | description 'Standalone mail delivery job for Paleto Bay, Grapeseed and Sandy Shores.'
5 | author 'Remco Troost (https://www.d0p3t.nu)'
6 | version 'v1.0.2'
7 | url 'https://github.com/d0p3t/MailDelivery'
8 |
9 | client_script "MailDelivery.Client.net.dll"
10 |
--------------------------------------------------------------------------------
/azure-pipelines.yml:
--------------------------------------------------------------------------------
1 | trigger:
2 | batch: true
3 | tags:
4 | include:
5 | - v*
6 | branches:
7 | include:
8 | - master
9 |
10 | pr:
11 | - master
12 |
13 | pool:
14 | vmImage: 'VS2017-Win2016'
15 |
16 | variables:
17 | solution: '**/*.sln'
18 | buildPlatform: 'Any CPU'
19 | buildConfiguration: 'Release'
20 |
21 | steps:
22 | - task: NuGetToolInstaller@0
23 |
24 | - task: NuGetCommand@2
25 | displayName: 'Restore NuGet'
26 | inputs:
27 | restoreSolution: '$(solution)'
28 |
29 | - task: VSBuild@1
30 | displayName: 'Build solution'
31 | inputs:
32 | solution: '$(solution)'
33 | msbuildArgs: /p:DeployOnBuild=true /p:SkipInvalidConfigurations=true'
34 | platform: '$(buildPlatform)'
35 | configuration: '$(buildConfiguration)'
36 |
37 | - script: |
38 | echo "Copy build to staging"
39 | dir $(Build.SourcesDirectory)\MailDelivery.Client\bin\Release\
40 | xcopy $(Build.SourcesDirectory)\MailDelivery.Client\bin\Release\MailDelivery.Client.net.dll $(Build.ArtifactStagingDirectory)
41 |
42 | - script: |
43 | echo "Copy __resource.lua"
44 | xcopy $(Build.SourcesDirectory)\__resource.lua $(Build.ArtifactStagingDirectory)
45 |
46 | - task: PublishBuildArtifacts@1
47 | displayName: 'Publish artifacts'
48 | inputs:
49 | artifactName: 'maildelivery'
--------------------------------------------------------------------------------