local player = PlayerPedId()
local vehicle = GetVehiclePedIsIn(player, false)
local flag = 0
TaskLeaveVehicle(player, vehicle, flag)
For the flags, you can use:
0 = normal exit and closes door.
1 = normal exit and closes door.
16 = teleports outside, door kept closed.
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
function isCarBlacklistedowner(model)
for _, blacklistedCar in pairs(ownercarblacklist) do
if model == GetHashKey(blacklistedCar) then
return true
end
end
return false
end
function checkCarowner(car)
if car then
carModel = GetEntityModel(car)
carName = GetDisplayNameFromVehicleModel(carModel)
if isCarBlacklistedowner(carModel) then
local player = PlayerPedId()
local vehicle = GetVehiclePedIsIn(player, false)
local flag = 16
TaskLeaveVehicle(player, vehicle, flag)
notifycar()
end
end
end
I think this might be it, I will try and implement it if you think its correct.
function checkCarowner(car)
if car then
carModel = GetEntityModel(car)
carName = GetDisplayNameFromVehicleModel(carModel)
seat = TaskEnterVehicle( GetPlayerPed(-1))
if isCarBlacklistedowner(carModel) then
local player = PlayerPedId()
local vehicle = GetVehiclePedIsIn(player, false)
local flag = 0
TaskLeaveVehicle(player, vehicle, flag)
notifycar()
end
what you need to do then, is in whatever script allows you to put player in a car, in that client have a variable that is true while person is being put in car / is sitting in car
send the variable to this script in any way you like
then check variable before running your script.
if playerIsInHandcuffs == false then
if isCarBlacklistedowner(carModel) then
local player = PlayerPedId()
local vehicle = GetVehiclePedIsIn(player, false)
local flag = 0
TaskLeaveVehicle(player, vehicle, flag)
notifycar()
end
end