open.mp | TogglePlayerControllable
  • Home
  • FAQ
  • Forum
  • Servers
  • Docs
  • Blog
  • Login
  • Englishاللغة العربيةar-TNবাংলাbosanski jezikDeutschΕλληνικάEspañoleestiفارسیFrançaisHrvatskimagyarBahasa IndonesiaItaliano日本語ქართულიlietuvių kalbaNederlandsNorskjęzyk polskiPortuguêsRomânăРусскийslovenski jezikсрпски језикไทยWikang TagalogTürkçeУкраїнськаاردوTiếng Việt简体中文繁體中文
warning Not Translated

This page has not been translated into the language that your browser requested. The English content is being shown as a fallback.

If you want to contribute a translation for this page then please click here.

TogglePlayerControllable

Description

Toggles whether a player can control their character or not. The player will also be unable to move their camera.

NameDescription
playeridThe ID of the player to toggle the controllability of
toggle0 to make them uncontrollable, 1 to make them controllable.

Returns

1: The function executed successfully.

0: The function failed to execute. The player specified does not exist.

Examples

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;
}

Related Functions

Community

  • Discord
  • Instagram
  • Twitter
  • Twitch
  • YouTube
  • Facebook
  • VK

More

  • SA-MP
  • Blog
  • GitHub