TogglePlayerControllable
From SA-MP Wiki
TogglePlayerControllable
Toggles whether a player can control themselves, basically freezes them.
(playerid, toggle)
| playerid | The ID of the player to toggle the controllability of |
| toggle | 0 to freeze the player or 1 to unfreeze them |
This function does not return a specific value.
public OnPlayerCommandText(playerid, cmdtext[]) { // Freezes a player when they types /freezeme if(strcmp(cmdtext, "/freezeme", true) == 0) { TogglePlayerControllable(playerid,0); return 1; } // Unfreezes a player when they types /unfreezeme if(strcmp(cmdtext, "/unfreezeme", true) == 0) { TogglePlayerControllable(playerid,1); return 1; } return 0; }
