15.12.2010, 15:02
How do I block the use of more than 4 numbers per sentence??
stock IsNumber(c[])
{
new bool:match;
switch(c[0]) {
case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': match = true;
default: match = false;
}
return match;
}
public OnPlayerText(playerid, text[])
{
new count;
for(new i=0; i<strlen(text); i++) {
if(IsNumber(text[i])) {
count++;
}
}
if(count > 4) {
SendClientMessage(playerid, -1, "No more than 4 numbers allowed");
return 0;
}
return 1;
}