How to disable " like press K or F2 " when people in car?


#1

guys. i dont want to people press F1 or some other key like F3 or K "its depends. "
i mean how to disable press key when people in car ?
Thank you.


#2
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0) -- Wait 0 seconds to prevent crashing.
        if IsPedInAnyVehicle(PlayerPedId(), true) then -- If the player is (trying to use /) using a vehicle
            DisableControlAction(0, --[[Control ID Goes Here]], true)
        end
    end
end)

https://docs.fivem.net/game-references/controls/
https://wiki.fivem.net/wiki/Controls


#3

@Vespura
How about press key automaticly when player in a car ?
Just one time when he enter the car ?


#4

Not sure that’s possible.


#5

@Vespura

how about make this disable when people in vehicle

local function ch_emote(player,choice)
  local emote = emotes[choice]
  if emote then
     vRPclient.playAnim(player,{emote[1],emote[2],emote[3]})
  end
end