[Questions] hat toggle and lock


#1

Hi so a couple things. Making a menu and looking on a
Way to toggle hat on / off for police peds.

Also is there any script that can lock the players car automatically at a certain distance. I can not find one. Should I make one?

Thanks for taking the time to read.


#2
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.


#3

Which framework are you using?
There is already one for esx!


#4

no framework. Do you have a link to the esx version?