AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   String Variable with get_time (https://forums.alliedmods.net/showthread.php?t=49295)

raa 12-31-2006 18:14

String Variable with get_time
 
Hi, I need a little help with getting the day of the week then determining if it's SAT, or SUN. then running code if its not one of those days.

This is a section of what I have so far;

Code:

public theday(){
new today[8] = {"SAT","SUN"}
get_time("%a", today, 3)

if(get_time("today") == SAT) || (get_time("today") == SUN)
        return PLUGIN_HANDLED
//somecode

}

spare some help? thanks.. :)

stupok 12-31-2006 18:25

Re: String Variable with get_time
 
Use this page for reference:
http://www.amxmodx.org/funcwiki.php?go=func&id=249

Code:
public something_function() {     new day[3]     get_time("%a", day, 2)         if(equal(day, "Sat"))     {         //it's saturday, execute whatever...     }     else if(equal(day, "Sun"))     {         //it's sunday, execute whatever...     } }

Brad 12-31-2006 18:43

Re: String Variable with get_time
 
Code:
public something_function() {     new day[1];     get_time("%w", day, 1)         if(equal(day, "6"))     {         //it's saturday, execute whatever...     }     else if(equal(day, "0"))     {         //it's sunday, execute whatever...     } }

Greenberet 01-01-2007 11:13

Re: String Variable with get_time
 
Code:
public something_function() {      new day[2]; // arraysize of 1 would generate runtime error 4 on the next line      get_time("%w", day, 1)      if(equal(day, "6"))      {          //it's saturday, execute whatever...      }      else if(equal(day, "0"))      {          //it's sunday, execute whatever...      } }


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

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