SA-MP Forums Archive
Rcon login = 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: Rcon login = ban (/showthread.php?tid=434673)



Rcon login = ban - Lucky™ - 03.05.2013

Hello SA:MP forum, I have small problem. I need to do If someone typed /rcon login [pass] in game He will get auto banned [range ban] and Also he will get auto banned even he typed the correct password.

Is it possible?

Thank you!


Re: Rcon login = ban - Jimmy0wns - 03.05.2013

Why would you also ban him when he types a correct password?


Re: Rcon login = ban - Lucky™ - 03.05.2013

Quote:
Originally Posted by Jimmy0wns
View Post
Why would you also ban him when he types a correct password?
For security reasons


Re: Rcon login = ban - vvhy - 03.05.2013

You could just disable rcon by putting
Code:
rcon 0
in the server config file


Re: Rcon login = ban - Scenario - 03.05.2013

Quote:
Originally Posted by vvhy
View Post
You could just disable rcon by putting
Code:
rcon 0
in the server config file
That doesn't disable rcon. That disables REMOTE rcon, making it so people can't remotely access the server's rcon.


Re: Rcon login = ban - vvhy - 03.05.2013

Alright, heres what you asked for:

pawn Code:
public OnRconLoginAttempt(ip[], password[], success)
{
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        GetPlayerIp(i, pip, sizeof(pip));
        if(!strcmp(ip, pip, true))
        {
            Ban(i);
        }
    }
    return 1;
}



Re: Rcon login = ban - DobbysGamertag - 03.05.2013

pawn Code:
#define RCON_NAME "changeme"

//===============

public OnRconLoginAttempt(ip[],password[],success)
{
    new Name[24],Ip[16];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerIp(i,Ip,sizeof(Ip));
            if(!strcmp(ip,Ip))
            {
                GetPlayerName(i,Name,sizeof(Name));
                if(strcmp(Name,RCON_NAME))
                {
                    SendClientMessage(i,-1,"Oops. You're banned.");
                    BanEx(i, "RCON LOGIN ATTEMPTS" );
                }
            }
        }
    }
    return 1;
}
Saves to file with "RCON login attempts next to the name / ip. define RCON Name locks it so only the defined name can acess it


Re: Rcon login = ban - Lucky™ - 03.05.2013

Quote:
Originally Posted by DobbysGamertag
View Post
pawn Code:
#define RCON_NAME "changeme"

//===============

public OnRconLoginAttempt(ip[],password[],success)
{
    new Name[24],Ip[16];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerIp(i,Ip,sizeof(Ip));
            if(!strcmp(ip,Ip))
            {
                GetPlayerName(i,Name,sizeof(Name));
                if(strcmp(Name,RCON_NAME))
                {
                    SendClientMessage(i,-1,"Oops. You're banned.");
                    BanEx(i, "RCON LOGIN ATTEMPTS" );
                }
            }
        }
    }
    return 1;
}
Saves to file with "RCON login attempts next to the name / ip. define RCON Name locks it so only the defined name can acess it
Thanks, Gonna try this out.

@Everyone - Thanks everyone