Raised This Month: $ Target: $400
 0% 

Easy way to get round time?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-27-2009 , 12:16   Easy way to get round time?
Reply With Quote #1

Is there a way to do it? Like get_gametime, there is no get_roundtime
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
padilha007
Senior Member
Join Date: Jul 2008
Old 05-27-2009 , 12:26   Re: Easy way to get round time?
Reply With Quote #2

http://forums.alliedmods.net/showthr...t=mp_roundtime
__________________

padilha007 is offline
Starsailor
horrible hahah
Join Date: Aug 2008
Location: Buenos Aires
Old 05-27-2009 , 12:39   Re: Easy way to get round time?
Reply With Quote #3

like this ?
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Get Roundtime"
#define VERSION "1.0"
#define AUTHOR "Starsailor"

#define TASKID 1337


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("Event_roundend"2"1=Round_End"
    
register_event("HLTV","Event_newround","a","1=0","2=0")
    
register_event("TextMsg""Event_roundend""a""2&#Game_C""2&#Game_w")
}

public 
Event_newround()
    
set_task(get_cvar_float("mp_freezetime"),"StartCount",TASKID)

new 
Time

public StartCount(task){
    
Time++
    
set_task(0.9,"StartCount",TASKID)
    
}

public 
Event_roundend(){
            
    if(
task_exists(TASKID))
        
remove_task(TASKID)
            
    
client_print(0,print_chat,"The round has lasted: %d",Time)
    
    
Time 0

The result is the time that players has played in each round
__________________
Find my plugins here..

Ex - Spanish Moderator.
Starsailor is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 05-27-2009 , 12:59   Re: Easy way to get round time?
Reply With Quote #4

Not tested!
PHP Code:
//global
new Float:round_start_gametime

// plugin init
register_event("HLTV","event_newround","a","1=0","2=0")

public 
event_newround()
{
 
round_start_gametime get_gametime()
 return 
PLUGIN_CONTINUE
}

stock get_roundtime()
{
 return 
get_gametime() - round_start_gametime

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-27-2009 , 13:05   Re: Easy way to get round time?
Reply With Quote #5

OT Gametime-Gametime = 0.
Well, it would be good for a stock, i'll use it for a command which only can be used in the 10 secs of start of a round.
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 05-27-2009 , 13:09   Re: Easy way to get round time?
Reply With Quote #6

Quote:
Originally Posted by TitANious View Post
OT Gametime-Gametime = 0
You don't get it. Ofc if you use it at the round start it's hows correctly zero. Still when the gametime increases, the round start time is the same all the time.
Edit:
Quote:
Originally Posted by TitANious View Post
Well round_start_gametime is get_gametime, so it would be get_gametime-get_gametime
Antibots just corrected that the stock must be Float, you must use Ot's code, but Antibot's stock.
SnoW is offline
Send a message via MSN to SnoW
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 05-27-2009 , 13:06   Re: Easy way to get round time?
Reply With Quote #7

PHP Code:
stock Float:get_roundtime() 

 return 
get_gametime() - round_start_gametime 

</SPAN>
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-27-2009 , 13:08   Re: Easy way to get round time?
Reply With Quote #8

Quote:
Originally Posted by AntiBots View Post
PHP Code:
stock Float:get_roundtime() 

 return 
get_gametime() - round_start_gametime 

</SPAN>
Well round_start_gametime is get_gametime, so it would be get_gametime-get_gametime
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-27-2009 , 13:10   Re: Easy way to get round time?
Reply With Quote #9

Oh, the round_start_gametime resets every round?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 05-27-2009 , 13:12   Re: Easy way to get round time?
Reply With Quote #10

Quote:
Originally Posted by TitANious View Post
Oh, the round_start_gametime resets every round?
PHP Code:
 // plugin init 
register_event("HLTV","event_newround","a","1=0","2=0"

public 
event_newround() 

 
round_start_gametime get_gametime() 
 return 
PLUGIN_CONTINUE 

You can try to read the event function's name.
SnoW is offline
Send a message via MSN to SnoW
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:27.


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