RondomMSG
#1

i want send 5 messages every 10 seconds, not 1 message help

PHP код:
public OnFilterScriptInit()
{
    
RandMsg 0;
        
SetTimer("GlobalAnnouncement" ,10000,true); // Change the time if you want to. But remember, 1000 = 1 sec
    
return 1;
}
forward GlobalAnnouncement();
public 
GlobalAnnouncement()
{
    switch (
RandMsg)
    {
    case 
0: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[0]); RandMsg++;}
    case 
1: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[1]); RandMsg++;}
        case 
2: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[2]); RandMsg++;}
        case 
3: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[3]); RandMsg++;}
        case 
4: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[4]); RandMsg++;}
        case 
5: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[5]); RandMsg++;}
        case 
6: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[6]); RandMsg++;}
        case 
7: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[7]); RandMsg++;}
        case 
8: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[8]); RandMsg++;}
        case 
9: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[9]); RandMsg++;}
        case 
10: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[10]); RandMsg++;}
        case 
11: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[11]); RandMsg++;}
        case 
12: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[12]); RandMsg++;}
        case 
13: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[13]); RandMsg++;}
        case 
14: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[14]); RandMsg++;}
        case 
15: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[15]); RandMsg++;}
        case 
16: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[16]); RandMsg++;}
        case 
17: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[17]); RandMsg++;}
        case 
18: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[18]); RandMsg++;}
        case 
19: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[19]); RandMsg++;}
        case 
20: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[20]); RandMsg++;}
        case 
21: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[21]); RandMsg++;}
        case 
22: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[22]); RandMsg++;}
        case 
23: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[23]); RandMsg++;}
        case 
24: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[24]); RandMsg++;}
        case 
25: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[25]); RandMsg++;}
        case 
26: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[26]); RandMsg++;}
        case 
27: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[27]); RandMsg++;}
        case 
28: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[28]); RandMsg++;}
        case 
29: {SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[29]); RandMsg++;}
        case 
30: {SendClientMessageToAll(ADMIN_RED,ANNOUNCEMENTS[10]); RandMsg 1;} // -- and This will be the last message
    
}
    return 
1;

Reply
#2

pawn Код:
public OnFilterScriptInit()
{
   RandMsg = 0;
   SetTimer("GlobalAnnouncement" ,10000,true); // Change the time if you want to. But remember, 1000 = 1 sec
   return 1;
}

forward GlobalAnnouncement();
public GlobalAnnouncement()
{
   switch (RandMsg)
   {
      case 0:
      {
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[0]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[1]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[2]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[3]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[4]);
         RandMsg++;
      }
      case 1:
      {
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[5]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[6]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[7]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[8]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[9]);
         RandMsg++;
      }
      case 2:
      {
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[10]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[11]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[12]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[13]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[14]);
         RandMsg++;
      }
      case 3:
      {
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[15]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[16]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[17]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[18]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[19]);
         RandMsg++;
      }
      case 4:
      {
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[20]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[21]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[22]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[33]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[24]);
         RandMsg++;
      }
      case 5:
      {
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[25]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[26]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[27]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[28]);
         SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[29]);
         RandMsg++;
      }
      case 6:
      {
         SendClientMessageToAll(ADMIN_RED,ANNOUNCEMENTS[10]);
         RandMsg = 1;
      }
   }
   return 1;
}
Reply
#3

or try this

Код:
public OnFilterScriptInit() 
{ 

    RandMsg = 0; 
    SetTimer("GlobalAnnouncement" ,10000,true); // Change the time if you want to. But remember, 1000 = 1 sec 
    return 1; 
} 

forward GlobalAnnouncement(); 
public GlobalAnnouncement() 
{ 
	for(new i=0; i<5; i++)
	{
		if(RandMsg >= 30) { RandMsg = 1; }
		SendClientMessageToAll(COL_WHITE,ANNOUNCEMENTS[RandMsg]); 
		RandMsg++;
	}
	return 1; 
}
Reply
#4

thanks guys +1, +1
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)