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

get_user_time servetime


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-01-2012 , 12:21   get_user_time servetime
Reply With Quote #1

How can i get server time from last map change??
Is it possible with get_user_time??
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-01-2012 , 12:23   Re: get_user_time servetime
Reply With Quote #2

You mean if player was connected last map, and stayed over map change, how to get the time from when player joined last map til now?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 08-07-2012 , 08:42   Re: get_user_time servetime
Reply With Quote #3

Hm, i wanted to get server uptime, i said get_user_time as reference, but it should be get_gametime xD
Anyway i solved the problem, hooking pfnTime with Orpheu, it returns server uptime in seconds (float).
Code:
#include < amxmodx > #include < orpheu > #include < orpheu_stocks > //Increase this if g_fUptime equal to 0.0000 #define UNREGISTER_TIME 0.2 new OrpheuFunction:g_pfnTime, OrpheuHook:handlePFTime; new Float:g_fUptime; public plugin_init( ) {     register_plugin( "Server UPTime", "1.1", "OvidiuS" );     register_clcmd( "say /uptime", "command_UpTime" );         g_pfnTime = OrpheuGetEngineFunction( "pfnTime", "PF_Time" ); } public command_UpTime( id ) {     handlePFTime = OrpheuRegisterHook( g_pfnTime, "Check_UpTime", OrpheuHookPost );     client_print( id, print_chat, "Server UPTIME: %f", g_fUptime );         set_task( UNREGISTER_TIME, "Task_Unregister", _, _, _ ); } public Task_Unregister( )     OrpheuUnregisterHook( handlePFTime ); public OrpheuHookReturn:Check_UpTime( const handle ) {     g_fUptime = OrpheuGetReturn( );     return OrpheuIgnored; }
I still haven't tested but it should work, later i will rewrite it, and convert seconds.

Last edited by OvidiuS; 08-07-2012 at 09:26.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-15-2014 , 21:16   Re: get_user_time servetime
Reply With Quote #4

After cs update, i got error with this plugin.
Code:
Invalid function structure "PF_Time"
Any idea how to solve it?

Last edited by OvidiuS; 04-15-2014 at 21:16.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
GinNNy
Senior Member
Join Date: Mar 2014
Old 04-15-2014 , 22:05   Re: get_user_time servetime
Reply With Quote #5

its compling with me without errors, try amxmodx 1.8.3 dev build
GinNNy is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 04-16-2014 , 06:36   Re: get_user_time servetime
Reply With Quote #6

Quote:
Originally Posted by GinNNy View Post
its compling with me without errors, try amxmodx 1.8.3 dev build
It's compiled fine, but when i run it, i get that error.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 04-16-2014 , 08:03   Re: get_user_time servetime
Reply With Quote #7

Quote:
Originally Posted by OvidiuS View Post
After cs update, i got error with this plugin.
Code:
Invalid function structure "PF_Time"
Any idea how to solve it?
So. post the structure...
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Old 04-17-2014, 18:54
Black Rose
This message has been deleted by Black Rose. Reason: Nvm...
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 01:55.


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