25.07.2011, 21:53
You need to check for the IP, as there is no playerid given in that callback.
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success == 1) //If the password was correct
{
new playername[MAX_PLAYER_NAME];
new string[50];
new pip[16];
for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
{
if (!IsPlayerConnected(i)) continue; // Skip if the player isnt connected
GetPlayerIP(playerid, pip, 16);
if (strcmp(pip, ip)) continue; // Skip if the IP of player i is not the rcon IP
GetPlayerName(i, playername, MAX_PLAYER_NAME);
format(string, sizeof(string), "* %s has logged into rcon.", playername);
SendClientMessageToAll(COLOR_ORANGE, string);
}
}
return 1;
}