AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [check] is this code correct/ pls check (https://forums.alliedmods.net/showthread.php?t=171939)

avril-lavigne 11-12-2011 18:44

[check] is this code correct/ pls check
 
PHP Code:

new day[2]; 
        
get_time("%w"day1)
        if(
equal(day"1"))
     {
        
set_task(5.0,"start_scan",_,_,_,"b")
     }
        else if(
equal(day"2"))
     {
        
set_task(5.0,"start_scan1",_,_,_,"b")
     }

        else if(
equal(day"3"))
     {
        
set_task(5.0,"start_scan",_,_,_,"b")
     }
        else if(
equal(day"4"))
     {
        
set_task(5.0,"start_scan1",_,_,_,"b")
     }

        else if(
equal(day"5"))
     {
         
set_task(5.0,"start_scan",_,_,_,"b")
     }
         else if(
equal(day"6"))
     {
         
set_task(5.0,"start_scan1",_,_,_,"b")
     }
         else if(
equal(day"0"))
     {
         
set_task(5.0,"start_scan",_,_,_,"b")
     }



is it correct ? to set task on monday tuesday and other days.

Bugsy 11-12-2011 18:51

Re: [check] is this code correct/ pls check
 
Quote:

Originally Posted by avril-lavigne (Post 1595591)
is it correct ? to set task on monday tuesday and other days.

What does each task do, it may be even simpler than the below
PHP Code:

new day]; 
get_time"%w" day )

switch ( 
str_to_numday ) )
{
    case 
0set_task5.0 "start_scan" , .flags="b" )
    case 
6set_task5.0 "start_scan1" , .flags="b" )
}

// or

new iDay  str_to_numday );
set_task5.0 , ( !iDay || ( iDay ) ) ? "start_scan" "start_scan1" , .flags="b" 



All times are GMT -4. The time now is 08:28.

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