Rcon login = ban
#1

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

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

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

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

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

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)