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

Timer with float


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-02-2008 , 08:01   Timer with float
Reply With Quote #1

I was wondering is there a method to get how much time was spent (start -> end). I only figured out one method, but it's with set_task, and it crashes the server when the time gets smaller. This can't be done with game time, because I want to handle the time delicately, not with only seconds.
Code:
new Float:Time[33];
new Float:time = 0.01;
public start_timer(id)
{
 set_task(time, "timer", id);
}
public timer(id)
{
 Time[id] = Time[id] + time;
 set_task(time, "timer", id);
}
SnoW is offline
Send a message via MSN to SnoW
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-02-2008 , 08:09   Re: Timer with float
Reply With Quote #2

what's wrong with get_gametime() ?
__________________
Arkshine is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-02-2008 , 08:12   Re: Timer with float
Reply With Quote #3

Ah, so it does return a Float? Do you know how exact is it? Hope I use right word, I mean how many desimals is it?
SnoW is offline
Send a message via MSN to SnoW
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-02-2008 , 08:14   Re: Timer with float
Reply With Quote #4

Test yourself and you will see.
__________________
Arkshine is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-02-2008 , 08:14   Re: Timer with float
Reply With Quote #5

Okay, thanks.
SnoW is offline
Send a message via MSN to SnoW
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-02-2008 , 08:23   Re: Timer with float
Reply With Quote #6

Quote:
Originally Posted by SnoW View Post
Okay, thanks.
Just so you know, gametime is only updated once per frame, and you won't be able to monitor function time through it (I tried and got no success). Try Sawce's Profiler Build.
__________________

Community / No support through PM
danielkza is offline
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 04:18.


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