0 Members and 1 Guest are viewing this topic.
constSTART_VALUE = 25; //start value for spam meterEND_VALUE = 100; //value at which player gets mutedPERCENT_INCREASE = 30; //percent to increase per chat messagePERCENT_DECREASE = 5; //percent to decrease every secondMUTE_TIME = 30; //time in seconds to mute spammerUNMUTE_ON_LEAVE = true; //unmute player wen they leave the game?varSpamMeter: Array [1..32] of single;MuteTime: Array [1..32] of integer;i: integer;procedure AppOnIdle(Ticks: integer);beginfor i:=1 to 32 do begin if (SpamMeter[i] = -1) then begin if MuteTime[i] > 0 then MuteTime[i] := MuteTime[i] - 1 else begin Command('/ungmute ' + inttostr(i)); SayToPlayer(i,'You have been unmuted'); SpamMeter[i] := 0; end; end; if SpamMeter[i] > END_VALUE then begin Command('/gmute ' + inttostr(i)); SayToPlayer(i,'You have been muted for ' + inttostr(MUTE_TIME) + ' seconds for spamming'); SpamMeter[i] := -1; MuteTime[i] := MUTE_TIME; end; if SpamMeter[i] > START_VALUE then begin SpamMeter[i] := SpamMeter[i] * (1.0 - PERCENT_DECREASE / 100.0); if SpamMeter[i] < START_VALUE then SpamMeter[i] := START_VALUE; end; end;end;procedure OnJoinGame(ID, Team: byte);beginSpamMeter[ID] := 0;MuteTime[ID] := 0;end;procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);beginif (SpamMeter[ID] = -1) and (UNMUTE_ON_LEAVE = true) then Command('/ungmute ' + inttostr(ID));SpamMeter[ID] := 0;MuteTime[ID] := 0;end;procedure OnPlayerSpeak(ID: byte; Text: string);beginif SpamMeter[ID] <> -1 then begin if SpamMeter[ID] >= START_VALUE then SpamMeter[ID] := SpamMeter[ID] * (1.0 + PERCENT_INCREASE / 100.0) else SpamMeter[ID] := START_VALUE; if (SpamMeter[ID] < 100) and (SpamMeter[ID] * (1.0 + PERCENT_INCREASE / 100.0) > END_VALUE) then SayToPlayer(ID,'WARNING: Do not spam');end;end;
If somebody leaves and rejoins, wouldn't this reset their gmute?