AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Flashbang Duration (https://forums.alliedmods.net/showthread.php?t=85262)

sgtbane 02-07-2009 19:57

Flashbang Duration
 
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



Arkshine 02-07-2009 20:36

Re: Flashbang Duration
 
1 second = (1 << 12 ) = 4096 units

anakin_cstrike 02-07-2009 21:00

Re: Flashbang Duration
 
Quote:

Originally Posted by arkshine (Post 757759)
1 second = (1 << 12 ) = 4096 units

I always wanted to know...why 4096 units are 1 second ?

Arkshine 02-07-2009 21:05

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

sgtbane 02-08-2009 00:08

Re: Flashbang Duration
 
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.

ConnorMcLeod 02-08-2009 02:38

Re: Flashbang Duration
 
You can also use player offsets :

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

http://forums.alliedmods.net/showthread.php?t=68113

Exolent[jNr] 02-08-2009 12:46

Re: Flashbang Duration
 
Quote:

Originally Posted by anakin_cstrike (Post 757768)
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))

ConnorMcLeod 02-08-2009 12:52

Re: Flashbang Duration
 
Code:

#define seconds_to_screenfade_units(%1) clamp(%1<<12, 0, 0xFFFF)

anakin_cstrike 02-09-2009 08:31

Re: Flashbang Duration
 
Quote:

Originally Posted by arkshine (Post 757770)
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

Arkshine 02-09-2009 09:13

Re: Flashbang Duration
 
Ask Valve :p


All times are GMT -4. The time now is 17:01.

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