Raised This Month: $ Target: $400
 0% 

Server time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 06-13-2010 , 18:08   Server time
Reply With Quote #1

How can i get server time and check if its for example 24:00.Im asking because i don't know if its xxxx , xxx or something else.
SpeeDeeR is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-14-2010 , 12:45   Re: Server time
Reply With Quote #2

You mean this?

Is just an example ofcourse...

Code:
#include <amxmodx> #define PLUGIN "SchlumPF" #define VERSION "1.0" #define AUTHOR "Uptime" new g_bRoundStarted; new g_iMessageSayText; new g_pAlert; public plugin_init( ) {     register_plugin( PLUGIN, VERSION, AUTHOR );         g_pAlert = register_cvar( "uptime_alert", "1" );         register_clcmd( "say /up", "cmdUptime" );     register_clcmd( "say /uptime", "cmdUptime" );         g_iMessageSayText = get_user_msgid( "SayText" )         register_logevent( "eventRoundStart", 2, "1=Round_Start" );     register_message( get_user_msgid( "RoundTime" ), "msgRoundTime" ); } public cmdUptime( plr ) {     static message[192], gametime;     message[0] = 0x04;     formatex( message[1], 190, "[XJ] " );     message[6] = 0x01;         gametime = floatround( get_gametime( ), floatround_floor );         formatex( message[7], 186, "This server's uptime is %02i:%02i", gametime / 60, gametime % 60 );         message_begin( MSG_ONE_UNRELIABLE, g_iMessageSayText, { 0, 0, 0 }, plr );     write_byte( plr );     write_string( message );     message_end( );         return PLUGIN_HANDLED; } public eventRoundStart( ) {     g_bRoundStarted = true; } public msgRoundTime( ) {     if( g_bRoundStarted )     {         g_bRoundStarted = false;         set_task( 3600.0 , "tskTimerBug" );     } } public tskTimerBug( ) {     if( get_pcvar_num( g_pAlert ) )     {         static message[192];         message[0] = 0x04;         formatex( message[1], 190, "[XJ] " );         message[6] = 0x01;                 formatex( message[7], 186, "Uptime is now 60:00, better restart to avoid timerbugs!" );                 for( new i ; i <= get_maxplayers( ) ; i++ )         {             message_begin( MSG_ONE_UNRELIABLE, g_iMessageSayText, { 0, 0, 0 }, i);             write_byte( i );             write_string( message );             message_end( );         }     } }
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 06-14-2010 , 13:52   Re: Server time
Reply With Quote #3

lol i didnt mean server uptime in any way.What I ment is server time, like when you write 'thetime' it prints server time aka 'the time is now xx:yy:zz'.So i want to get this and check if its 24:00:00.
PS: Think I saw this in a plugin but dont remember where and the search tool didnt help so ...
SpeeDeeR is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-14-2010 , 14:05   Re: Server time
Reply With Quote #4

Oh sry, my english is not rly good... so you mean the REAL TIME...

Just see timeleft.sma

Code:
public sayTheTime(id) {     /*if (get_cvar_num("amx_time_voice"))     {         new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]                 get_time("%H", mhours, 5)         get_time("%M", mmins, 5)                 new mins = str_to_num(mmins)         new hrs = str_to_num(mhours)                 if (mins)             num_to_word(mins, wmins, 31)         else             wmins[0] = 0                 if (hrs < 12)             wpm = "am "         else         {             if (hrs > 12) hrs -= 12             wpm = "pm "         }         if (hrs)             num_to_word(hrs, whours, 31)         else             whours = "twelve "                 client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)     }*/     // here is the important part         new ctime[64]         get_time("%m/%d/%Y - %H:%M:%S", ctime, 63)     client_print(0, print_chat, "%L:   %s", LANG_PLAYER, "THE_TIME", ctime)         return PLUGIN_CONTINUE }
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 06-14-2010 , 14:52   Re: Server time
Reply With Quote #5

ok and how to check if its a specific hour ?
SpeeDeeR is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-14-2010 , 14:53   Re: Server time
Reply With Quote #6

Get the hour only and them compare it.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-14-2010 , 15:33   Re: Server time
Reply With Quote #7

if(equal(.....) )

or str_to_num( ) and then compare the var with 24.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
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 14:43.


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