Is this will work?
#1

Код:
stock PatikrintiPrisijungimus(playerid)
{
if(GetPVarInt(playerid, "BlogasPrisijungimas") == GalimiPrisijungimai)
{
new
	ZaidejoVardas[MAX_PLAYER_NAME],
	Stringas[50]
	;
format(Stringas,sizeof(Stringas),"[AC] %s buvo uћblokuotas serveryje. Prieћastis: Bandymas prisijungti prie RCON.", ZaidejoVardas);
NusiustiZinuteVisiems(RAUDONA, Stringas);
Ban(playerid);
}
return true;
}
public OnRconLoginAttempt(ip[], password[], success)
{
	if(!success)
	{
	PlayerLoop(ID)
	{
	SetPVarInt(ID, "BlogasPrisijungimas", GetPVarInt(ID, "BlogasPrisijungimas") + 1);
	PatikrintiPrisijungimus(ID);
	}
	}
	return true;
}
Hey everybody. Im tryied to create an RCON login anticheat: If players try to connect into RCON with wrong pssw 2times, he will gets ban. And i cant test it now.
Im set BlogasPrisijungimas PVar 0 when player connect, and
Quote:

#define GalimiPrisijungimai 2

at the top of script
Reply
#2

Example from the wiki:

pawn Код:
#define RCON_ATTEMPTS 2
new RconAttempts[MAX_PLAYERS];
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
            {
                if(RconAttempts[i] >= RCON_ATTEMPTS)
                {
                     SendClientMessage(i, 0xFFFFFFFF, "Failed rcon attempt two times ( Ban ). "); //Send a message
                     Ban(i);
                }
                SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. "); //Send a message
                RconAttempts[i]++;
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)