Raised This Month: $ Target: $400
 0% 

finding time left in a round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
onfirenburnin420
Senior Member
Join Date: Jan 2005
Old 03-01-2006 , 19:00   finding time left in a round
Reply With Quote #1

Im having trouble figureing this out. Please help me out. I need to find the time left on a round.
Code:
public RoundStart(id) {         new roundtime = get_cvar_num("mp_roundtime")     new time_left = ???????????????     if(time_left == 60.0) {         set_task(1.0,"check_map")     } }

Thanks in advance
__________________
onfirenburnin420 is offline
Send a message via AIM to onfirenburnin420
Jordan
Veteran Member
Join Date: Aug 2005
Old 03-01-2006 , 20:22  
Reply With Quote #2

Edit: Sry bout that
Jordan is offline
onfirenburnin420
Senior Member
Join Date: Jan 2005
Old 03-01-2006 , 20:25  
Reply With Quote #3

thats for the map time. i need round
__________________
onfirenburnin420 is offline
Send a message via AIM to onfirenburnin420
Jordan
Veteran Member
Join Date: Aug 2005
Old 03-01-2006 , 20:26  
Reply With Quote #4

Woops sry didn't see I'll look into it.
Jordan is offline
onfirenburnin420
Senior Member
Join Date: Jan 2005
Old 03-01-2006 , 20:27  
Reply With Quote #5

okay <3
__________________
onfirenburnin420 is offline
Send a message via AIM to onfirenburnin420
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-01-2006 , 22:00  
Reply With Quote #6

Code:
new Float:round_started; public plugin_init() {    register_logevent("new_round",2,"1=Round_Start"); } public new_round() {    round_started = get_gametime(); } public Float:get_roundtimeleft() {    return (get_cvar_float("mp_roundtime") * 60.0) - (get_gametime() - round_started); }

this stores the game time when a new round starts. when you call the function, it determines how much time has gone by since then, and subtracts it from the maximum round time.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
VEN
Veteran Member
Join Date: Jan 2005
Old 03-02-2006 , 04:29  
Reply With Quote #7

mp_roundtime is in minutes
get_systime() is in seconds
Also i'm not sure but i think that roundtime not depend on systime but on get_gametime because server can lag etc.
VEN is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-02-2006 , 16:45  
Reply With Quote #8

thanks. i have updated the code.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
VEN
Veteran Member
Join Date: Jan 2005
Old 03-03-2006 , 06:04  
Reply With Quote #9

You have to do get_cvar_float("mp_roundtime") in other case (0.X * 60) seconds of roundtime could be missed.
And CS mostly uses floor rounding method.
VEN is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-03-2006 , 15:16  
Reply With Quote #10

alright then, fixed.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
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 19:10.


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