Filterscript won't work
#10

Quote:
Originally Posted by Glossy42O
Посмотреть сообщение
sorry for double posting but it was the script problem. i fixed everything but, the mute won't work

PHP код:
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(playeridtext[])
{
  if(
Muted[playerid] == 1)
  {
    
SendClientMessage(playerid0xFF0000FF"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;

you have problem here but i fixed it


Код:
#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;
}
Reply


Messages In This Thread
Filterscript won't work - by Glossy42O - 28.06.2015, 06:16
Re: Filterscript won't work - by Gammix - 28.06.2015, 06:37
Re: Filterscript won't work - by Glossy42O - 28.06.2015, 06:49
Re: Filterscript won't work - by Evocator - 28.06.2015, 06:53
Re: Filterscript won't work - by Glossy42O - 28.06.2015, 06:56
Re: Filterscript won't work - by !damo!spiderman - 28.06.2015, 07:00
Re: Filterscript won't work - by Glossy42O - 28.06.2015, 07:11
Re: Filterscript won't work - by Glossy42O - 28.06.2015, 08:45
Re: Filterscript won't work - by Glossy42O - 30.06.2015, 10:03
Re: Filterscript won't work - by Bomber07 - 30.06.2015, 10:24

Forum Jump:


Users browsing this thread: 1 Guest(s)