Admin %s connected. (Help)
#3

When he refers to 'login', I think he is speaking about logging into RCON. Besides, it's not likely that someone is going to already be logged into RCON, before they even connect. So OnPlayerConnect wouldn't be the best option, but your code is correct.

https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(success == 1) //If the password was correct
    {
        new pip[16];
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i)) //foreach is the better option
            {
                GetPlayerIp(i, pip, 16);
                if(strcmp(ip, pip, false) == 0)
                {
                    //Use code given above
                    new szName[ MAX_PLAYER_NAME ], szStr[ 41 ];
                    GetPlayerName(i, szName, MAX_PLAYER_NAME );
                    format( szStr, sizeof( szStr ), "Admin %s connected", szName );
                    SendClientMessageToAll( 0xFFFF00FF, szStr );
                    break;
                }
            }
        }
    }
    return 1;
}
Take note, this may not always work correctly if there is more than one player with the same IP.
Reply


Messages In This Thread
Admin %s connected. (Help) - by RiChArD_A - 21.01.2013, 02:08
Re: Admin %s connected. (Help) - by LarzI - 21.01.2013, 02:11
Re: Admin %s connected. (Help) - by Threshold - 21.01.2013, 02:24
Re: Admin %s connected. (Help) - by LarzI - 21.01.2013, 02:39
Respuesta: Re: Admin %s connected. (Help) - by RiChArD_A - 21.01.2013, 03:42

Forum Jump:


Users browsing this thread: 2 Guest(s)