Citizen.CreateThread(function()
while true do
Wait(1)
playerPed = GetPlayerPed(-1)
car = GetVehiclePedIsIn(playerPed, false)
if car then
if Config.DisableDriveBy then
if GetPedInVehicleSeat(car, -1) == playerPed then
SetPlayerCanDoDriveBy(PlayerId(), false)
elseif passengerDriveBy then
SetPlayerCanDoDriveBy(PlayerId(), true)
else
SetPlayerCanDoDriveBy(PlayerId(), false)
end
end
end
end
end)
instead of this, because it consumes ms pointlessly even though it is disabled.
Citizen.CreateThread(function()
if not Config.DisableDriveBy then return end
while true do
Wait(1)
local playerPed = PlayerPedId()
local car = GetVehiclePedIsIn(playerPed, false)
if car then
if GetPedInVehicleSeat(car, -1) == playerPed then
SetPlayerCanDoDriveBy(PlayerId(), false)
elseif passengerDriveBy then
SetPlayerCanDoDriveBy(PlayerId(), true)
else
SetPlayerCanDoDriveBy(PlayerId(), false)
end
else
Citizen.Wait(500) --no point running fast while not driving
end
end
end)
also PlayerPedId() faster than GetPlayerPed(-1)
I was going to “pull request” on github, but you didn’t upload it to github, so
Fivem Crashes when using this script, it loads first but when ingame it stops Loading the Resources and then it crashes, Issue only comes up when you disabled certain stuff in the config.
Thanks for the quick response, you can try to reproduce the crash, in my case i disabled “NoNPC”, “Carblacklist”, “AntiVDM” and “Egoshoot” after disable them, all people will stuck in the section where it loads the scripts for the Server and the game will crash.
Thanks for the quick fix, but i found a new bug now. When “EgoShooting” is disabled its still the problem that when you shoot with your weapon, that it goes into Ego for that, you can aim without beeing in ego, but when you shoot it zooms in.