#1

How do I set a timer so that 10 seconds after the player connects to the server the chat gets cleared? :P

Thanks!
Reply
#2

You can use a loop to clear the chat, here's an example that sends a blank message 100 times:
pawn Код:
for(new i = 0; i < 100; i++) SendClientMessage(playerid, -1, " ");
To create a timer for a certain player, use SetTimerEx.
Example, in OnPlayerConnect to initiate the timer:
pawn Код:
SetTimerEx("publicname", 10000, false, "i", playerid);
pawn Код:
forward publicname(playerid); // Forwards the public function
public publicname(playerid) return for(new i = 0; i < 100; i++) SendClientMessage(playerid, -1, " "); // Sends 100 messages when the timer ends
For more information, visit the wiki: https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#3

Set a timer to 10 seconds.

pawn Код:
public OnPlayerConnect(playerid)
{
    SetTimerEx("ClearChat", 10000, false, "i", playerid);
    return 1;
}
10000 ms = 10 seconds.
false = timer doesn't repeat.

Create public.

pawn Код:
forward ClearChat(playerid);
public ClearChat(playerid)
{
    for(new i = 0; i < 16; i++) SendClientMessage(playerid, -1, " ");
    return 1;
}
Reply
#4

Thanks Guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)