30.06.2015, 10:24
Quote:
sorry for double posting but it was the script problem. i fixed everything but, the mute won't work
PHP код:
|
Код:
#include <a_samp> new SpamCount[MAX_PLAYERS]; new ChatSpamTime[MAX_PLAYERS][3]; new Muted[MAX_PLAYERS]; #define AutomaticUnmuteTime 5 public OnGameModeInit( ) { print("Gamemode started."); return 1; } public OnPlayerText(playerid, text[]) { if(Muted[playerid] == 1) { SendClientMessage(playerid, 0xFF0000FF, "You're muted. So shut the fuck up."); return 0; } return 1; } public OnPlayerConnect(playerid) { SpamCount[playerid]=0; Muted[playerid]=0; return 1; } stock AntiSpam(playerid) { SpamCount[playerid]++; switch (SpamCount[playerid]) { case 1: { ChatSpamTime[playerid][0]=gettime(); } case 2: { if((gettime()-ChatSpamTime[playerid][0])<4) { SendClientMessage(playerid,0xFF0000FF,"* You have received a warning. (SPAM (1/3)"); ChatSpamTime[playerid][1]=gettime(); } else SpamCount[playerid]=0; } case 3: { if((gettime()-ChatSpamTime[playerid][1])<4) { SendClientMessage(playerid,0xFF0000FF,"* You have received a warning. (SPAM (2/3)"); ChatSpamTime[playerid][2]=gettime(); } else SpamCount[playerid]=0; } case 4..50: { new string[128],name[24]; GetPlayerName(playerid,name,24); if((gettime()-ChatSpamTime[playerid][2])<4) { format(string,sizeof(string),"%s Has been muted for spamming bullshit - 5 minutes",name); SendClientMessageToAll(0xFF0000FF,string); SendClientMessage(playerid,0xFF0000FF,"* You have received a final warning. (SPAM (3/3)"); Muted[playerid]=1; SetTimerEx("AutoUnMute",AutoUnmuteTime*60000,false,"i",playerid); Kick(playerid); } } } return 1; } forward AutoUnMute(pID); public AutoUnMute(pID) { Muted[pID] = 0; SpamCount[pID]=0; GameTextForPlayer(pID, "Unmuted", 2000,5); return 1; }