attacking my server - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: attacking my server (
/showthread.php?tid=567417)
attacking my server -
s3ek - 13.03.2015
hacker attacking my server !! help me
Re: attacking my server -
JaydenJason - 13.03.2015
(range)ban him?
Re: attacking my server -
FernandoLight - 13.03.2015
Give me your server IP and I will take care.
Re: attacking my server -
Diogo123 - 13.03.2015
pawn Код:
// maxips FS limits the number of players connecting from a
// single IP address.
#include <a_samp>
#include <string>
#define MAX_STRING 255
#define MAX_CONNECTIONS_FROM_IP 2
#define RED 0xE60000FF
//---------------------------------------------
public OnFilterScriptInit()
{
printf("\n*** Maximum connections with 1 ip = %d\n",MAX_CONNECTIONS_FROM_IP);
}
//---------------------------------------------
// GetNumberOfPlayersOnThisIP
// Returns the number of players connecting from the
// provided IP address
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("Player(%d) Exceeded the number of facilitates %d With the ip of %s.", playerid, MAX_CONNECTIONS_FROM_IP, connecting_ip);
SendClientMessage(playerid, RED, "[INFO]Tried using BOT for me overthrow? Took ban!!");
Ban(playerid);
return 1;
}
return 0;
}
//---------------------------------------------
Re: attacking my server -
s3ek - 13.03.2015
+1 Diogo123
Re: attacking my server -
Evocator - 13.03.2015
The above code is extremely bad, if you have three people who are in a cafe net and connected to your server for example (they would logically have the same IP) and then get banned unfairly.
Use RyDeR's flood protection script. Its much more efficient and safe to use.
https://sampforum.blast.hk/showthread.php?tid=320649