View Single Post
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-22-2015 , 10:53   Re: AutoExecConfig Question
Reply With Quote #5

Quote:
Originally Posted by Mr.Freeman View Post
Never thought of that Powerlord, would there be way to fetch date through sourcemod like the Time function. I was looking at a UNIX Timestamp style from MYSQL (https://forums.alliedmods.net/showthread.php?t=162537) but I would prefer the month to change automatically without the need for MYSQL. New to this system, if you require the source i can upload what I have to help make it easier to understand my request.

Thanks,
Freeman
SourcePawn has things for dealing with UNIX timestamps. GetTime returns a UNIX Timestamp. FormatTime turns a UNIX timestamp into a formatted string. If you don't pass a timestamp to FormatTime, it uses the current time.

So, if you wanted to get the month as a number...

PHP Code:
new month;
new 
String:strMonth[3];
FormatTime(strMonthsizeof(strMonth), "%m")
month StringToInt(strMonth); 
Edit: If you're wondering where "%m" came from, it's because FormatTime uses the C strftime system call, which has a bunch of formatting strings defined. %m is "month as a decimal number (01-12)"
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-22-2015 at 10:57.
Powerlord is offline