[HELP] RCON and PLAYERID (PLEASE)
#1

Please, help-me!

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success)
    {
    }
    else
    {
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    SendRMsg(playerid,COLOR2, "You has logged as RCON Adminitrator. Account: %s", PlayerName(playerid));
    }
}
message not appears, and my error is: undefined symbol 'playerid', how to fix it?
Reply
#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
#3

not functioned!
Reply
#4

Quote:
Originally Posted by JackNight
not functioned!
Do you mean it didn't work?
Reply
#5

yes, the message has showing to all players! This can't. the message showing for only player.
Reply
#6

You have a code on this page - https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)