Admin %s connected. (Help)
#1

Hi, how what can I do so that every time an rcon admin login it will say: Admin "NAME" connected.
Reply
#2

- ignore; misread -
Reply
#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
#4

Quote:
Originally Posted by Lauder
Посмотреть сообщение
Hi, how what can I do so that every time an rcon admin login it will say: Admin "NAME" connected.
Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
When he refers to 'login', I think he is speaking about logging into RCON.
I totally misread his question, my bad!
Reply
#5

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
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.
Working perfect. Thanks a lot +REP XD
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)