new Flood_ip[MAX_PLAYERS][16], Flood_time[MAX_PLAYERS];
public OnIncomingConnection(playerid, ip_address[], port)
{
if(!strcmp(ip_address, Flood_ip[playerid], true, 16))
{
if(GetTickCount() - Flood_time[playerid] < 1000)
{
BlockIpAddress(ip_address, 60 * 1000);
}
}
Flood_time[playerid] = GetTickCount();
Flood_ip[playerid] = ip_address;
return 1;
}
Flood_ip[playerid] = ip_address; to: error 047: array sizes do not match, or destination array is too small
format(Flood_ip[playerid], sizeof(Flood_ip[playerid]), "%s", ip_address);
Since technically we don't know the size of the ip_address[] array it's not possible to directly allocate it to an array which we do know the size of.
Use the format() function. pawn Код:
|
public OnIncomingConnection(playerid, ip_address[], port)
{
if(!strcmp(ip_address, Flood_ip[playerid], true, 16))
{
if(GetTickCount() - Flood_time[playerid] < 1000)
{
BlockIpAddress(ip_address, 60 * 1000);
}
}
Flood_time[playerid] = GetTickCount();
//Flood_ip[playerid] = ip_address;
format(Flood_ip[playerid], sizeof(Flood_ip[playerid]), "%s", ip_address);
return 1;
}