08.12.2013, 23:27
como puedo hacer para que solo puedan entrar 1 user al servidor por cada ip? necesito ayuda me lanzan queryflood y udpflood y no se como arreglarlo necesito ayuda
#define MAX_IPS (2)
new IP[MAX_PLAYERS][16];
public OnPlayerConnect(playerid)
{
MaxIP(playerid);
return 1;
}
stock MaxIP(playerid)
{
new contador;
GetPlayerIp(playerid, IP[playerid], 16);
for(new user; user<GetMaxPlayers(); user++)
{
if(IsPlayerConnected(user))
{
if(!strcmp(IP[playerid], IP[user]))
{
contador++;
}
}
if(contador>=MAX_IPS)
{
Kick(playerid);
}
}
return 1;
}
pawn Код:
|
native gpci ( playerid, serial [ ], maxlen );
#include <a_samp>
static SERIAL[MAX_PLAYERS][25];
public OnPlayerConnect(playerid){
MaxUser(playerid);
return true;
}
stock MaxUser(playerid){
gpci(playerid,SERIAL[playerid],24);
for(new player, user = GetMaxPlayers(); player != user; player++){
if(IsPlayerConnected(player) && (player!=playerid)){
if(!strcmp(SERIAL[playerid], SERIAL[player], true, 24)){Kick(playerid);} }
} return true;
}