[help] Disable Control


#1

I have vRP


here

if handcuffed then
      SetPedStealthMovement(GetPlayerPed(-1),true,"")
      DisableControlAction(0,21,true) -- disable sprint
      DisableControlAction(0,24,true) -- disable attack
      DisableControlAction(0,25,true) -- disable aim
      DisableControlAction(0,47,true) -- disable weapon
      DisableControlAction(0,58,true) -- disable weapon
      DisableControlAction(0,263,true) -- disable melee
      DisableControlAction(0,264,true) -- disable melee
      DisableControlAction(0,257,true) -- disable melee
      DisableControlAction(0,140,true) -- disable melee
      DisableControlAction(0,141,true) -- disable melee
      DisableControlAction(0,142,true) -- disable melee
      DisableControlAction(0,143,true) -- disable melee
      DisableControlAction(0,75,true) -- disable exit vehicle
      DisableControlAction(27,75,true) -- disable exit vehicle
    end

i want to disable more control like w,s,d,a

SetPedStealthMovement(GetPlayerPed(-1),true,"")
        DisableControlAction(0,21,true) -- disable sprint
        DisableControlAction(0,24,true) -- disable attack
        DisableControlAction(0,25,true) -- disable aim
        DisableControlAction(0,47,true) -- disable weapon
        DisableControlAction(0,58,true) -- disable weapon
        DisableControlAction(0,263,true) -- disable melee
        DisableControlAction(0,264,true) -- disable melee
        DisableControlAction(0,257,true) -- disable melee
        DisableControlAction(0,140,true) -- disable melee
        DisableControlAction(0,141,true) -- disable melee
        DisableControlAction(0,142,true) -- disable melee
        DisableControlAction(0,143,true) -- disable melee
        DisableControlAction(0,75,true) -- disable exit vehicle
        DisableControlAction(27,75,true) -- disable exit vehicle
        DisableControlAction(0,32,true) -- move (w)
        DisableControlAction(0,34,true) -- move (a)
        DisableControlAction(0,33,true) -- move (s)
        DisableControlAction(0,35,true) -- move (d)

I tried to add more control but isn’t disable


#2

You have to call it in a loop.

Citizen.CreateThread(function()
       Citizen.Wait(0)
       if condition then
              -- DisableControlsHere --
       end
end)

I believe it has to be called every frame. so keep Citizen.Wait( 0 )


#3

Yes it’s there but not work

Citizen.CreateThread(function()
  while true do
    Citizen.Wait(0)
    if handcuffed then
      if freezed then
        SetPedStealthMovement(GetPlayerPed(-1),true,"")
        DisableControlAction(0,21,true) -- disable sprint
        DisableControlAction(0,24,true) -- disable attack
        DisableControlAction(0,25,true) -- disable aim
        DisableControlAction(0,47,true) -- disable weapon
        DisableControlAction(0,58,true) -- disable weapon
        DisableControlAction(0,263,true) -- disable melee
        DisableControlAction(0,264,true) -- disable melee
        DisableControlAction(0,257,true) -- disable melee
        DisableControlAction(0,140,true) -- disable melee
        DisableControlAction(0,141,true) -- disable melee
        DisableControlAction(0,142,true) -- disable melee
        DisableControlAction(0,143,true) -- disable melee
        DisableControlAction(0,75,true) -- disable exit vehicle
        DisableControlAction(27,75,true) -- disable exit vehicle
        DisableControlAction(0,32,true) -- move (w)
        DisableControlAction(0,34,true) -- move (a)
        DisableControlAction(0,33,true) -- move (s)
        DisableControlAction(0,35,true) -- move (d)
      end
    end
  end
end)

#4

Why is there 2 variables? freezed and handcuffed? are they both true? why can you just do if handcuffed == true then?


#5

yes it’s work and i can’t attack


#6

i made freeze and when i freeze player can’t attack me but he can move isn’t disable controls (w,s,a,d)


#7

did u fix it or no ?


#8

this topic is 8 months old, please create a new topic if you need help. This was already resolved.