Thanks for the help! Most of my coding-related topics have been met with absolute silence lately. I had begun to think I had been ghosted
I tried different vehicles(car, bike, truck) and I both commented and changed clearpedtasksimmediately but every time, my character visually is one moment sitting in the vehicle and the next standing outside of it. I also tried adding a 2 second pause between each step to allow it to follow through but that didn’t matter either.
I’m not sure what else to try. It’s a very basic script that looks for non police to be sitting in or on a police vehicle’s driver position and if it meets those conditions, removes them from the vehicle and strips their weapons. There’s really not much complexity to it.
while Config.kickFromPolice == true do
if (AntiCheat == true and whitelisted == false and whiteCheck == false)then
local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
local ped = GetPlayerPed(-1)
local vehicleClass = GetVehicleClass(vehicle)
PlayerData = ESX.GetPlayerData()
if vehicleClass == 18 and GetPedInVehicleSeat(vehicle, -1) == ped then
--print('SV: In service vehicle')
if PlayerData.job.name ~= 'police' and PlayerData.job.name ~= 'ambulance' and PlayerData.job.name ~= 'mecano' then
--print('SV: Not proper job')
TaskLeaveVehicle(ped, vehicle, 64)
TriggerEvent('esx:showNotification', 'This vehicle is not meant for you.')
TriggerEvent('esx:showNotification', 'We thank you for your generous donation of weapons.')