Scripting/Squirrel/Functions/Players/IsAdmin

From VC-MP Wiki

Jump to: navigation, search

This Player class variable returns whether the player has logged in as a Remote Console admin.

Syntax

bool player.IsAdmin

Example

This command will check, if the player is an admin. Use '/c playeradmin <Nick/ID>'

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "playeradmin" )
     {
          local plr = FindPlayer( text );
 
          if ( !plr ) PrivMessage( "Player: '" + text + "' is not online", player );
          else if ( plr.IsAdmin ) PrivMessage( "The player is an admin", player );
          else PrivMessage( "The player isn't an administrator", player );
   }
}

Notes

The function PrivMessage, FindPlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Personal tools
squirrel scripting