How to set a timer to sendclientmessage
#1

PHP код:
SendClientMessage(playerid, -1"{FFCC33} Tex1. ");
    
SendClientMessage(playerid, -1"Text2 !");
    
SendClientMessage(playerid, -1"Text3.");
    
SendClientMessage(playerid, -1"Text4l.");
    
SendClientMessage(playerid, -1"Text5. "); 
I want each text to appear after 1 second, how can I do that?
It's a conversation between 2 npcs and I don't want to create spam, that's why i put 1 second pause between sendclientmessage
Reply
#2

Try this
Код:
new msg = -1;
forward Message();
public Message()
{

       msg += 1;
       switch(msg)
       {
             case 0: SendClientMessageToAll(-1, "{FFCC33} Tex1. ");
             case 1: SendClientMessageToAll(-1, "{FFCC33} Tex2. ");
             case 2: SendClientMessageToAll( -1, "{FFCC33} Tex3. ");
             case 3: SendClientMessageToAll( -1, "{FFCC33} Tex4. ");
             case 4: SendClientMessageToAll( -1, "{FFCC33} Tex5. ");
       }
}
And use this where you want to start the timer
Код:
SetTimer("Message",1000,true);
Or if you want to send message to 1 player use this
Код:
new msg = -1;
forward Message(playerid);
public Message(playerid)
{

       msg += 1;
       switch(msg)
       {
             case 0: SendClientMessage(playerid, -1, "{FFCC33} Tex1. ");
             case 1: SendClientMessage(playerid, -1, "{FFCC33} Tex2. ");
             case 2: SendClientMessage(playerid, -1, "{FFCC33} Tex3. ");
             case 3: SendClientMessage(playerid, -1, "{FFCC33} Tex4. ");
             case 4: SendClientMessage(playerid, -1, "{FFCC33} Tex5. ");
       }
}
and this to start the timer
Код:
SetTimerEx("Message", 1000, 1, "d", playerid);
Reply
#3

Quote:
Originally Posted by scripter112
Посмотреть сообщение
Try this
Код:
new msg = -1;
forward Message();
public Message()
{

       msg += 1;
       switch(msg)
       {
             case 0: SendClientMessageToAll(-1, "{FFCC33} Tex1. ");
             case 1: SendClientMessageToAll(-1, "{FFCC33} Tex2. ");
             case 2: SendClientMessageToAll( -1, "{FFCC33} Tex3. ");
             case 3: SendClientMessageToAll( -1, "{FFCC33} Tex4. ");
             case 4: SendClientMessageToAll( -1, "{FFCC33} Tex5. ");
       }
}
And use this where you want to start the timer
Код:
SetTimer("Message",1000,true);
Or if you want to send message to 1 player use this
Код:
new msg = -1;
forward Message(playerid);
public Message(playerid)
{

       msg += 1;
       switch(msg)
       {
             case 0: SendClientMessage(playerid, -1, "{FFCC33} Tex1. ");
             case 1: SendClientMessage(playerid, -1, "{FFCC33} Tex2. ");
             case 2: SendClientMessage(playerid, -1, "{FFCC33} Tex3. ");
             case 3: SendClientMessage(playerid, -1, "{FFCC33} Tex4. ");
             case 4: SendClientMessage(playerid, -1, "{FFCC33} Tex5. ");
       }
}
and thi to start the timer
Код:
SetTimerEx("Message", 1000, 1, "d", playerid);
PHP код:
CMD:startm(playeridparams[])
{
if(
Militar[playerid] == 1)
    {
    
MilitarJob[playerid] = 1;
    
SetPlayerCheckpoint(playerid,111.2472,1029.2219,13.6094,2.0);
    
SendClientMessage(playerid, -1"{FFCC33} tex1 ");
    
SendClientMessage(playerid, -1"Gtext2 !");
    
SendClientMessage(playerid, -1"text3.");
    
SendClientMessage(playerid, -1"Gtext4");
    
SendClientMessage(playerid, -1"{FFCC33} text5. ");
    
CP[playerid] = 0;
    } 
if so, how should I modify the script?
Reply
#4

PHP код:
CMD:startm(playeridparams[])
{
    if(
Militar[playerid] == 1)
    {
    
MilitarJob[playerid] = 1;
    
SetPlayerCheckpoint(playerid,111.2472,1029.2219,13.6094,2.0);
    
SetTimerEx("Message"10001"d"playerid);
    
CP[playerid] = 0;
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by scripter112
Посмотреть сообщение
Try this
Код:
new msg = -1;
forward Message();
public Message()
{

       msg += 1;
       switch(msg)
       {
             case 0: SendClientMessageToAll(-1, "{FFCC33} Tex1. ");
             case 1: SendClientMessageToAll(-1, "{FFCC33} Tex2. ");
             case 2: SendClientMessageToAll( -1, "{FFCC33} Tex3. ");
             case 3: SendClientMessageToAll( -1, "{FFCC33} Tex4. ");
             case 4: SendClientMessageToAll( -1, "{FFCC33} Tex5. ");
       }
}
And use this where you want to start the timer
Код:
SetTimer("Message",1000,true);
Or if you want to send message to 1 player use this
Код:
new msg = -1;
forward Message(playerid);
public Message(playerid)
{

       msg += 1;
       switch(msg)
       {
             case 0: SendClientMessage(playerid, -1, "{FFCC33} Tex1. ");
             case 1: SendClientMessage(playerid, -1, "{FFCC33} Tex2. ");
             case 2: SendClientMessage(playerid, -1, "{FFCC33} Tex3. ");
             case 3: SendClientMessage(playerid, -1, "{FFCC33} Tex4. ");
             case 4: SendClientMessage(playerid, -1, "{FFCC33} Tex5. ");
       }
}
and this to start the timer
Код:
SetTimerEx("Message", 1000, 1, "d", playerid);
You were along the right lines but if I'm not mistaken, your method wont work.

Try this as a substitute.

Код:
 
forward Message(playerid, msg);
public Message(playerid, msg)
{
       msg++;
       switch(msg)
       {
             case 0: SendClientMessage(playerid, -1, "{FFCC33} Tex1. ");
             case 1: SendClientMessage(playerid, -1, "{FFCC33} Tex2. ");
             case 2: SendClientMessage(playerid, -1, "{FFCC33} Tex3. ");
             case 3: SendClientMessage(playerid, -1, "{FFCC33} Tex4. ");
             case 4: SendClientMessage(playerid, -1, "{FFCC33} Tex5. ");
      }
      if(msg < 4)
      {
      	SetTimerEx("Message", 1000, 1, "id", playerid, msg);
      }
}

CMD:startm(playerid, params[])
{
	if(Militar[playerid] == 1)
       {
	    MilitarJob[playerid] = 1;
	    SetPlayerCheckpoint(playerid,111.2472,1029.2219,13.6094,2.0);
      	    SetTimerEx("Message", 1000, 1, "id", playerid, -1);
	    CP[playerid] = 0;
       }  
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)