SA-MP Forums Archive
mute for time - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: mute for time (/showthread.php?tid=500764)



mute for time - AhmedMohamed - 15.03.2014

how to make if some one spam 10 messages mute him for 10 seconds? (( i need the time function only ))


Re: mute for time - DarkLored - 15.03.2014

Use Variables and use the callback named OnPlayerText
atleast try to make it first and then ask for help cause i doubt anyone will script it for you


Re: mute for time - AhmedMohamed - 15.03.2014

I made it already
Код:
if(ServerInfo[AntiSpam] == 1 && (PlayerInfo[playerid][Level] == 0 && !IsPlayerAdmin(playerid)) )
	{
		if(PlayerInfo[playerid][SpamCount] == 0) PlayerInfo[playerid][SpamTime] = TimeStamp();

	    PlayerInfo[playerid][SpamCount]++;
		if(TimeStamp() - PlayerInfo[playerid][SpamTime] > SPAM_TIMELIMIT) { 
			PlayerInfo[playerid][SpamCount] = 0;
			PlayerInfo[playerid][SpamTime] = TimeStamp();
		}
		else if(PlayerInfo[playerid][SpamCount] == SPAM_MAX_MSGS) {
			new string[64]; format(string,sizeof(string),"Server has Muted %s (Flood/Spam Protection)", PlayerName2(playerid));
			SendClientMessageToAll(red,string); print(string);
			PlayerInfo[playerid][Muted] = 1;
			return 0;
		}
	}
but it mute the member permanently not for 10 seconds.


Re: mute for time - DarkLored - 15.03.2014

You need to use a timer which will unmute the player you never unmuted him in the first place
but if you are just gonna copy paste it wait a minute and try to learn from what i just posted so it will be easier in future issues so you will kinda understand it


here is a quick exsample
pawn Код:
new AutoUnmute[MAX_PLAYERS];
pawn Код:
forward PlayerOneSecondVariables();
pawn Код:
public OnGameModeInit()
{
     SetTimer("PlayerOneSecondVariables", 1000, true);
     return 1;
}
pawn Код:
public PlayerOneSecondVariables()
{
   for(new i=0; i<MAX_PLAYERS; i++)
   {
        if(AutoUnmute[i] > 1)
        {
            AutoUnmute[i] --;
        }
        if(AutoUnmute[i] == 1)
        {
            SendClientMessage(i,-1,"You have been auto unmuted");
            PlayerInfo[i][Muted] = 0;
        }
    }
    return 1;
}

pawn Код:
if(ServerInfo[AntiSpam] == 1 && (PlayerInfo[playerid][Level] == 0 && !IsPlayerAdmin(playerid)) )
    {
        if(PlayerInfo[playerid][SpamCount] == 0) PlayerInfo[playerid][SpamTime] = TimeStamp();

        PlayerInfo[playerid][SpamCount]++;
        if(TimeStamp() - PlayerInfo[playerid][SpamTime] > SPAM_TIMELIMIT) {
            PlayerInfo[playerid][SpamCount] = 0;
            PlayerInfo[playerid][SpamTime] = TimeStamp();
        }
        else if(PlayerInfo[playerid][SpamCount] == SPAM_MAX_MSGS) {
            new string[64]; format(string,sizeof(string),"Server has Muted %s (Flood/Spam Protection)", PlayerName2(playerid));
            SendClientMessageToAll(red,string); print(string);
            PlayerInfo[playerid][Muted] = 1;
                        AutoUnmute[playerid] = 10;
            return 0;
        }
    }



Re: mute for time - AhmedMohamed - 15.03.2014

thanks alot Rep+