Raised This Month: $32 Target: $400
 8% 

Custom Flashlight v0.5.4 (10/20/09)


Post New Thread Reply   
 
Thread Tools Display Modes
Salamon
Senior Member
Join Date: Dec 2007
Location: P(r)oland
Old 06-07-2008 , 19:51   Re: Custom Flashlight (New)
Reply With Quote #21

ahh i understand it now ^^

;* friend kiss haha xD
__________________
This is 10% luck, 20% skill, 15% concentrated power of will,
5% pleasure, 50% pain and 100% reason to remember my name..
Salamon is offline
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 06-18-2008 , 11:10   Re: Custom Flashlight (New)
Reply With Quote #22

Interesting one. Pity i have no time to play with amx/x more.

I suggest converting flashlight_drainfreq & flashlight_chargefreq into cvars called e.g. flashlight_deplete_secs & flashlight_fullcharge_secs (if possible of course) which will stand for number of seconds fully charged flashlight can emit light until is depleted & number of secs an exhausted flashlight have to be charged respectively. This is more user-friendly.

Also you can optimize calculations within Make_FlashLight(id) (looks like it can be called rather often):

iAttn = 256 + iDecay * get_pcvar_num(g_pcvarFlashAttn) // barney/dontaskme
-->
fTemp = 256 / (256 + iDecay * get_pcvar_num(g_pcvarFlashAttn))
...
write_byte((g_iColor[id][Red] * fTemp)

Also this one
Code:
#define SOUND_FLASHLIGHT_ON "items/flashlight1.wav" #define SOUND_FLASHLIGHT_OFF    "items/flashlight1.wav"
theoretically makes resource duplication (depends of number of macro entries in the code) in compiled plugin. I would rather use new const instead of #DEFINE for string constants especially when they occure twice or more in the source code.

Again, pity i could not test it in-game. As i remember Avalanche's plugin did not feed my needs in conjunction with Blinding Flashlight.
__________________
my modest stuff: AXN 1.6.1 | plugins | bsp2csdm

Last edited by Simon Logic; 06-18-2008 at 11:16.
Simon Logic is offline
Send a message via Skype™ to Simon Logic
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-21-2008 , 04:08   Re: Custom Flashlight (New)
Reply With Quote #23

Thanks for suggestions.
I've changed cvars and #define thing.


I'm still confused on what is better for the attenuation thing as you may have missed that i need to have an integer/byte, so if i use floats i need to round them.
So what is optimized :
Code:
    static iDecay, iAttn     iDecay = floatround( flDist * 255.0 / flMaxDist )     iAttn = 256 + iDecay * get_pcvar_num(g_pcvarFlashAttn) // barney/dontaskme     // [..]     write_byte((g_iColor[id][Red] * 256) / iAttn)     write_byte((g_iColor[id][Green] * 256) / iAttn)     write_byte((g_iColor[id][Blue] * 256) / iAttn)

or

Code:
    static iDecay, Float:flAttn     iDecay = floatround( flDist * 255.0 / flMaxDist )     flAttn = 256.0 / (256 + iDecay * get_pcvar_num(g_pcvarFlashAttn))     // [..]     write_byte( floatround( g_iColor[id][Red] * flAttn ) )     write_byte( floatround( g_iColor[id][Green] * flAttn ) )     write_byte( floatround( g_iColor[id][Blue] * flAttn ) )

??
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 06-21-2008 , 05:04   Re: Custom Flashlight (New)
Reply With Quote #24

I still preferred the first one, obviously call triple floatround is not wise here. but I don't know if the pawn compiler has optimization about multiplying like this: (my guess is yes)
somevalue * 256 => somevalue<<8

also arrayset nonzero value is not so fast as your imagination.
so just set a loop
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-21-2008 , 05:48   Re: Custom Flashlight (New)
Reply With Quote #25

Updated to v0.3.0, thanks to both of you
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Son
Junior Member
Join Date: Jun 2008
Old 06-21-2008 , 06:38   Re: Custom Flashlight (New)
Reply With Quote #26

Not bad. ;) Karma.
__________________
Son is offline
warzarmz
Member
Join Date: Feb 2008
Old 06-23-2008 , 20:50   Re: Custom Flashlight (New)
Reply With Quote #27

theres a bug in your plugin i'm not sure your aware of.

Lets say my server is running Biohazard, and its also running this plugin. If a human has the flashlight on when he gets infected, the zombie can't turn off the light, it always stays on.
__________________

warzarmz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-24-2008 , 00:27   Re: Custom Flashlight (New)
Reply With Quote #28

This is related to Biohazard plugin, ask author for modifications if you want, i can't do nothing about it.

-edit-
If Zombies are in fact terrorists, you can set per team color and T color to 000000000.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-24-2008 at 12:26.
ConnorMcLeod is offline
luffy67
Junior Member
Join Date: Jan 2007
Old 06-24-2008 , 02:24   Re: Custom Flashlight (New)
Reply With Quote #29

Nice Job Connorr , +karma
__________________
luffy67 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-24-2008 , 12:27   Re: Custom Flashlight (New)
Reply With Quote #30

Quote:
Originally Posted by luffy67 View Post
Nice Job Connorr , +karma
Merci mec ;)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 01:20.


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