Timer for clearing chat
#1

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;
}
Reply
#2

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...
Reply
#3

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, " ");
     }
}
Reply
#4

Thanks it works perfectly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)