SA-MP Forums Archive
Timer for clearing chat - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timer for clearing chat (/showthread.php?tid=223549)



Timer for clearing chat - patfay - 09.02.2011

Okay, Well I have a clearchat command. And I wanted it to say "The chat will be cleared in 5 seconds" if an admin types /clearchat and five seconds later it will spam empty lines

Код:
command(clearchat, playerid, params[])
{
	#pragma unused params
	if(Player[playerid][AdminLevel] >= 4)
	{
	SendClientMessageToAll(LIGHTRED, "The chat will be cleared in 5 seconds");

	    for(new i = 0; i < 200; i++)
	    {
	        SendClientMessageToAll(GREY, "                    ");
	    }
	}

	return 1;
}



Re: Timer for clearing chat - xRyder - 09.02.2011

Use this function -> https://sampwiki.blast.hk/wiki/SetTimer

But one more thingy why do you use so big number in your loop. (200)
It's enough if you use 30-40...


Re: Timer for clearing chat - Ash. - 09.02.2011

pawn Код:
forward CCT();
command(clearchat, playerid, params[])
{
    #pragma unused params
    if(Player[playerid][AdminLevel] >= 4)
    {
         SendClientMessageToAll(LIGHTRED, "The chat will be cleared in 5 seconds");
             SetTimer("CCT", 5000, false);
    }

    return 1;


public CCT()
{
     for(new i = 0; i < 200; i++)
     {
          SendClientMessageToAll(GREY, " ");
     }
}



Re: Timer for clearing chat - patfay - 09.02.2011

Thanks it works perfectly