Quote:
Originally Posted by fiki574_CRO
pawn Код:
stock GetPlayerIdFromIp(ip[]) { new pip[32], playerid; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) == 1) { GetPlayerIp(i, pip, sizeof(pip)); if(!strcmp(ip, pip, true)) { playerid = i; break; } } } return playerid; }
Example usage:
pawn Код:
public OnRconLoginAttempt(ip[], password[], success) { new playerid; playerid = GetPlayerIdFromIp(ip); CallLocalFunction("OnRconLoginAttempEx", "dsb", playerid, password, success); return 1; }
pawn Код:
forward OnRconLoginAttempEx(playerid, password[], success); public OnRconLoginAttempEx(playerid, password[], success) { if(!success) { //do code here } else GameTextForPlayer(playerid,"~g~WELCOME, ~r~ADMINISTRATOR!", 3000, 5); return 1; }
|
If it's from console it will be recognized as id = 1