15.01.2010, 21:16
How can I do that when a player uses censored words receive mute for 3 minutes and if it continues to take 3 time player kicked
forward UnMuteEm(playerid);
new muted[MAX_PLAYERS]; // muted variable
new mutedcount[MAX_PLAYERS]; // how many mutes variables
new chatcount[MAX_PLAYERS]; // how many times chat bad words
public OnPlayerText(playerid, text[])
{
if(muted[playerid] == 1) return 0; // he cannot talk if hes muted
else if(strfind(text, "eyehole", true) > -1) // here we check if he's saying a bad word, "eyehole" should be remplaced
{
if(chatcount[playerid] > 1) // if he has 2 or more he's gonna be muted
{
if(mutecount[playerid] > 2) // if he has been muted more than twice he's going to be kicked
{
SendClientMessage(playerid, COLOR, "You have been kicked out for saying bad words!");
Kick(playerid);
}
else // if he has not, then:
{
SendClientMessage(playerid, COLOR, "You have been muted because saying bad words!");
chatcount[playerid] = 0;
muted[playerid] = 1;
SetTimerEx("UnMuteEm", 180 * 1000, false, "d", playerid);
mutecount[playerid] ++;
}
}
else // if he doesn't even have morae that one chat count then add 1 more
{
SendClientMessage(playerid, COLOR, "Don't say bad words!");
chatcount[playerid] ++;
return 0; // return 0 means the text is not gonna be showed
}
}
return 1;
}
public UnMuteEm(playerid) // to unmute him
{
muted[playerid] = 0;
SendClientMessage(playerid, COLOR, "You have been unumuted!");
return 1;
}
new Badwords[][] =
{
"Fuck",
"Shit",
"Nigger",
"Crap"
}; //Just add more using , and quote them.
new Muted[MAX_PLAYERS];
public OnPlayerText(playerid, text[])
{
for(new Z; Z<sizeof(Badwords); Z++)
{
if(strfind(text, Badwords[Z], true))
{
Muted[playerid] ++;
SetTimerEx("Unmute", 180000, false, "d", playerid);
SendClientMessage(playerid, COLOR, "You have been muted for 3 minutes for saying bad words!");
return 0;
}
}
if(Muted[playerid] == 1)
{
SendClientMessage(playerid, COLOR, "You are muted");
return 0;
}
return 1;
}
forward Unmute(playerid);
public Unmute(playerid)
{
Muted[playerid] --;
SendClientMessage(playerid, COLOR, "You have been unmuted, DON'T REPEAT IT!");
return 1;
}