while true do
Citizen.Wait(0)
local veh = GetVehiclePedIsIn(GetPlayerPed(-1), true)
local vehCoords = GetEntityCoords(veh, true)
local plyCoords = GetEntityCoords(GetPlayerPed(-1), true)
if GetDistanceBetweenCoords(plyCoords.x, plyCoords.y, plyCoords.z, vehCoords.x, vehCoords.y, vehCoords.z, true) > 15 then
SetVehicleDoorsLockedForAllPlayers(veh, true)
end
end)
I am tired and this is probably a really bad way of doing it but yeah.