SA-MP Forums Archive
HELP PLEASE - 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: HELP PLEASE (/showthread.php?tid=271861)



HELP PLEASE - RatHack - 26.07.2011

Hello

I want the /rcon login xxxx only can be typed by a IP, if that IP doesn't match it sends a message to the player and it cant log in

Only the IP write in the gamemode can log into rcon

Do you know guys how to make that?


Re: HELP PLEASE - linuxthefish - 26.07.2011

Check the player IP in the OnRconLogin callback and compare it to the IP you want to allow to login. Please don't PM me next time...


Respuesta: HELP PLEASE - RatHack - 26.07.2011

Can you show me how to make that please? an example.

And sorry for the PM.


AW: HELP PLEASE - Forbidden - 26.07.2011

In the default script ,there is a callback called OnRconLogin(playerid[ip])(i think so) but there is one problem ,if you turn you router off and on,then you cant enter the Rcon,because your IP will be changed.


Respuesta: HELP PLEASE - RatHack - 26.07.2011

I know, if i turn off modem, ill put my new IP on the gamemode where is the RconLogin so that allow me again to log into rcon.

I need an example how to make it, as linuxthefish said


Re: HELP PLEASE - Mean - 26.07.2011

pawn Код:
public OnRconLoginAttempt( ip[ ], password[ ], success ) {
    if( strcmp( ip, "youriphere", true ) ) {
        SendClientMessage( playerid, -1, "Only the owner can log into the RCON! " );
        success = 0;
    }
    return 1;
}
Untested, should work.


Respuesta: HELP PLEASE - RatHack - 26.07.2011

Mean, undefinied symbol playerid


Re: HELP PLEASE - linuxthefish - 26.07.2011

You need to loop through all the players and get there IP's, then match the IP that is trying to login with the IP you are sending the message to. I think someone made a SendMessageToIP(ip, colour, message);


Respuesta: HELP PLEASE - RatHack - 26.07.2011

Can u show me an example please?

I have this:

pawn Код:
if(success == 1) //If the password was correct
    {
        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(i, 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 in rcon.", playername);
            SendClientMessageToAll(COLOR_ORANGE, string);
        }
    }
    return 1;
}



Re: HELP PLEASE - linuxthefish - 26.07.2011

Put that loop into Mean's code, and add this:

pawn Код:
SendClientMessage( i, -1, "Only the owner can log into the RCON! " );
And remove this:
pawn Код:
format(string, sizeof(string), "* %s has logged in rcon.", playername);
SendClientMessageToAll(COLOR_ORANGE, string);