26.07.2015, 22:15
Quote:
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;
}
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;
}