Randomly locked vehicles

This is what I am working with right now.

Citizen.CreateThread( function()
	while true do
		Wait(0)
        if IsPedJacking(GetPlayerPed(-1)) then
			Wait(3000)
			if math.random > 0.8 then
				SetVehicleDoorsLocked(vehicle, 2)
			elseif math.random < 0.2 then
				SetVehicleDoorsLocked(vehicle, 1)
		end
	end)
end)

Just trying to put like a 20% chance for AI cars to be unlocked, but it isn’t seeming to work correctly. Still leaves all vehicles locked.

take a look at this: [Release] No more NPC/parked vehicle stealing

I will take a look at it, I looked at that one before but saw a few comments and a open issue on github about it not working with ESX which is what we run with.

this is standalone ()

Yeah but there are reports that script locks vehicles when they spawn from the garage in ESX. I scrolled through the post and there was someone who posted a snippet making the script a little more simple. May try that out

Where location file ?