Raised This Month: $ Target: $400
 0% 

[HELP] switch statement


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avril-lavigne
Banned
Join Date: Apr 2009
Old 12-09-2011 , 13:55   [HELP] switch statement
Reply With Quote #1

please , how to use switch from 1 to 7 like 1,2,3,4,5,6,7
I know it should .. by default... but whan I use switch(1,7) or (1-7)
it doesnt work. most time it uses last number and repeat it *(7)

here I need to start each case from 1 to 7 every 12 secs

case 1 = 12 sec, than case 2 after next 12 sec
so when I use random_num it works like random..... but I need 1,2,3,4,5,6,7 in a row

PHP Code:
set_task(12.0,"start_task",_,_,_,"b")
       
}
public 
start_task() {  
              
         switch(
random_num(1,7))  
       {                                                       
           case 
1server_cmd("sq_server ^"123123123123^""
           case 
2server_cmd("sq_server ^"123123123123^"")  
           case 
3:server_cmd("sq_server ^"123123123123^"")                             
           case 
4:server_cmd("sq_server ^"123123123123^"")   
           case 
5:server_cmd("sq_server ^"123123123123^""
           case 
6:server_cmd("sq_server ^"123123123123^""
           case 
7:server_cmd("sq_server ^"123123123123^"")
      }      
    

__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 12-09-2011 at 13:57.
avril-lavigne is offline
Kidev
Veteran Member
Join Date: Jun 2010
Location: France
Old 12-09-2011 , 14:11   Re: [HELP] switch statement
Reply With Quote #2

Use a static variable and increment it each times the function is called. And if the variables is equal to 7, then put it to 0, and etc...
__________________
Kidev is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 12-09-2011 , 14:14   Re: [HELP] switch statement
Reply With Quote #3

new "a" = what?

set "a" to 2 in case 1 and set it to 3 in case2??
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 12-09-2011 at 14:17.
avril-lavigne is offline
Kidev
Veteran Member
Join Date: Jun 2010
Location: France
Old 12-09-2011 , 14:32   Re: [HELP] switch statement
Reply With Quote #4

PHP Code:
set_task12.0"repeatItBaby"___"b" );

public 
repeatItBaby( )
{
    static 
myVar;
    
myVar = ( myVar >= myVar );
    switch ( 
myVar )
    {
        case 
1:
        case 
2:
        
/* .. */
    
}

__________________

Last edited by Kidev; 12-10-2011 at 01:48.
Kidev is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 12-09-2011 , 16:05   Re: [HELP] switch statement
Reply With Quote #5

cant compile ,,, and need more .. after 7 --- start from 1 again
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 12-09-2011 at 16:09.
avril-lavigne is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 12-09-2011 , 16:30   Re: [HELP] switch statement
Reply With Quote #6

PHP Code:
case .. 7server_cmd("sq_server ^"123123123123^""
Edit
Sorry read first line and posted, read the next, now I'm not sure this will help anyway

Last edited by Erox902; 12-09-2011 at 16:32.
Erox902 is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 12-09-2011 , 16:30   Re: [HELP] switch statement
Reply With Quote #7

thanks I solved it . in another way ...
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode