/getip command for all online players?
#1

How can i make a command that check all players IPs online in my server, and find the players that has the /getip IP_EXAMPLE ?

Ex.

/getip 184.43.54.245
Info: 184.43.54.245 is Max (ID:3)


Regards,
Rodri.
Reply
#2

That should do
(didn't test to compile)
Код:
COMMAND:getip(playerid, params[])
{
	new ip[20], rst = -1;
	for(new i=0, j=GetPlayerPoolSize(); i<=j; i++)
	{
		if(IsPlayerConnected(i))
		{
			GetPlayerIp(i, ip, sizeof(ip));
			if(!strcmp(ip, params, true))
			{
			    rst = i;
			    break;
			}
		}
	}
	if(rst == -1) return SendClientMessage(playerid, -1, "No player found");
	new string[100];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(rst, name, sizeof(name));
	formt(string, sizeof(string), "%s(%d) has the IP: %s", name, rst, params);
	SendClientMessage(playerid, -1, string);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)