HELP PLEASE
#1

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?
Reply
#2

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...
Reply
#3

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

And sorry for the PM.
Reply
#4

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.
Reply
#5

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
Reply
#6

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

Mean, undefinied symbol playerid
Reply
#8

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);
Reply
#9

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;
}
Reply
#10

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)