Based on the information shared in this thread.
Driving Styles work as a list of 32 bits converted to a decimal integer. Each bit acts as a flag, and enables or disables a function inside the driving abilities of the AI ped you're scripting.
You can translate these bits to integers (and viceversa) with a converter like this one.
You apply the driving style to the ped like this:
C# (ScriptHookVDotNet) ped.DrivingStyle=DrivingStyle.Rushed or GTA.Native.Function.Call(GTA.Native.Hash.SET_DRIVE_TASK_DRIVING_STYLE, ped, int); C++ AI::SET_DRIVE_TASK_DRIVING_STYLE(ped,int)
Here are all the flags, their corresponding integers and the known functionalities:
FLAG ENABLED - CONVERTED INTEGER - DESCRIPTION 00000000000000000000000000000001 - 1 - stop before vehicles 00000000000000000000000000000010 - 2 - stop before peds 00000000000000000000000000000100 - 4 - avoid vehicles 00000000000000000000000000001000 - 8 - avoid empty vehicles 00000000000000000000000000010000 - 16 - avoid peds 00000000000000000000000000100000 - 32 - avoid objects 00000000000000000000000001000000 - 64 - ? 00000000000000000000000010000000 - 128 - stop at traffic lights 00000000000000000000000100000000 - 256 - use blinkers 00000000000000000000001000000000 - 512 - allow going wrong way (only does it if the correct lane is full, will try to reach the correct lane again as soon as possible) 00000000000000000000010000000000 - 1024 - go in reverse gear (backwards) 00000000000000000000100000000000 - 2048 - ? 00000000000000000001000000000000 - 4096 - ? 00000000000000000010000000000000 - 8192 - ? 00000000000000000100000000000000 - 16384 - ? 00000000000000001000000000000000 - 32768 - ? 00000000000000010000000000000000 - 65536 - ? 00000000000000100000000000000000 - 131072 - ? 00000000000001000000000000000000 - 262144 - Take shortest path (Removes most pathing limits, the driver even goes on dirtroads) 00000000000010000000000000000000 - 524288 - Probably avoid offroad? 00000000000100000000000000000000 - 1048576 - ? 00000000001000000000000000000000 - 2097152 - ? 00000000010000000000000000000000 - 4194304 - Ignore roads (Uses local pathing, only works within 200~ meters around the player) 00000000100000000000000000000000 - 8388608 - ? 00000001000000000000000000000000 - 16777216 - Ignore all pathing (Goes straight to destination) 00000010000000000000000000000000 - 33554432 - ? 00000100000000000000000000000000 - 67108864 - ? 00001000000000000000000000000000 - 134217728 - ? 00010000000000000000000000000000 - 268435456 - ? 00100000000000000000000000000000 - 536870912 - avoid highways when possible (will use the highway if there is no other way to get to the destination) 01000000000000000000000000000000 - 1073741824 - ?
Here are some examples of Driving Styles, gotten from ScriptHookVDotNet:
FLAGS - CONVERTED INTEGER - NAME/DESC OF THE DRIVING STYLE 01000000000011000000000000100101 - 1074528293 - "Rushed" 00000000000011000000000000100100 - 786468 - "Avoid Traffic" 00000000000000000000000000000110 - 6 - "Avoid Traffic Extremely" 00000000000011000000000010101011 - 786603 - "Normal" 00000000001011000000000000100101 - 2883621 - "Ignore Lights" 00000000000000000000000000000101 - 5 - "Sometimes Overtake Traffic"
Now that we know some flags what they do, lets analyze these known Driving Styles, starting with the simpler ones.
NOTE: flags not highlighted (marked with ^ ) are ignored by this guide, as we don't know what they do yet.
6 - Avoid Traffic Extremely
00000000000000000000000000000110 ^^ 10 - 2 - Stop before peds 100 - 4 - Avoid vehicles
This driving style is the simpler of them all, as you see. The driver will only avoid vehicles, but stop before peds.
5 - Sometimes Overtake Traffic
00000000000000000000000000000101 ^ ^ 1 - 1 - Stop before vehicles 100 - 4 - Avoid vehicles
This one, although simple, its also interesting. The driver will both stop before a vehicle and avoid it! How?
This is not a paradox or anything, it simply means the driver can stop before a vehicle or avoid it, probably at random.
1074528293 - Rushed, probably more used, works the same way:
01000000000011000000000000100101 ^ ^ ^ 1 - 1 - Stop before vehicles 100 - 4 - Avoid vehicles 100000 - 32 - Avoid Objects
We all know what this one does, it's used in a lot of scripts. The driver will brake when a vehicle is nearby, but sometime after, he will end up passing the vehicle. It will avoid vehicles that are completely stopped, too.
That, added to the fact that it also avoids objects too, makes this driving style a somwehat careful one.
786603 - Normal
00000000000011000000000010101011 ^ ^^ 1 - 1 - Stop before vehicles 10 - 2 - Stop before peds 10000000 - 128 - Stop at Traffic Lights
This seems to be the default style drivers use. Makes sense.
2883621 - Ignore Lights
00000000001011000000000000100101 ^ ^ ^ ^ 1 - 1 - Stop before vehicles 100 - 4 - Avoid vehicles 100000 - 32 - Avoid Objects 10000000 - 128 - Stop at Traffic Lights [OFF]
I've highlighted the bit that would make it stop at traffic lights. You can see it is off this time.
786468 - Avoid Traffic
00000000000011000000000000100100 ^ ^ 100 - 4 - Avoid vehicles 100000 - 32 - Avoid Objects
Another simple one, with only 4 flags on.
Having understood all of this, you can now create your own driving styles by setting ON any flags you need to.
1076 - Example
00000000000000000000010000110100 ^ ^^ ^ 100 - 4 - Avoid vehicles 10000 - 16 - Avoid peds 100000 - 32 - Avoid Objects 10000000000 - Reverse only
This driving style would be a pretty crazy one. the driver would avoid peds, vehicles and objects, all while going in reverse!
8388614 - Example2
00000000100000000000000000010110 ^ ^ ^^ 1 - 1 - Stop before vehicles 10 - 2 - Stop before peds 100000 - 32 - Avoid Objects 100000000000000000000000 - 4194304 - Ignore roads
This one would be fitting for any precise driving task. Careful, stopping at anything that moves, avoiding objects, and ignoring roads so the driver gets the vehicle exactly where you want.
Other natives that set the Driving Style
There are other natives that seem to override the Driving Style, you can set the Driving Style from there too.
Here's a list of the ones confirmed to set a Driving Style:
You can set the driver ability with PED:SET_DRIVING_ABILITY. While I am not sure if the max ability is 100f or 10f, I know that 100f works.
An higher value means that the AI reaction times and avoiding ability are better.
The lists above will be updated as more flags/natives are discovered, so stay tuned.
Remember that you pass the translated integer to the DrivingStyle native, not the binary presentation.