14.03.2014, 13:31
Hey all. So I have a function which detects if the player is trying to advertise a server, but I want to make it to max 8 numbers only and remove the dots and colons, like only 7 numbers allowed in chat. Here is the function:
Thanks for helping.
pawn Код:
stock IsAnIP(const str[])
{
new i;
new colon;
new dots;
new numbers;
new len = strlen(str);
while (i < len)
{
if (str[i] == ':') colon++;
else if (str[i] == '.') dots++;
else if (str[i] >= '0' || str[i] <= '9') numbers++;
i++;
}
if (colon > 0 && dots > 2 && numbers > 4) return 1;
return 0;
}