10.10.2010, 13:26
Code can be optimized. Just return if it's find if not just INVALID_PLAYER_ID also use !IsPlayerNPC(playerid) to skip bot checks.
Hope you don't mind. Just trying to help.
pawn Code:
stock GetPlayerIDFromIP(ip[])
{
new
pIp[16]
;
for(new i; i != MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
GetPlayerIP(i, pIp, sizeof(pIp));
if(!strcmp(ip, pIp, true)) return i;
}
}
return INVALID_PLAYER_ID;
}