GetPlayerIp
From SA-MP Wiki
Description:
Get the specified player's IP address and store it in a string.
(playerid, ip[], len)
playerid | The ID of the player to get the IP address of. |
ip[] | The string to store the player's IP address in, passed by reference. |
len | The maximum length of the IP address (recommended 16). |
Return Values:
The length of the player's IP address. -1 if player specified doesn't exist.
- The player's IP address is stored in the specified array.
Notes |
|
public OnPlayerConnect(playerid) { new plrIP[16]; GetPlayerIp(playerid, plrIP, sizeof(plrIP)); if(!strcmp(plrIP, "127.0.0.1")) SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to your server, master :)"); return 1; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- NetStats_GetIpPort: Get a player's IP and port.
- GetPlayerName: Get a player's name.
- GetPlayerPing: Get the ping of a player.
- GetPlayerVersion: Get a player's client-version.
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnIncomingConnection: Called when a player is attempting to connect to the server.
- OnPlayerConnect: Called when a player connects to the server.
- OnPlayerDisconnect: Called when a player leaves the server.