RCON Message
#1

Hello!

I want a SendClientMessageToAll when i log into rcon /rcon login xxxxx

So when i log into rcon it sends a message to all like: Player Rat has logged into rcon.

How to make it?
Reply
#2

https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
Reply
#3

I putted this but it send it spam with that sendclientmessage...

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{

    if(success == 1) //If the password was incorrect
    {
        new playername[MAX_PLAYER_NAME];
        new string[128];
        for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
        {
            GetPlayerName(i, playername, MAX_PLAYER_NAME);
            format(string, sizeof(string), "* %s has logged into rcon.", playername);
            SendClientMessageToAll(COLOR_ORANGE, string);
        }
    }
    return 1;
}
Reply
#4

You need to check for the IP, as there is no playerid given in that callback.

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{

    if(success == 1) //If the password was correct
    {
        new playername[MAX_PLAYER_NAME];
        new string[50];
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
        {
            if (!IsPlayerConnected(i)) continue;   // Skip if the player isnt connected
            GetPlayerIP(playerid, pip, 16);
            if (strcmp(pip, ip)) continue;   // Skip if the IP of player i is not the rcon IP
            GetPlayerName(i, playername, MAX_PLAYER_NAME);
            format(string, sizeof(string), "* %s has logged into rcon.", playername);
            SendClientMessageToAll(COLOR_ORANGE, string);
        }
    }
    return 1;
}
Reply
#5

It gives me a error:

pawn Код:
C:\Users\Valentino\Desktop\Rat's propiety\0.3b Server Samp1\gamemodes\DS.pwn(3906) : error 017: undefined symbol "GetPlayerIP"
Pawn compiler 3.2.3664          Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

Quote:
Originally Posted by RatHack
Посмотреть сообщение
It gives me a error:

pawn Код:
C:\Users\Valentino\Desktop\Rat's propiety\0.3b Server Samp1\gamemodes\DS.pwn(3906) : error 017: undefined symbol "GetPlayerIP"
Pawn compiler 3.2.3664          Copyright © 1997-2006, ITB CompuPhase


1 Error.
Your includes are messed up, re-download the server package...
Reply
#7

Pawno>Includes

I already put there all the default includes and still giving me the error
Reply
#8

GetPlayerIp

pawn Код:
public OnRconLoginAttempt(ip[], password[], success) {
    if(success == 1) {
        new
            i,
            tmp[64];
        for( ; i != MAX_PLAYERS; ++i) {
            if(!GetPlayerIp(i, tmp, 16) || strcmp(tmp, ip)) {
                continue;
            }
            GetPlayerName(i, tmp, MAX_PLAYER_NAME);
            format(tmp, sizeof tmp, "* %s has logged into rcon.", tmp);
            SendClientMessageToAll(COLOR_ORANGE, tmp);
            break;
        }
    }
    return true;
}
Reply
#9

Quote:
Originally Posted by linuxthefish
Посмотреть сообщение
Your includes are messed up, re-download the server package...
No. Real function is GetPlayerIp not GetPlayerIP. Just replace IP with Ip and it will work
Reply
#10

Thanks to all.

/lock please
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)