Raised This Month: $ Target: $400
 0% 

Flashbang Duration


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sgtbane
Member
Join Date: Feb 2006
Old 02-07-2009 , 19:57   Flashbang Duration
Reply With Quote #1

I am trying to get the duration and hold time so I can find out how long they are flashed for and at what level. I am guessing hold time is how long it will stay at the intensity it originally flashed at, and that the duration is the total length that your screen will be 'faded'. My only problem is that I am getting some strange numbers for the duration and the hold time.
Something along the lines of
Duration:1000-2400, Hold Time:600-1300
I don't think its in ms, because i don't remember ever being flashed for 24 sec, or even 13 for that matter...
any help as to what these numbers are displayed as? ive looked into a couple other plugins and scanned the forums but for the most part people just alter the colors when hooking this event.
PHP Code:
public plugin_init() {  
    
register_plugin("1","2","3")
    
register_event("ScreenFade",     "Event_Blinded",     "be""4=255""5=255""6=255""7>199"
    return 
PLUGIN_CONTINUE  
}
public 
Event_Blinded(id) {
    
client_print(idprint_chat"Duration:%i   Hold Time:%i   Alpha:%i"read_data(1), read_data(2), read_data(7))
    return 
PLUGIN_CONTINUE

__________________
[Add|Community]

~SgtBane
sgtbane is offline
Send a message via MSN to sgtbane
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-07-2009 , 20:36   Re: Flashbang Duration
Reply With Quote #2

1 second = (1 << 12 ) = 4096 units
Arkshine is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 02-07-2009 , 21:00   Re: Flashbang Duration
Reply With Quote #3

Quote:
Originally Posted by arkshine View Post
1 second = (1 << 12 ) = 4096 units
I always wanted to know...why 4096 units are 1 second ?
__________________

anakin_cstrike is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-07-2009 , 21:05   Re: Flashbang Duration
Reply With Quote #4

Holdtime and Duration are just in special units. All I know. 4096 because is the same value as 1 << 12. ( 2^12 = 4096 )

Last edited by Arkshine; 02-07-2009 at 21:07.
Arkshine is offline
sgtbane
Member
Join Date: Feb 2006
Old 02-08-2009 , 00:08   Re: Flashbang Duration
Reply With Quote #5

um.. im not good with this byte stuff. can someone tell me why it works like this? 4096 = 1 sec?. so.. if i take the value of the duration or hold time and divide it by 4096 i can get time in seconds?

im planning on setting the value i get from here to a task so that i can accurately find out when the flash ends. but i can't really set a task using the value i am getting.
__________________
[Add|Community]

~SgtBane
sgtbane is offline
Send a message via MSN to sgtbane
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2009 , 02:38   Re: Flashbang Duration
Reply With Quote #6

You can also use player offsets :

514 - fGametime flashed until ?
515 - fGametime flashed at ?

http://forums.alliedmods.net/showthread.php?t=68113
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-08-2009 , 12:46   Re: Flashbang Duration
Reply With Quote #7

Quote:
Originally Posted by anakin_cstrike View Post
I always wanted to know...why 4096 units are 1 second ?
Note: Duration and HoldTime is in special units. 1 second is equal to (1<<12) i.e. 4096 units.
http://wiki.amxmodx.org/Half-Life_1_...nts#ScreenFade

@sgtbane:
I think this would work:
Code:
#define seconds_to_screenfade_units(%1) (%1 * (1<<12)) #define screenfade_units_to_seconds(%1) (%1 / (1<<12))
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2009 , 12:52   Re: Flashbang Duration
Reply With Quote #8

Code:
#define seconds_to_screenfade_units(%1) clamp(%1<<12, 0, 0xFFFF)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 02-09-2009 , 08:31   Re: Flashbang Duration
Reply With Quote #9

Quote:
Originally Posted by arkshine View Post
Holdtime and Duration are just in special units. All I know. 4096 because is the same value as 1 << 12. ( 2^12 = 4096 )
I know that;p
__________________

anakin_cstrike is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-09-2009 , 09:13   Re: Flashbang Duration
Reply With Quote #10

Ask Valve :p
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 17:00.


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