Raised This Month: $51 Target: $400
 12% 

The Time


Post New Thread Reply   
 
Thread Tools Display Modes
ComedyShotsGamer
Senior Member
Join Date: Mar 2016
Old 05-06-2016 , 03:39   Re: The Time
Reply With Quote #11

Someone?
ComedyShotsGamer is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-06-2016 , 05:52   Re: The Time
Reply With Quote #12

Quote:
Originally Posted by ComedyShotsGamer View Post
Someone?
At the top of the plugin add:

PHP Code:
new g_gmtvalue 
In public plugin_init() function add:

PHP Code:
g_gmtvalue register_cvar("amx_gmtzone""2"
And Finally replace saythetime function with this:

PHP Code:
public sayTheTime(id)
{
    new 
shours[6], sday[6]
    
get_time("%H"shours5)
    
get_time("%d"sday5)
    new 
hrs str_to_num(shours) + get_pcvar_num(g_gmtvalue);
    new 
day str_to_num(sday);
    if(
hrs>=24){
    
hrs-=24
    day
++
    }
    else
    {
    if(
hrs<0){
    
hrs=24+hrs;
    
day--;
    }
    }
    
    
formatex(shours5"%s%d"hrs "" "0")
    
formatex(sday5"%s%d"day "" "0")
    
    
    if (
get_cvar_num("amx_time_voice"))
    {
        new 
mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
        
        
get_time("%H"mhours5)
        
get_time("%M"mmins5)
        
        new 
mins str_to_num(mmins)
        new 
hrs str_to_num(mhours)
        
        if (
mins)
            
num_to_word(minswmins31)
        else
            
wmins[0] = 0
        
        
if (hrs 12)
            
wpm "am "
        
else
        {
            if (
hrs 12hrs -= 12
            wpm 
"pm "
        
}

        if (
hrs
            
num_to_word(hrswhours31)
        else
            
whours "twelve "
        
        
client_cmd(id"spk ^"fvox/time_is_now %s_period %s%s^""whourswminswpm)
    }
    
    new 
ctime[64];
    
    
get_time("%m/x/%Y - x:%M:%S"ctime63)

    
replacectime63"x"sday  )
    
replacectime63"x"shours )

    
client_print(0print_chat"[AMXX] %L:   %s"LANG_PLAYER"THE_TIME"ctime)
    
    return 
PLUGIN_CONTINUE

But one more thing that i can't make.

For example if time is 23 and you have gmt cvar set to 2, then the date should be tomorrow. But if server date is 30 april and tomorrow is 1 may then it will add 30+1 and it will be 31 april which is not correct...
I cant fix it because i don't know how to determine when it's 30 and when it's 31, i know that february once in 4 years is 28 days and then is 29, but don't know how to calculate.
The same thing with 1st date.
If server's time is 1:00 morning and you have gtm -2 the it shall be 23:00 night but a day before , so it will do 1 - 1 = 0 and it will display date 0.

Shortly, it will work good until date is 1 or 30, 31....

Last edited by siriusmd99; 05-06-2016 at 06:20.
siriusmd99 is offline
Reply



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 05:13.


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