Delay between sendclientmessage
#1

Hello,

I've got a command to check the version with updates, It's like this:

Код:
if (strcmp("/version", cmdtext, true, 10) == 0)
{
 	SendClientMessage(playerid, 0xBE1600FF,"Version 0.001a");
(delay here)
 	SendClientMessage(playerid, 0xFF8000FF,"Updates:");
 	SendClientMessage(playerid, 0xFF8000FF,"Added Register/Login Dialog system with MySQL");
	return 1;
}
Now I want a delay between the first SendClientMessage and the 2nd.

Can someone please help me?
Reply
#2

You need to use timer.
Reply
#3

pawn Код:
//In OnPlayerCommandText
if (strcmp("/version", cmdtext, true, 10) == 0)
{
    SendClientMessage(playerid, 0xBE1600FF,"Version 0.001a");
    SetTimerEx("DelayedMsg", 3000, false, "d", playerid);
    return 1;
}

//At the end of your script. NOT inside any function.
forward DelayedMsg(playerid);
public DelayedMsg(playerid)
{
    SendClientMessage(playerid, 0xFF8000FF,"Updates:");
    SendClientMessage(playerid, 0xFF8000FF,"Added Register/Login Dialog system with MySQL");
    return true;
}
Untested.

And you can learn to use Timers from SAMP Wiki: SetTimerEx
Reply
#4

Is this the only possible way?
Reply
#5

Quote:
Originally Posted by svorpyx
Посмотреть сообщение
Is this the only possible way?
Yez.
Reply
#6

There's y_timer to make it easier.

EDIT: Gone
Reply
#7

varthshenon... you should remove it..

less people getting it, less complaints on this board saying that there server froze..

there are times when it can actually freeze your server forever, instead of freezing it for the time you set..
Reply
#8

Okay, just use y_timer.
https://sampforum.blast.hk/showthread.php?tid=182948
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)