toggleControl | Multi Theft Auto: Wiki Skip to content

toggleControl

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


Enables or disables the use of a GTA control for a specific player.

Note

If you want to disable weapons fire, remember to also disable the control action in addition to the control fire .

Syntax

toggleControl ( )

Code Examples

server

This function will disable the use of the vehicle secondary-fire key for anyone in a Hydra, consequently removing the ability to fire rockets.

function disableFireForHydra ( theVehicle, seat, jacked )
if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra
toggleControl ( source, "vehicle_secondary_fire", false ) -- disable their fire key
else -- if they entered another vehicle
toggleControl ( source, "vehicle_secondary_fire", true ) -- enable their fire key
end
end
addEventHandler ( "onPlayerVehicleEnter", root, disableFireForHydra )