[HELP] RCON and PLAYERID (PLEASE)
#2

Try this, its untested, although it should work (unless theres a typo somewhere)

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;
}
Indentation has gone a little crazy, sorry 'bout that.

Not sure also how your PlayerName function works, the

pawn Код:
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
Might have been required, but I took it that they wern't going to be needed, depends on how your PlayerName function works.
Reply


Messages In This Thread
[HELP] RCON and PLAYERID (PLEASE) - by Jack321 - 21.02.2010, 11:48
Re: [HELP] RCON and PLAYERID (PLEASE) - by pyrodave - 21.02.2010, 12:33
Re: [HELP] RCON and PLAYERID (PLEASE) - by Jack321 - 27.02.2010, 23:27
Re: [HELP] RCON and PLAYERID (PLEASE) - by [HiC]TheKiller - 27.02.2010, 23:31
Re: [HELP] RCON and PLAYERID (PLEASE) - by Jack321 - 27.02.2010, 23:57
Re: [HELP] RCON and PLAYERID (PLEASE) - by Correlli - 27.02.2010, 23:59

Forum Jump:


Users browsing this thread: 1 Guest(s)