Awesome. Already purchased. If I read correctly the other forklift mod you released comes with this, right?
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
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
-- 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
-- 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
if gridCellValue then return true end
return _windingNumber(point, poly.points)
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)
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 !
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…
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.
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.
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)
when other players load pallets the product become unattached.
trailer sometimes disappearing when detaching forklift [tentative]
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!
product 1 as with the new collision you couldn’t pick it up.
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.
were can we grab the update ?!