[Release] Towtruck Script V1.2

#1

asser-tow

This is a basic tow script for fivem using chat commands.

The script as is only works using a flatbed. Changeing the flatbed model on your server might break the script as it attaches the vehicle you want to tow to a specific bone on the flatbed.

Please note that if the last vehicle you’ve used is not the flatbed truck you want to tow something on, then you wont be able to tow, and theres no distance built into the script yet, so it wont know if you are towing a vehicle 100ft away or just 10ft away. Either make it yourself or wait for an update :wink:

Download

Installation:

Clone the project or download the master.

Add asser-tow to resources folder.

Add “start asser-tow” to server.cfg

Usage:

Drive a ‘flatbed’ - (the script looks for your last driven vehicle, and it needs it to be a flatbed)

Go near a vehicle you want to tow and write /tow in the chat-

Drive around

Exit flatbed and write /tow to detach vehicle again.

V1.1 - for ES

pv-tow.zip - Did not show error if no vehicle was to tow. Now it does.

V1.2 - for FX

pv-tow.zip
Changelog: Removed all ES command stuff and used the stringsplit instead since mostly people working with ES would know how to convert it. Also change stringsplit to one working with FX which means that it should be working perfectly. Tested and working on FX

V1.3 - Githubbed

Project now gitted, all future versions and contributions goes here + changed name since projectviking no more exists.

17 Likes

[RELEASE] Tow Menu 0.1 [17/06]
FiveM Flatbed script?
Attach to FlatBed
[[REQUEST]] Tow Script
Trucking, Van Drop Offs, Pilot Jobs
[Release] Improved Tow Truck Script (Includes 2 custom flatbeds)
Attempting to make a car "tow" trailer
How to make a addon trailer attach to for example: bobcatxl?
Are there any working script?
#2

OMG U are amazing thanks!

0 Likes

#3

That chat message though. Lmao! :+1:

0 Likes

#4

Yah, had to put something in :wink:

0 Likes

#5

@asser90 nice! SoE doesn’t even have that sort of check. I’ve seen a tow truck on a tow truck being towed by a tow truck. Lol.

0 Likes

#6

I am getting the message “Vehicle successfully attached to towtruck!”, but the car does not actually get attached,

0 Likes

#7

No errors ? Console - F8 ingame ?

EDIT:

I see the error occurs when theres not a vehicle infront of you. - That is btw the only check it does. If vehicle infront is more than 5 ft away it wont do anything.

0 Likes

#8

Your awesome Thanks for sharing

0 Likes

#9

Just released a hotfix due to @Refuser having a problem where it would tow even if there was nothing to tow. - Thats not the case now.

0 Likes

#10

Thanks that was the problem. Works perfect

0 Likes

#11

thx for the release @asser90 keep up the good work

0 Likes

#12

yeah for some reason when i go by vehicles parked i type /tow and nothing happens i just get theres no vehicle to tow

0 Likes

#13

the vehicle should be behind the towtruck. after exiting the tow truck stand near the drivers side front tire of the car you wish to tow. look towards the car you wish to tow not the towtruck.

0 Likes

#14

I would like to thank you for supplying this to us it is a great script I love it .
Has somebody found a way to implement this so we can create jobs and get paid using essential mode and Freeroam?

0 Likes

#15

This does not necessarily have to be built into a jobscript. It can function as if you are just using the flatbed at all.

0 Likes

#16

We would need to create another table in the database for this to work in order to get paid ?

0 Likes

#17

__resource.lua

-- Towtruck script by Asser90

-- Manifest
resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'

-- General
client_script 'cl_tow.lua'
server_script 'sv_tow.lua' 
server.lua : 
AddEventHandler('chatMessage', function(source, n, message)
    cm = stringsplit(message, " ")

    if(cm[1] == "/tow") then
		CancelEvent()
		TriggerClientEvent("pv:tow", source)
	end
end)

function stringsplit(self, delimiter)
  local a = self:Split(delimiter)
  local t = {}

  for i = 0, #a - 1 do
     table.insert(t, a[i])
  end

  return t
end

This is a modification for people that don’t use ESseintialmode . Be advised that i changed the clientevent nime from pv:tow or how it was to tow on my side,

0 Likes

#19

This wont need to be changed in anyway for a mission to work ppl…

Just make a towtruckmission script that does whatever you like. The script can always listen for if a specific vehicle was towed to a specific place. It has nothing to do with this script…

0 Likes

#21

hi, when i spawn personal vehicle, i can’t /tow this vehicle, work only with vehicule(ped) in circulation

0 Likes

#22

do you have to spawn a flatbed yourself or you have to find one on the street?

0 Likes