remaining time is not working
#1

i want to make a remaining time system but it doesn't working....the game text appear but the remaining time just minus 1 and i doesn't drop at all..like stuck in 899 seconds

check in case 4
Код:
stock AntiSpam(playerid)//stock function
{
	SpamCount[playerid]++;//Everytime a player types smth. in the chat this variable gets increased by one.
	switch (SpamCount[playerid])//switch between the SpamCount variable.
	{
		case 1://If a player types smth. into the chat for the first time...
		{
			ChatSpamTime[playerid][0]=gettime();//Get the unix timestamp and save it into a variable.
			//ChatSpamTime[playerid][0] this variable is our first variable. The array is "0" for the first one not "1"!
		}
		case 2://If the player types smth. into the chat the second time...
		{
			if((gettime()-ChatSpamTime[playerid][0])<2)//We check if the Time between the players first and
			{
				//second chat is more or less than 4 seconds. In case the player chatted faster than 4 seconds
				//We will give him his first warning ...
				SendClientMessage(playerid,0xFFFFFF,"{FFFFFF}[Anti-Spam]You Have Received A Warning (1/3), {FF0000}Reason: Spam");
				ChatSpamTime[playerid][1]=gettime();//and we save his chat time again to another variable.

				//Lets take a closer look at this: gettime()-ChatSpamTime[playerid][0].
				//We use gettime() to get the current unix timestamp and we simply subtract the time we
				//saved before (as the player chatted the first time). Always make sure to subtract the older
				//timestamp from the newer one as the newer timestamp is always bigger!
			}
			else SpamCount[playerid]=0;//If the player needed longer than 4 seconds to send another
			//chat message we reset his SpamCount variable bac to 0. (as he is obviously not spamming or a very slow spammer ;) )
		}
		case 3://If the player types smth. into the chat the third time...
		{
			if((gettime()-ChatSpamTime[playerid][1])<2)//We check how long it took the player to send another message after the 2nd one.
			{
				//If the player send another message faster than 4 seconds he is obviously spamming and we give
				//him a 2nd warning as we dont want to be that cruel to spammers right? ;)
				SendClientMessage(playerid,0xFFFFFF,"{FFFFFF}[Anti-Spam]You Have Received A Warning (2/3), {FF0000}Reason: Spam");
				ChatSpamTime[playerid][2]=gettime();//Again save his chat time for this message to another variable.
			}
			else SpamCount[playerid]=0;//In case the player calmed down, reset his SpamCount variable.
		}
		case 4..50://In case the certain player gets the idea to spam again...
		{
			new string[256], name[24], mute[256], second;
			GetPlayerName(playerid,name,24);//Save the spammers name into the string variable "name".
			if((gettime()-ChatSpamTime[playerid][2])<2)//We get sure again if it took the player less than 4 secs.
			{
			    second = 900;
				SendClientMessage(playerid, 0xFFFFFF,"{FF0000}[Anti-Spam]{FFFFFF}You Have Received A Warning (3/3), {FF0000}Reason: Spam");
				muted[playerid]=1;//we mute himnm
			 	SetTimerEx("AutoUnMute",AutoUnmuteTime*60000,false,"i",playerid);
			 	format(string,sizeof(string),"{00FFFF}{FF0000}[Anti-Spam]{FFFF66}Player %s Has Been Muted , {FF0000}Reason: Spam",name);
				SendClientMessageToAll(0xFFFFFF,string);
				if(second > 1)
				{
				second--;
				}
				format( mute, sizeof(mute), "You Have Been Muted\nRemaining Time : ~r~%i Seconds", second);
				GameTextForPlayer(playerid, mute, 900000, 3);
		    }
	    }
    }
    return 1;
}
i hope you can find solution for me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)