Raised This Month: $ Target: $400
 0% 

get time between Knife slashes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avril-lavigne
Banned
Join Date: Apr 2009
Old 09-30-2012 , 01:59   get time between Knife slashes
Reply With Quote #1

Im bad in get_time....or get_gametime


RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fw_Knife_PrimaryAttack_Post", 1)

new Float:1slash = get_gametime()
new Float:2slash = get_gametime()


new Float:result = 2slash - 1 slash

not sure. help me to get time between 2 knife attacks
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 09-30-2012 at 01:59.
avril-lavigne is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-30-2012 , 02:05   Re: get time between Knife slashes
Reply With Quote #2

Use get_systime() at the end of your function and store it in a global variable. At the begining of the function, use get_systime() again and subtract the previous one to get how many seconds it has been since the last time the function has been executed.
__________________
fysiks is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 09-30-2012 , 15:45   Re: get time between Knife slashes
Reply With Quote #3

ok finally did it


Sec: 1
Sec: 1
Sec: 0
Sec: 0
Sec: 1
Sec: 0
Sec: 0
Sec: 1

the problem it counts in seconds I need in 0.1 SEC
because time between slashes is almost 1/3 sec

and as u see it returns 0 .... so I cant divide at 0
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 09-30-2012 at 16:01.
avril-lavigne is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 09-30-2012 , 17:47   Re: get time between Knife slashes
Reply With Quote #4

It's a float so it gives you a 0.000001 precision. How are you printing the values?

Last edited by hleV; 09-30-2012 at 17:49.
hleV is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-30-2012 , 18:39   Re: get time between Knife slashes
Reply With Quote #5

get_systime returns integer not float, use get_gametime the same way if you want float
jimaway is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 10-01-2012 , 08:56   Re: get time between Knife slashes
Reply With Quote #6

Ok I did it. time is 0.71 between each slash thanks
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 10-01-2012 at 09:02.
avril-lavigne is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-01-2012 , 09:41   Re: get time between Knife slashes
Reply With Quote #7

If you wanted to know the delay between knife attach, you can just look at the source code : https://github.com/Arkshine/CSSDK/bl.../wpn_knife.cpp and checking m_flNextPrimaryAttack/m_flNextSecondaryAttack . So for slash, 0.35.
__________________
Arkshine 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 08:10.


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