Raised This Month: $32 Target: $400
 8% 

Action based on round time.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-M-Jon
Member
Join Date: Dec 2009
Old 08-08-2011 , 11:04   Action based on round time.
Reply With Quote #1

I've searched around in the previous threads available regarding this and I haven't been able to come up with a solution. Because of the inaccuracy of long timers, I was hoping to set an action based on the round timer. For example

if (roundtime == 30)
PrintToChatAll("\x03[SM]: \x01Thirty seconds in the round remaining.");

Thanks!
-M-Jon is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-08-2011 , 11:40   Re: Action based on round time.
Reply With Quote #2

Quote:
Originally Posted by -M-Jon View Post
Because of the inaccuracy of long timers
What inaccuracy? When the SourceMod docs say the timers are low accuracy, it means that the timer tick may not happen at the exact millisecond it should, but it generally isn't that far off.

Yes, it's bad if you need millisecond precision, but it's fairly accurate to the second.

For example, MapChooser uses a timer to know when to start end of map votes.

MapChooser Extended takes this one step further and uses timer ticks for a countdown timer; with voice clips, so it'd be really obvious if they were way off. These are still reasonably accurate.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 08-08-2011 , 17:33   Re: Action based on round time.
Reply With Quote #3

You could always store the round start time in an global variable and have a timer running for like 28.0 seconds, start a 1.0 timer in that callback and repeat the timer. In that second timer just do what you said if(GetTime() - g_iRoundStartTime == 30) PrintToChatAll("You're already playing 30 seconds in this round!!!1");

But that's a pretty messy solution and you'd need to check, if the action for the current condition wasn't already executed, if the timer is called twice in one seconds.

You'd need to check the mp_roundtime and mp_freezetime convars for roundending timings though.

But still, as Powerlord said, timers are pretty accurate if you don't want to syncronize with the gametime.
__________________
Peace-Maker is offline
Reply


Thread Tools
Display Modes

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 00:27.


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