10.10.2017, 15:46
Hey! How to check if the player sent a string next to each other?
Example: "helllllllllllllllllllllllo"
Regards
Example: "helllllllllllllllllllllllo"
Regards
IsPlayerFlooding(const string[])
{
new cnt,len = strlen(string);
for(new i,d; i < len-1; i++)
for(d = i+1; d < len; d++)
if(tolower(string[i]) == tolower(string[d]))
{
if(++cnt > 1)
return 1;
}
else
{
cnt = 0;
break;
}
return 0;
}
new FloodTC[MAX_PLAYERS]
FloodCnt[MAX_PLAYERS];
public OnPlayerText(playerid,text[]){
if(GetTickCount()-FloodTC[playerid] < 250){
FloodTC[playerid]=GetTickCount();
if(++FloodCnt[playerid]==3)Kick(playerid);
else scm(playerid,-1,"STOP FLOODING!");
return 0;
}
FloodCnt[playerid]=1;
FloodTC[playerid]=GetTickCount();
return 1;
}
if(++cnt > 1)