setControlState
Server
Presses or releases one of a player's controls as if it were a key. The order goes to their client, which applies it as setControlState on the local player.
Also exists on the client, with its own implementation: setControlState
bool setControlState(player thePlayer, string control, bool state)
Parameters
| Name | Type | Description |
|---|---|---|
| thePlayer | player | The player. |
| control | string | The control's name, case insensitive. |
| state | bool | true to hold it down, false to release it. |
Returns
true if the order was sent. false if the element is not a player or the control name does not exist.
Example
addCommandHandler("handbrake", function(player)
if isPedInVehicle(player) then
setControlState(player, "handbrake", true)
end
end)Coming from MTABesides MTA's controls, MYMP has
block (melee block) and reload.NoteThe player's own input on that control replaces the state the server sent.