[ESX][JavaScript][Discord Integration] IamAdren's Trucking Job!

IamAdren's Trucking Job

This trucking job operates from a SQL table with shipments in it, the shipments get reset every x seconds allowing for limited shipments. This resource is 83% LUA, I was planning on using 100% JS but found that car spawns, server side xPlayer payments weren't working 100% of the time so I put them onto LUA.

Download

Documentation

Features

  • Shipments are in the database.
  • Shipments get refilled every refreshRate seconds.
  • 83% Written in JavaScript.
  • Discord command with available shipments.

Installation

FiveM Setup

  1. CD Into the folder Not while the FXServer is started!

  2. Type npm i

  3. Run the SQL File into your MySQL Server.

  4. Edit the config with your MySQL Detail

module.exports = {
    mysql: { // SQL Login Details
        host     : 'localhost',
        user     : 'root',
        password : '',
        database : 'adren'
    },
    refreshRate: 5 * 60000, // *5 Minutes* (Refresh Rate is how long until the database gets refilled)
    botToken: '', // Found on Discord.com/developers
    prefix: '!'
}
  1. Edit the config.js with your delivery locations.
// Default delivery locations
module.exports.locations = [
    {
        1: {
            value: [2500, 4500], // Random amount per delivery for tier 1
            maxInDB: 5,
            locations: [
                {name: 'PDM', x: -15.93, y: -1104.25, z: 25.67, vehicles: ['mule', 'boxville2']},
                {name: 'Luxury Autos', x: -810.84, y: -228.29, z: 36.21, vehicles: ['mule', 'boxville2']},
                {name: 'Bob Mulét Hair Salon', x: -829.9, y: -191.6, z: 37.46, vehicles: ['rumpo']},
                {name: 'Airport', x: -1136.81, y: -2688.62, z: 13.94, vehicles: ['benson']},
                {name: 'Post OP (HQ)', x: -409.13, y: -2795.72, z: 6, vehicles: ['boxville2']}
            ]
        }
    },
    {   
        2: {
            value: [5500, 7500], // Random amount per delivery for tier 2
            maxInDB: 4,
            locations: [
                {name: 'Xero 24 (Postal 4027)', x: 264.38, y: -1244.98, z: 28.14, vehicles: ['mule', 'boxville2']},
                {name: 'Gas (Postal 802)', x: 1780.95, y: 3330.17, z: 40.25, vehicles: ['mule', 'boxville2']},
                {name: 'LTD (Mirror Park)', x: 1169.84, y: -317.44, z: 69.18, vehicles: ['mule']},
                {name: 'Airport', x: -1136.81, y: -2688.62, z: 13.94, vehicles: ['benson']},
                {name: 'Post OP (Paleto)', x: -429.02, y: 5132.21, z: 31.48, vehicles: ['boxville2']}
            ]
        }
    },
    {
        3: {
            value: [8500, 11500], // Random amount per delivery for tier 3
            maxInDB: 1,
            locations: [
                {name: 'Paleto Warehouse', x: 201.5, y: 6399.78, z: 31.38, vehicles: ['phantom']},
                {name: '24/7 (Mount Chiliad)', x: 1718.34, y: 6423.8, z: 33.21, vehicles: ['mule']},
                {name: 'LTD (Grapeseed)', x: 1694.01, y: 4915.19, z: 42.08, vehicles: ['mule']}
            ]            
        }
    }
]

Showcase Video Click Me

Discord command showcase

Credits

Delivery Locations

3 Likes

maybe was better go like delivery some cargo and back to the place where pick the car, otherwise you gel left by foot where you leave the car

3 Likes

That would be cool, so basically you go deliver the cargo to the location and then you have to bring the truck back to the depot. I will look into it

2 Likes

Very cool script :smile:

1 Like

Was just going to make the same comment - as of now people would be stranded without a vehicle at their destination.

This script would be lit if you have to return the truck back to the depot/wherever you got it from.

Yea I’ll prob end up doing this, wouldn’t be that hard.

1 Like

anyone can help me installing this, i tried npm i not working

Do you have Node JS installed?

yes i have

got this error while npm i

Did you download all the files?

yes i have sir

That’s a unique way of making a job, sadly it’s on ESX.

Pretty sure this is for the latest ESX, right? Is there a possibility of this being an ESX v1 script?

I tested it on ESX V1, Im pretty sure it should work on V2 aswell

v2 uses a module system, so it most likely won’t unless you make changes.

Hmm, I thought one of the main things that ESX V2 was pushing for was backwards compatibility?

I used ESX because #1 There menu system is pretty nice and simple, #2 They have an economy function. It wouldn’t be too hard to change the code to use either NativeUI or your own Eco framework. Or even remove all of the eco components :man_shrugging:

Documentation down…

Is it possible you could upload this ?

Yea i was moving my hosting, should be back up soon.