Raised This Month: $ Target: $400
 0% 

[INC] HFile - Hirsw0w's Files


Post New Thread Reply   
 
Thread Tools Display Modes
Mario AR.
Senior Member
Join Date: May 2011
Location: Lima, Perú
Old 07-24-2014 , 18:31   Re: [INC] HFile - Hirsw0w's Files
Reply With Quote #21

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
As far as I remember, get_gametime returns a float. If it does my code works. When I mentioned unixtime o.O

For example:
PHP Code:
new Float:startTime get_gametime(); // let's say get_gametime() it's equal to 25.634
// do stuff
new Float:endTime get_gametime(); // let's say that endTime it's equal to 28.453
new Float:doStuffTime endTime-startTime;
//doStuffTime will be "do stuff" execute delay, in this case: 2.819 
PS: My theory will be shit if get_gametime returns an int
get_gametime() returns the gaming time, and you know that the server freezes when executing code (because of single threading)
Mario AR. is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-24-2014 , 21:04   Re: [INC] HFile - Hirsw0w's Files
Reply With Quote #22

Quote:
Originally Posted by Mario AR. View Post
get_gametime() returns the gaming time, and you know that the server freezes when executing code (because of single threading)
PHP is single threading too and if you run
PHP Code:
$start time();
sleep(5);
$end time();
echo 
$end-time
Will print 5.

The problem is that get_gametime is not updated when you call the native, it only access to the cached value that is updated somewhere as meTaLiCroSS explained.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-24-2014 , 21:25   Re: [INC] HFile - Hirsw0w's Files
Reply With Quote #23

Quote:
Originally Posted by Strick3n View Post
Why you don't trash it yet?
Because we want him to learn from his mistakes so he (and others) don't make similar ones


Quote:
Originally Posted by Neeeeeeeeeel.- View Post
PHP is single threading too and if you run
PHP Code:
$start time();
sleep(5);
$end time();
echo 
$end-time
Will print 5.

The problem is that get_gametime is not updated when you call the native, it only access to the cached value that is updated somewhere as meTaLiCroSS explained.
PHPs time and AMXX get_gametime return different types of timestamps, so you cannot compare them. time is the same as amx_systime.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-24-2014 , 21:47   Re: [INC] HFile - Hirsw0w's Files
Reply With Quote #24

Quote:
Originally Posted by YamiKaitou View Post
PHPs time and AMXX get_gametime return different types of timestamps, so you cannot compare them. time is the same as amx_systime.
Yes but Mario said that my problem was because of the fact that AMXX is single threading, I only made a PHP example to show why he was wrong.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Mario AR.
Senior Member
Join Date: May 2011
Location: Lima, Perú
Old 07-24-2014 , 22:05   Re: [INC] HFile - Hirsw0w's Files
Reply With Quote #25

I said the gaming time lol.
Mario AR. is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-24-2014 , 22:43   Re: [INC] HFile - Hirsw0w's Files
Reply With Quote #26

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
Yes but Mario said that my problem was because of the fact that AMXX is single threading, I only made a PHP example to show why he was wrong.
You still cannot directly compare them as you are obtaining 2 different things. time and get_systime will always retrieve the current epoch time. get_gametime is returning the value of gpGlobals->time
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-26-2014 , 17:58   Re: [INC] HFile - Hirsw0w's Files
Reply With Quote #27

But he is still wrong.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 07-27-2014 , 18:43   Re: [INC] HFile - Hirsw0w's Files
Reply With Quote #28

No he isn't. get_gametime() returns the time that the engine has processed, and is updated only on the next server frame at the earliest. Calling get_gametime() twice in the same AMXX function will always return the same value, because the engine isn't processing anything while your function is executed. This is due to the nature of the whole thing being single threaded. When you're calling another time function that returns a system-level unix timestamp it is obviously going to be updated, because your AMXX plugin certainly doesn't halt the entire operating system from processing. You're now using functions that work outside the HL engine, and that's a different thing entirely.
__________________
In Flames we trust!
Nextra is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-28-2014 , 12:15   Re: [INC] HFile - Hirsw0w's Files
Reply With Quote #29

Ok, he was right
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
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 06:49.


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