Scripting/Squirrel/Functions/Players/IP

From VC-MP Wiki

Jump to: navigation, search

This instance variable returns player's IP address.

Syntax

string player.IP

Example

This command gives player's IP when someone types '/c ip playername/id'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "ip" )
     {
          local plr = FindPlayer( text );
          
          if ( !plr ) MessagePlayer( "Player '" + text + "' is not online.", player );
          else MessagePlayer( plr.Name + "'s IP: " + plr.IP, player );
     }
}

Notes

The functions MessagePlayer, FindPlayer, player.Name and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Personal tools
squirrel scripting