21.02.2010, 12:33
Try this, its untested, although it should work (unless theres a typo somewhere)
Indentation has gone a little crazy, sorry 'bout that.
Not sure also how your PlayerName function works, the
Might have been required, but I took it that they wern't going to be needed, depends on how your PlayerName function works.
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success) //why (!success) when just (success) ?
{
new PlayerIP[16]; //you need to compare the IP, not the name, max IP length is 16
for(new i=0; i<MAX_PLAYERS; i++) //loop through all the players
{
if(IsPlayerConnected(i))
{
GetPlayerIP(i, PlayerIP, 16);
if(!strcmp(PlayerIP,ip)) //compare the players ip to the login attempt
{
SendRMsg(i,COLOR2, "You have logged as an RCON Administrator. Account: %s", PlayerName(i)); //send the player who logged in a message (and fixed spelling of "Administrator")
break; //break out of the loop, you have found the player, so stop looping
}
}
}
}
return 1;
}
Not sure also how your PlayerName function works, the
pawn Код:
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);