NetStats_GetIpPort

warning

This function was added in SA-MP 0.3z and will not work in earlier versions!

Description

Get a player's IP and port.

NameDescription
playeridThe ID of the player to get the IP and port of.
ip_port[]A string array to store the IP and port in, passed by reference.
ip_port_lenThe maximum length of the IP/port. 22 is recommended.

Returns

The player's IP and port is stored in the specified array.

Examples

public OnPlayerCommandText(playerid,cmdtext[])
{
if (!strcmp(cmdtext, "/ipandport"))
{
new dest[22];
NetStats_GetIpPort(playerid, dest, sizeof(dest));
new szString[144];
format(szString, sizeof(szString), "Your current IP and port: %s.", dest);
SendClientMessage(playerid, -1, szString);
}
return 1;
}

Related Functions