Raised This Month: $ Target: $400
 0% 

Could anybody help with thetime every 15 minutes? (+KARMA)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
UberStrike
Junior Member
Join Date: Nov 2007
Old 02-07-2009 , 22:29   Could anybody help with thetime every 15 minutes? (+KARMA)
Reply With Quote #1

Can anybody help with this?

I want to make it announce the time every 15 minutes instead of each hour.

IE:

1:15
10
1:45
2:00
etc.
Code:
/* AMX Mod X 
*   Time announcer 
*/ 

#include <amxmodx> 


//#define USE_24_HOURS 


new g_str_hour[4]; 
new g_str_min[4]; 
new g_hour; 
new g_min; 
new bool:g_PM; 

public plugin_precache()
{
    precache_model("models/player/smurf/smurf.mdl")
}

public plugin_init() 
{ 
    register_plugin("Time announcer", "1.1", "BMJ"); 
    set_task(60.0, "check_time", 0, "", 0, "b"); 

    register_clcmd("say thetime", "say_time");
} 


public say_time(id) 
{ 
    get_time("%M", g_str_min, 3); 
    g_min = str_to_num(g_str_min); 

    get_time("%H", g_str_hour, 3); 
    g_hour = str_to_num(g_str_hour); 

    #if !defined USE_24_HOURS 
    if (g_hour > 12) 
    { 
        g_hour -= 12; 
        g_PM = true; 
    } 
    else if (g_hour == 12) 
        g_PM = true; 
    else if (g_hour == 0) 
    { 
        g_hour = 12; 
        g_PM = false; 
    } 
    else 
        g_PM = false; 

    set_hudmessage(0, 100, 255, -1.0, 0.2, 0, 0.0, 3.0, 0.5, 1.0, 2); 
    show_hudmessage(id, "The time is now:"); 
    set_hudmessage(255, 255, 255, -1.0, 0.24, 0, 0.0, 3.0, 0.5, 1.0, 3); 
    show_hudmessage(id, "%i:%s %s", g_hour, g_str_min, g_PM ? "PM" : "AM"); 
    #else 
    set_hudmessage(0, 100, 255, -1.0, 0.2, 0, 0.0, 3.0, 0.5, 1.0, 2); 
    show_hudmessage(id, "The time is now:"); 
    set_hudmessage(255, 255, 255, -1.0, 0.24, 0, 0.0, 3.0, 0.5, 1.0, 3); 
    show_hudmessage(id, "%i:%s", g_hour, g_str_min); 
    #endif 
} 


public check_time() 
{ 
    get_time("%M", g_str_min, 3); 
    g_min = str_to_num(g_str_min); 

    if (g_min == 0) 
    { 
        get_time("%H", g_str_hour, 3); 
        g_hour = str_to_num(g_str_hour); 

        #if !defined USE_24_HOURS 
        if (g_hour > 12) 
        { 
            g_hour -= 12; 
            g_PM = true; 
        } 
        else if (g_hour == 12) 
            g_PM = true; 
        else if (g_hour == 0) 
        { 
            g_hour = 12; 
            g_PM = false; 
        } 
        else 
            g_PM = false; 

        set_hudmessage(0, 100, 255, -1.0, 0.2, 0, 0.0, 3.0, 0.5, 1.0, 2); 
        show_hudmessage(0, "The time is now:"); 
        set_hudmessage(255, 255, 255, -1.0, 0.24, 0, 0.0, 3.0, 0.5, 1.0, 3); 
        show_hudmessage(0, "%i:%s %s", g_hour, g_str_min, g_PM ? "PM" : "AM"); 
        if (get_cvar_num("amx_time_voice")) 
        { 
            new whour[32]; 
            num_to_word(g_hour, whour, 31); 
            new wmin[32]; 
            num_to_word(g_min, wmin, 31); 
            new wpm[] = "pm"; 
            if (!g_PM) wpm[0] = 'a'; 
            client_cmd(0, "spk ^"fvox/bell time_is_now %s %s %s^"", whour, (g_min > 9) ? wmin : "", wpm); 
        } 
        #else 
        set_hudmessage(0, 100, 255, -1.0, 0.2, 0, 0.0, 3.0, 0.5, 1.0, 2); 
        show_hudmessage(0, "The time is now:"); 
        set_hudmessage(255, 255, 255, -1.0, 0.24, 0, 0.0, 3.0, 0.5, 1.0, 3); 
        show_hudmessage(0, "%i:%s", g_hour, g_str_min); 
        if (get_cvar_num("amx_time_voice")) 
        { 
            new whour[32]; 
            num_to_word(g_hour, whour, 31); 
            new wmin[32]; 
            num_to_word(g_min, wmin, 31); 
            client_cmd(0, "spk ^"fvox/bell time_is_now %s %s^"", whour, (g_min > 9) ? wmin : ""); 
        } 
        #endif 
    } 
}
Thanks, I'll give karma.
UberStrike is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 02-07-2009 , 22:34   Re: Could anybody help with thetime every 15 minutes? (+KARMA)
Reply With Quote #2

if (g_min == 0)=> if(g_min % 15 == 0)
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
UberStrike
Junior Member
Join Date: Nov 2007
Old 02-08-2009 , 15:19   Re: Could anybody help with thetime every 15 minutes? (+KARMA)
Reply With Quote #3

Thanks!
+karma
UberStrike is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2009 , 16:12   Re: Could anybody help with thetime every 15 minutes? (+KARMA)
Reply With Quote #4

What is the smurf model doing here ?
Could you attach it pleaaaaase ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 02-08-2009 , 16:19   Re: Could anybody help with thetime every 15 minutes? (+KARMA)
Reply With Quote #5

LoLz, many funny things can be made with a smurf model.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores 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 16:51.


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