SA-MP Forums Archive
Ban! - 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)
+--- Thread: Ban! (/showthread.php?tid=361092)



Ban! - [MM]18240[FMB] - 20.07.2012

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!


Re: Ban! - Chris1337 - 20.07.2012

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


Re: Ban! - L.Hudson - 20.07.2012

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

like changing

pawn Код:
Ban(i);
to

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



Re: Ban! - [MM]18240[FMB] - 20.07.2012

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!


Re: Ban! - [KHK]Khalid - 20.07.2012

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


Re: Ban! - jeremy8810 - 20.07.2012

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


Re: Ban! - [MM]18240[FMB] - 20.07.2012

I want the ban broadcasted throughout the server aswell.


Re: Ban! - newbienoob - 20.07.2012

SendClientMessageToAll


Re: Ban! - [MM]18240[FMB] - 20.07.2012

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


Re: Ban! - SuperViper - 20.07.2012

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.