02.02.2018, 09:53
you have no any reset for this, u're just increasing and increasing, that's a reason why u're getting this.
try this:
at the top of code
put this code at OnPlayerConnect (or if u have a login system, place at login)
now, put this code at OnPlayerText
and now, build the reset function.
place this code at OnPlayerDisconnect
try this:
at the top of code
PHP Code:
SpamMessages[MAX_PLAYERS],SpamChecker[MAX_PLAYERS];
PHP Code:
SpamChecker[playerid] = SetTimerEx("CheckSpam",1000,1,"i",playerid); // u can increase this timer.
PHP Code:
if(PlayerData[playerid][MutedTime] <= 0) SpamMessages[playerid] ++;
if(SpamMessages[playerid] >= 5)
{
PlayerData[playerid][Muted] = 1;
PlayerData[playerid][MutedTime] += 20;
new str[128]; // blah blah
mysql_format(SQL, str,128,"UPDATE `users` SET `Muted`='1' ,`MutedTime`='%d' WHERE `id` = '%d' LIMIT 1",PlayerData[playerid][MutedTime],PlayerData[playerid][ID]);
mysql_tquery(SQL, str, "", "");
SendClientMessage(playerid, COLOR_GREY, "You have been auto-muted for spamming. You will be unmuted in 20 seconds.");
return 0;
}
PHP Code:
forward CheckSpam(playerid);
public CheckSpam(playerid)
{
if(SpamMessages[playerid] >= 5 && PlayerData[playerid][MutedTime] <= 0)
{
PlayerData[playerid][Muted] = 1;
PlayerData[playerid][MutedTime] += 20;
new str[128]; // blah blah
mysql_format(SQL, str,128,"UPDATE `users` SET `Muted`='1' ,`MutedTime`='%d' WHERE `id` = '%d' LIMIT 1",PlayerData[playerid][MutedTime],PlayerData[playerid][ID]);
mysql_tquery(SQL, str, "", "");
SendClientMessage(playerid, COLOR_GREY, "You have been auto-muted for spamming. You will be unmuted in 20 seconds.");
}
else SpamMessages[playerid] = 0;
return 1;
}
PHP Code:
KillTimer(SpamChecker[playerid]);