[Release] [Standalone] Proper Drift script!

Hi,

our community has been in need for drift script that wouldn’t be like others publicly available - deleting grip completely.

So, I’ve got into the work and came up with our own drift script.

Script works on simple principle - increasing and decreasing values in handling model in real time upon pressing left Shift.

Applies appropriately for AWD vehicles too.

How script recognizes if drift mode is on or off? By checking value “fInitialDragCoeff” - if it has been hugely increased (value over 80.0), then drift mode is on and vice versa.

Other values like “removeFromfTractionCurveMax” are being increased and decreased respectively. Since I was lazy to create proper config, go through the code and find them yourselves. It’s simple code anyway.

Drift script works the best with semi-realistic handlings. If you have a shitty handling by default, drifting will be shitty as well, unless you will make changes in values yourself.

Also any engine upgrade will be respected, so you don’t need to be worried about loosing any power after revoking drift script!

By default, the drift script is only allowed for road and personal vehicles. I really wasn’t interested to see drifting busses, but if you will change the code, anything’s possible, right?

Bugs:

Some vehicles can upon hitting drift settings got stuck on the spot and wheels will disappear. One of the value isn’t converted as a solely number anymore. Look at the print in your client’s console, to see something like

0.512335abE

Solution:

Simply change car’s default value in it’s handling file by few units -

instead of

0.511112

to

0.511110

This will solve the problem with vehicle getting incorrect values.

We had a lot of fun with whole FiveM community and I am pleased to share this with all of you! Code is done entirely by me. Use and share as you like. If you want to make me happy, throw below in comments some videos featuring the script! :slight_smile:

Our community is no longer active, server is being shut down soon.

11 Likes

Looks absolutely fantastic, very well done!

1 Like

Looks good. Thanks. :ok_hand:

What speedometer is that?

this script work perfectly on rwd car. but with awd and fwd, its doesnt drift. i know that how it work but if their any chance u can change awd,fwd to rwd when drift mode is on ?

I prefer drifting with AWDs the way they are. Feel free to do any changes yourself. And have you seen driting FWD cars before? I haven’t…

yeah. i play around with the code to change it. when i turn off the drift, handling messup xD

When i’m loading it on server it freezes when loading vehicles.meta

cap2

Never happened to me or my community. Another resource causes the issue.

any idea how i can stop cars slowing down taking corners at high speed and linking drifts, its kind of difficult. drifting at slower speeds is great but notice the car doesnt respond much at higher speeds and seems like it enables some type of speed limit restriction.

The whole idea in this script is to make the car overpowered and then reduce it’s speed by adding a loads of drag - car spins, but doesn’t goes to space.

Ideal situation would be, if there would be manual transmission developed specifically for FiveM, so you could drift as IRL. And IKT’s MT for GTA doesn’t sync well in FiveM and gives you very annoying sound glitch (constant revving of opponent’s car).

You can try to adjust the drag coefficient yourself, just lower it down by some number. Just make sure you will do the same in it’s counterpart line (the whole script is based on adding and decreasing the same value on top of the original one).

1 Like

The script is awesome, and combined with DriftCounter is pretty good thing, but hell, is hard to do drifts… :joy: :smiling_face_with_three_hearts:

so what do u mean by changing car default value in handling file ?! i have some cars thats works pretty well with tcs off but when i get tcs on they get stuck yeah and i indeed see some number that have letters (for what i see for ur example the problems its the ones that have letters right?) now my question is how do u know what value will i change on handling file if u get some of those numbers with letters !? besides that great script tks for ur work

You said it right.

Below are values printed in the exact order. Change those values with letters in them in mentioned cars having the glitch after turning TCS on again. Just go to that car’s handling and change the value just a tiny bit and try TCS again. Obviously, if you will change values because of the glitch within TCS script, you may get new bunch of false results with different cars. It’s better to tweek handlings a bit instead.

“fInitialDragCoeff”
‘fDriveInertia’
“fSteeringLock”
“fTractionCurveMax”
“fTractionCurveMin”
“fTractionCurveLateral”
“fLowSpeedTractionLossMult”

1 Like

ty will try it later then another question is it possible to make it drif while shift(control) is press and turn tcs on when shift is released ?! i tried this but didnt work.

if GetHandlingfInitialDragCoeff >= 50.0 then

                        DriftOff()

                    else if IsControlPressed(0, 21) and ((GetVehicleClass(vehicle) == 0) or (GetVehicleClass(vehicle) == 1) or (GetVehicleClass(vehicle) == 2) or (GetVehicleClass(vehicle) == 3) or (GetVehicleClass(vehicle) == 4) or (GetVehicleClass(vehicle) == 5) or (GetVehicleClass(vehicle) == 6) or (GetVehicleClass(vehicle) == 7) or (GetVehicleClass(vehicle) == 9)) then

                        DriftOn()

                    end

tried changing the line before that too , to if iscontrolreleased but nothing…besides that tks for the script great work <3

I came across this script when looking for a way to create a drift mode. It works pretty good but the code is a bit messy :sweat_smile:
I’ve cleaned it up and also optimized it a bit. You can take a look at it on my fork on Github.
If you want I can open a PR on your repo to merge these changes :slight_smile:

1 Like

We will be reopening the server soon and I wanted to rewrite the script as well and to add few new features. If you already did some improvements, feel free push it on GitHub then!

I opened a PR.

In the readme you mentioned that some cars have problems with the mode, any examples? Because I couldn’t reproduce the bug…

I love what you did with it! Cleanup very well deserved. Pull request has been merged with your credit. Thank you.

That bug is kinda rare, but when it does happen, simply change the base value in handling file of the car for few hundredth, or any number really and it will smooth it out. I can’t explain it better than I did in my readme. :slight_smile:

1 Like

What am I doing wrong? Like prescribed even the file _resource.lua client_script ‘cl. lua’ but on my local server does not allow, you would at least make the resource)