30.04.2012, 20:32
Loguei no meu server e me deparei com mais de 150 bots dentro do server lagando tudo atй o server cair, print:
alguйm sabe como me protejo disso?
alguйm sabe como me protejo disso?
if(GetPlayerPing(playerid) >= 65535) return Kick(playerid);
if(strfind(PlayerName(playerid), "niex", true) != -1) return Ban(playerid);
new Bots[MAX_PLAYER_NAME];
GetPlayerName(playerid, Bots, MAX_PLAYER_NAME);
if(!strcmp("con", Bots, true) || !strcmp("aux", Bots, true) || !strcmp("prn", Bots, true) || GetPlayerPing(playerid) >= 65535)
{
SetPlayerName(playerid, "TomaPiranha"), SendClientMessage(playerid, -1,"Mais uma Piranha banida uhul.");
Ban(playerid);
return true;
}
coloca oque o s4kul disse, depois dos code de login/registro..
|
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))
{
SpawnPlayer(playerid);
return 1;
}
{
new connecting_ip[32+1];
GetPlayerIp(playerid,connecting_ip,32);
new num_players_on_ip = GetNumberOfPlayersOnThisIP(connecting_ip);
if(num_players_on_ip > MAX_CONNECTIONS_FROM_IP) {
printf("MAXIPs: Connecting player(%d) exceeded %d IP connections from %s.", playerid, MAX_CONNECTIONS_FROM_IP, connecting_ip);
Kick(playerid);
return 1;
}
return 0;
}
#include <a_samp>
#pragma tabsize 0
#define MAX_CONNECTIONS_FROM_IP 2 // <<< define o maximo de ip que podem se conectar no servidor,й melhor deixa 2 ;)
public OnFilterScriptInit()
{
printf("\n*** Player IP limiting FS (maxips) Loaded. Max connections from 1 IP = %d\n",MAX_CONNECTIONS_FROM_IP);
}
stock GetNumberOfPlayersOnThisIP(test_ip[])
{ new against_ip[32+1];
new x = 0;
new ip_count = 0;
for(x=0; x<MAX_PLAYERS; x++) {
if(IsPlayerConnected(x)) {
GetPlayerIp(x,against_ip,32);
if(!strcmp(against_ip,test_ip)) ip_count++;
}
}
return ip_count;
}
public OnPlayerConnect(playerid)
{
new connecting_ip[32+1];
GetPlayerIp(playerid,connecting_ip,32);
new num_players_on_ip = GetNumberOfPlayersOnThisIP(connecting_ip);
if(num_players_on_ip > MAX_CONNECTIONS_FROM_IP) {
printf("MAXIPs: Connecting player(%d) exceeded %d IP connections from %s.", playerid, MAX_CONNECTIONS_FROM_IP, connecting_ip);
Kick(playerid);
return 1;
}
return 0;
}
#include <a_samp>
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Sistema ANTI-BOT]");
print("--------------------------------------\n");
return true;
}
#endif
public OnPlayerConnect(playerid)
{
new Nome2[30];
GetPlayerName(playerid, Nome2, sizeof(Nome2));
if(strfind(Nome2, "com1", true) != -1 || strfind(Nome2, "com2", true) != -1 || strfind(Nome2, "com3", true) != -1
|| strfind(Nome2, "com4", true) != -1 || strfind(Nome2, "com5", true) != -1 || strfind(Nome2, "com6", true) != -1
|| strfind(Nome2, "com7", true) != -1 || strfind(Nome2, "com8", true) != -1 || strfind(Nome2, "com9", true) != -1
|| strfind(Nome2, "lpt1", true) != -1 || strfind(Nome2, "lpt2", true) != -1 || strfind(Nome2, "lpt3", true) != -1
|| strfind(Nome2, "lpt4", true) != -1 || strfind(Nome2, "lpt5", true) != -1 || strfind(Nome2, "lpt6", true) != -1
|| strfind(Nome2, "lpt7", true) != -1 || strfind(Nome2, "lpt8", true) != -1 || strfind(Nome2, "lpt9", true) != -1
|| strfind(Nome2, "nul", true) != -1 || strfind(Nome2, "clock$", true) != -1 || strfind(Nome2, "aux", true) != -1
|| strfind(Nome2, "prn", true) != -1 || strfind(Nome2, "con", true) != -1 )
{
SendClientMessage(playerid, COLOR_RED, "|| •INFO• Nгo! Nгo! Vocк foi banido! :)");
Ban(playerid);
return true;
}
return false;
}