Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local player = GetPlayerPed(-1)
if IsPedInAnyVehicle(player, false) then
SetPlayerCanDoDriveBy(PlayerId(), false)
else
Citizen.Wait(500) --Just for optimize
end
end
end)
Players can already shoot out of the vehicles, but I want to disable the scroll keys, currently I have a key setup that changes the state of the engine by using the mouse scroll.
Thank you! This worked for me, but I have 1 question, it also disabled the TAB key, is it possible to enable the TAB key and disable the mouse scroll?
The code that is working:
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local player = GetPlayerPed(-1)
if IsPedInAnyVehicle(player, false) then
DisableControlAction(0, 99, true)
else
Citizen.Wait(500) --Just for optimize
end
end
end)