ESX Forklift Delivery

ESX Forklift Delivery

A custom delivery job (not based on any previous ESX delivery job) using my forklift-trailer mod to demonstrate its abilities. This has a pretty sophisticated back end with 25+ pick up and 30+ drop off locations. All locations are relevant to the product they sell or buy.

Features

  1. ESX Society Integration with custom log for bosses to view employee performance.
  2. Hundreds of different delivery job variations.
  3. Persistent jobs, if a player disconnects they can come back and carry on their job.
  4. Working together: players can take others with them on the job.
  5. Black market: player can get robbed and their pallets sold to back market seller, hidden on the map.
  6. Breakable products: Pallets can be dropped and broken for which the player is fined. Drop a military shipment and you won’t just lose your job…
  7. Wages based on km traveled, product type and number of pallets delivered.
  8. There are 7 different category of delivery: Commercial, Construction, Church, Farming, Industry, Military and Security.
  9. Profit sharing: society takes a share of the profit. All configurable in config.
  10. Self employed: Players can use their own trucks and trailers as-well as borrow company vehicles.
  11. Multi-language support
  12. Everything customizable; products, locations, wages, enable and disable certain features all in config.lua

Quick Demo

Price: $30
Link on Tebex

7 Likes

Awesome. Already purchased. :slight_smile: If I read correctly the other forklift mod you released comes with this, right?

1 Like

Yeah it’s included.

1 Like

can you send me resmon MS?

I have it showing in the video on this post.

If players have a different job the ms is >0.01; all the mod would be doing in this case is checking location to see if they are close to the blackmarket buyer.

When players have the forklift job the ms will change depending on what they are doing. But there is only one while true loop in the both mods. Everything else will start and stop depending on what they are doing.

As-well, the resources used on the enc0ded-forklift-trailer mod only increases when the player is interacting with stuff, for things like markers and having to check if a product has become unattached to reattach them as this seems to be a bug in GTAV/FiveM, but will remain at >0.01ms when they are not doing anything.

shown in video, its actually pretty solid for what it does. Thinking bout replacing some shit

You can get the MS down using polyzones. Dunno why people insist on still using distance checks but :woman_shrugging:

I wasn’t aware of the polyzones mod. I will take a look today.

EDIT: Looking at the polyzone mod, it uses distance checks to see if an entity is inside a zone too. In fact it’s more expensive than the code I’m using because polyzones can be many shapes and consider head height.

local function _pointInPoly(point, poly)
  local x = point.x
  local y = point.y
  local min = poly.min
  local minX = min.x
  local minY = min.y
  local max = poly.max

  -- Checks if point is within the polygon's bounding box
  if x < minX or
     x > max.x or
     y < minY or
     y > max.y then
      return false
  end

  -- Checks if point is within the polygon's height bounds
  local minZ = poly.minZ
  local maxZ = poly.maxZ
  local z = point.z
  if (minZ and z < minZ) or (maxZ and z > maxZ) then
    return false
  end

  -- Returns true if the grid cell associated with the point is entirely inside the poly
  local grid = poly.grid
  if grid then
    local gridDivisions = poly.gridDivisions
    local size = poly.size
    local gridPosX = x - minX
    local gridPosY = y - minY
    local gridCellX = (gridPosX * gridDivisions) // size.x
    local gridCellY = (gridPosY * gridDivisions) // size.y
    local gridCellValue = grid[gridCellY + 1][gridCellX + 1]
    if gridCellValue == nil and poly.lazyGrid then
      gridCellValue = _isGridCellInsidePoly(gridCellX, gridCellY, poly)
      grid[gridCellY + 1][gridCellX + 1] = gridCellValue
    end
    if gridCellValue then return true end
  end

  return _windingNumber(point, poly.points)
end

In my mod I only need to know if a player is close to a point so I subtract vector3s with lua which is 10x faster than the GTA natives.

Utils.DistanceBetweenCoords = function(coordsA, coordsB)
  return #(vector3(coordsA.x, coordsA.y, coordsA.z).xy - vector3(coordsB.x, coordsB.y, coordsB.z).xy)
end
1 Like

i bought it and we have the 2 the same job and go did it but the other person didnt earn any money how did this function work ?!

The intention was that the working player could “show someone the ropes”, but they don’t get paid though. Right now, the second player can load the trailer for the working player but cannot complete the delivery alone. I may update this though.

EDIT: I should mention why it’s like this… If the other player could make the delivery too they would need to know where every delivery location on the map was so would add unnecessary load. But because people can steal pallets, they need to be networked anyway so I thought it would be cool if other people could load them for you.

yeah u should make as u could use 2 people on the same work , and then split the salary between them i think its better than just working alone, i atually bought it thinking it could be a 2 man job too !

1 Like

Could always just give your teammate half of what you earn. Why put unnecessary coding in for something that you can easily do via your inventory…

1 Like

I see you can use your own truck or borrow a company vehicle. Would it be possible to pay more if you use your own equipment? (basically like IRL where Owner Operator drivers get paid better than company drivers

This is not a bad idea. I’ll make it so that if you use your own truck you pay the society a smaller percentage.

A+ trucking job, love it no issues at all! Was easy to modify to work with RufiCarKeys.

I suggest you add a way to have a choice of 3 different trucks to choose from and I agree with the comments above. Just have it check if vehicle ped is in is from owned vehicles table or not, if it is, the commission could be 25% more.

1 Like

Great to hear.

I will definitely implement that idea. I was thinking instead of checking the owned vehicle table just check if they are using one from the society, if they are not then they get the extra commission. Will be cheaper that way and won’t have to worry about different db schemas.

Edit: just pushed a small update to enc0ded-forklift-trailer by the way.

1 Like

I didn’t think of that, way better! What was the update for forklift?

Possible to have more than 1 owner/boss that has it’s own society? I can probably edit if I actually read more of the code, but my eyes hurt from everything else I’ve been doing, haha.

New update (from repo)
Fixed:
when other players load pallets the product become unattached.
trailer sometimes disappearing when detaching forklift [tentative]
Changed:
various z axis for products as with the new collision they are hard to pick up.
the way pallets are initiated; more performant so could remove one thread.
Added: Collision for the attached forklift and products. Can ride the forklift while driving now! :yum:
Removed:
product 1 as with the new collision you couldn’t pick it up.
Possible issues:
Due to added collision on products, at some locations it could be hard to pickup the pallet depending on its orientation as some products sit over the side of the pallet. I need to go through every location and every product but there are many permutations.

To add another society you’d need to break out the society in config into it’s own table and go through the code and reference each table individually.

I may add support for this in a later release , if you do it will be hard for you to use any further versions I release as the code will be mismatched. Unless you want to push your changes to the repo, I will gladly merge.

1 Like

were can we grab the update ?!