SA-MP Forums Archive
RCON Message - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: RCON Message (/showthread.php?tid=271769)



RCON Message - RatHack - 25.07.2011

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?


Re: RCON Message - Ironboy500[TW] - 25.07.2011

https://sampwiki.blast.hk/wiki/OnRconLoginAttempt


Respuesta: RCON Message - RatHack - 25.07.2011

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;
}



Re: RCON Message - Mauzen - 25.07.2011

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;
}



Respuesta: RCON Message - RatHack - 26.07.2011

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.



Re: Respuesta: RCON Message - linuxthefish - 26.07.2011

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...


Respuesta: RCON Message - RatHack - 26.07.2011

Pawno>Includes

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


AW: RCON Message - Nero_3D - 26.07.2011

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;
}



Re: Respuesta: RCON Message - [MG]Dimi - 26.07.2011

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


Respuesta: RCON Message - RatHack - 26.07.2011

Thanks to all.

/lock please