13.07.2010, 08:26
Так не проще?
PHP Code:
#include <a_samp>
#define RTIME 5
new LastIP[MAX_PLAYERS][20],LastTime[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
new str_ip[20];
GetPlayerIp( playerid, str_ip, 20 );
for(new i,s = gettime();i<sizeof(LastIP),i++)
{
if(!strlen(LastIP[i]))break;
if(strcmp(str_ip,LastIP[i],false) == 0)
{
if(s-LastTime[i] < RTIME)return Kick(playerid);
else
{
LastIP[i] = "";
LastTime[i] = 0;
break;
}
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
for(new i,s = gettime();i<sizeof(LastIP),i++)
{
if(s-LastTime[i] > RTIME)
{
LastIP[i] = "";
LastTime[i] = 0;
}
if(strlen(LastIP[i]))continue;
GetPlayerIp(playerid, LastIP[i], 20 );
LastTime[i] = gettime();
break;
}
return 1;
}