[FilterScript] M'RCON2 System (Simple y sencillo)
#5

Quote:
Originally Posted by MatrixenXD
Посмотреть сообщение
Aquн

~Saludos.
Como esta el sistema no va ha funcionar correctamente. En "!success", no estas validando IP's. Y hay que usar "break" cuando es necesario.

Mira aquн y veras porque:

Versiуn con un jugador con la misma IP:
pawn Код:
// [ DEVELOPMENT GAMEMODE ]

// INCLUDES:

#include <a_samp>
#include <foreach>

// MAIN:

main()
{
    print("Development Mode: rcon_protection.amx");
}

// CALLBACKS:

public OnGameModeInit()
{  
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    new playerid = -1;
    foreach(new i: Player)
    {
        if(strcmp(ip, GetPlayerIP(i), true) == 0)
        {
            playerid = i;
            break;
        }
    }

    if(playerid != -1)
    {
        if(success)
        {
            if(IsPlayerAdmin(playerid)) // Change this for your admin system's condition that validates a player's admin level possession.
            {
                printf("[RCON] %s (%d) has logged-in.", PlayerName(playerid), playerid);
            }
            else
            {
                printf("[RCON] %s (%d) was kicked from the server (Bad RCON Login).", PlayerName(playerid), playerid);
                Kick(playerid);
            }
        }
    }
    return 1;
}

// FUNCTIONS:

stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}

stock GetPlayerIP(playerid)
{
    new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));
    return ip;
}
Versiуn para 3 jugadores con la misma IP:
pawn Код:
// [ DEVELOPMENT GAMEMODE ]

// INCLUDES:

#include <a_samp>
#include <foreach>

// MAIN:

main()
{
    print("Development Mode: rcon_protection_multiple.amx");
}

// CALLBACKS:

public OnGameModeInit()
{  
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    new playerid[3] = -1, count;
    foreach(new i: Player)
    {
        if(strcmp(ip, GetPlayerIP(i), true) == 0)
        {
            playerid[count] = i;
            count ++;

            if(count == 3) break;
        }
    }

    for(new i = 0; i < 3; i ++)
    {
        if(playerid[i] != -1)
        {
            if(success)
            {
                if(IsPlayerAdmin(playerid[i])) // Change this for your admin system's condition that validates a player's admin level possession.
                {
                    printf("[RCON] %s (%d) has logged-in.", PlayerName(playerid[i]), playerid[i]);
                }
                else
                {
                    printf("[RCON] %s (%d) was kicked from the server (Bad RCON Login).", PlayerName(playerid[i]), playerid[i]);
                    Kick(playerid[i]);
                }
            }
        }
    }
    return 1;
}

// FUNCTIONS:

stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}

stock GetPlayerIP(playerid)
{
    new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));
    return ip;
}
Reply


Messages In This Thread
M'RCON2 System (Simple y sencillo) - by MatrixenXD - 26.07.2015, 08:49
Re: M'RCON2 System (Simple y sencillo) - by SickAttack - 26.07.2015, 15:39
Respuesta: M'RCON2 System (Simple y sencillo) - by Johansitho - 26.07.2015, 17:40
Respuesta: Re: M'RCON2 System (Simple y sencillo) - by MatrixenXD - 26.07.2015, 20:23
Re: Respuesta: Re: M'RCON2 System (Simple y sencillo) - by SickAttack - 26.07.2015, 22:15
Respuesta: M'RCON2 System (Simple y sencillo) - by MatrixenXD - 27.07.2015, 02:26
Re: M'RCON2 System (Simple y sencillo) - by elpana27 - 21.07.2016, 09:00
Re: M'RCON2 System (Simple y sencillo) - by Right - 22.07.2016, 04:53

Forum Jump:


Users browsing this thread: 1 Guest(s)