#1

I want something so that if someone types /rcon login [Anything] They're banned. I need this because almost everyone who joins my server tries to login to RCON. I don't need it used IG because I run it VIA console. Anyone know something like this? I want it to say, "GotYourAss has banned [BANNEDNAME] for attempting to login to RCON!
Reply
#2

just use

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success) //If the password was incorrect
    {
        printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
            {
                SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!"); //Send a message
                Ban(i); //They are now banned.
            }
        }
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
Reply
#3

I want also to note that you can create a reason.

like changing

pawn Код:
Ban(i);
to

pawn Код:
BanEx(i, "Rcon Login Attempt");
Reply
#4

Thank you both, will this also ban someone if they get it right?

Nevermind, tested and works doesn't ban if the password is correct, REPPED YOU BOTH!
Reply
#5

axxelac's method won't ban them if they succeeded.
Reply
#6

Well if you dont use it ingame you can also just put it out if u want
Reply
#7

I want the ban broadcasted throughout the server aswell.
Reply
#8

SendClientMessageToAll
Reply
#9

Okay.

And it works fine, here is the log.

[22:05:33] [join] Kalgon has joined the server (0:184.88.128.151)
[22:05:48] GotYourAss has banned IP 184.88.128.151 for a bad RCON login attempt using the password TROLOLOLOL
[22:05:48] [part] Kalgon has left the server (0:2)
[22:05:48] RCON (In-Game): Player #0 (Kalgon) <TROLOLOLOL> failed login.

But I changed
pawn Код:
printf("GotYourAss has banned IP %s for a bad RCON login attempt using the password %s",ip, password);
to
pawn Код:
SendClientMessageToAll("GotYourAss has banned IP %s for a bad RCON login attempt using the password %s",ip, password);
and got the error.
pawn Код:
**.pwn(20) : error 035: argument type mismatch (argument 1)

EDIT3:NVM forgot a color HEX
Reply
#10

If you don't want to ban them, you can simply disable in-game RCON (console will still stay) by putting

Код:
rcon 0
in server.cfg.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)