DiscordVehicleRestrictions [A Discord based vehicle restriction script] (INCLUDES INHERITANCE)

Is there a way to have it kick someone out of the car instead of delete it? (In this case, mechanic RP, they get in a car to fix it but don’t actually have the right permissions to be able to drive it themselves so it DV’s in the middle of an RP haha)

How can I enable this to still work if someone has a vehicle saved and spawns it?

It will restrict it regardless of if they have it saved or not.

You can do this by changing this line in the client.lua

DeleteEntity(veh)

To This:

Here is the code snippet you can copy and paste:

local player = PlayerPedId()
local vehicle = GetVehiclePedIsIn(player, false)
local flag = 64 -- This number can be changed to dictate how the ped leaves the vehicle
TaskLeaveVehicle(player, vehicle, flag)

Read over this to change the “local flag = (number)” variable to control how the ped exits out the vehicle.

Here is what each number means (64 I found works quite well):

Flags from decompiled scripts:

0 = normal exit and closes door.
1 = normal exit and closes door.
16 = teleports outside, door kept closed. (This flag does not seem to work for the front seats in buses, NPCs continue to exit normally)
64 = normal exit and closes door, maybe a bit slower animation than 0.
256 = normal exit but does not close the door.
4160 = ped is throwing himself out, even when the vehicle is still.
262144 = ped moves to passenger seat first, then exits normally

TaskLeaveVehicle Native

2 Likes

Amazing! I will give this a try thank you!

It works!

1 Like