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

Weapon Lights * Update 0.7.1 Beta (26-Feb-2009)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   General Purpose        Approver:   Hawk552 (427)
HiSS
Member
Join Date: Nov 2008
Location: Celtic Gallaecia
Old 01-20-2009 , 05:56   Weapon Lights * Update 0.7.1 Beta (26-Feb-2009)
Reply With Quote #1

New version 0.7.1 beta, attached donwload at the top of this post.

Hi, I was too busy sorry I can't add it before. New version done by Arkshine available.

* Changes:

- Fixed bug when using pistols.
- Now uses VEN's method.

* Download here v.0.6 (old bugged):


Get Plugin
Get Source


* See here changes in new version:

http://forums.alliedmods.net/showthr...676#post754676

- Features:

This plungin just adds small dyanmic lights when a player shoot.
You can also change the color and the radius of the lights.

- Cvars:

weapon_lights 0 -> disable 1 = enable, default 1
weapon_lights_radius -> the size of light, default 18
weapon_lights_color -> color of the light RGB 0-255, default 255 150 15
weapon_lights_silenced -> 0 = disable lights | 1 = normal light | 2 = 50% of a normal light, default 2

- Installation:

Put .amxx file into your "./addons/amxx/plugins/" folder.
Add "weapon_lights" into your "plugins.ini" file. ("./addons/configs/")

- Credits:

> Arkshine - adapted for using hamsandwich, VEN's method, silenced weapons option, code optimization and helped me a lot, thank you.
> Avalanche (I learn there how to make a dynamic light, in his plugin "Flashbang Dynamic Light", used in first release).
> HiSS - Original idea. It's me!

- Modules recquired:

* fakemeta
* hamsandwich

Tested in Counter-Strike 1.6 AMXX 1.8.1 and works fine.
No reported issues with another plugin yet.
Compiled with 0 errors | 0 warnings.

Sorry for my bad english, I hope you enjoy the plugin.
Greetings.
Attached Thumbnails
Click image for larger version

Name:	screenshot01.jpg
Views:	8136
Size:	83.0 KB
ID:	36106   Click image for larger version

Name:	screenshot02.jpg
Views:	8050
Size:	73.9 KB
ID:	36107   Click image for larger version

Name:	screenshot03.jpg
Views:	12243
Size:	87.2 KB
ID:	36108  
Attached Files
File Type: sma Get Plugin or Get Source (weapon_lights_beta.sma - 7900 views - 4.6 KB)
__________________
[IMG]http://img227.**************/img227/3148/celeritasetsubtilitasuw0.jpg[/IMG]

Last edited by HiSS; 02-26-2009 at 13:43. Reason: Update v.0.7.1 beta (26-Feb-2009)
HiSS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-20-2009 , 06:23   Re: Weapon Lights (Beta) for Counter-Strike
Reply With Quote #2

As suggestions :

- Here it's more appropriate to use a command to retrieve the value or caching the value from cvar on a specific event ( like new_round ) ; because each time a player fires you retrieve the string and parse it when it needs to be done one time. ( one time when the value is changed )
- Since this function will be called very often, you should use static for light_origin.
- MSG_BROADCAST -> You should use MSG_PVS ; no need to send the message to players who don't look the origin.
- 27 -> Juste write directly TE_DLIGHT ; the define name is here for that.
- Instead of using floatround(), use EngFunc_WriteCoord, it's for float. Better and you don't need to call 3 natives in more.
- You include cstrike and fakemeta_util, no need here.
Arkshine is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 01-20-2009 , 06:57   Re: Weapon Lights (Beta) for Counter-Strike
Reply With Quote #3

screens?
Owyn is offline
Send a message via ICQ to Owyn
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 01-20-2009 , 09:43   Re: Weapon Lights (Beta) for Counter-Strike
Reply With Quote #4

Tested and works but still room for improvements.
http://forums.alliedmods.net/showthread.php?t=54887
You should read that so you can catch exactly when a shot is made. The way you have it is bad and sometimes plays when switching weapons.

Anyway... Heres some screen shots

[IMG]http://img88.**************/img88/6510/dedust20085vw7.jpg[/IMG]


[IMG]http://img161.**************/img161/3557/dedust20088bb6.jpg[/IMG]

[IMG]http://img440.**************/img440/6702/dedust20090me0.jpg[/IMG]
__________________
It's a mystery.

Last edited by Mini_Midget; 01-20-2009 at 09:46.
Mini_Midget is offline
HiSS
Member
Join Date: Nov 2008
Location: Celtic Gallaecia
Old 01-20-2009 , 10:01   Re: Weapon Lights (Beta) for Counter-Strike
Reply With Quote #5

Quote:
- Here it's more appropriate to use a command to retrieve the value or caching the value from cvar on a specific event ( like new_round ) ; because each time a player fires you retrieve the string and parse it when it needs to be done one time. ( one time when the value is changed )
I dunno what you mean with this, sorry my english is very bad, if you can explaind me please.
Quote:
- Since this function will be called very often, you should use static for light_origin.
I fixed it thank you.

Quote:
- MSG_BROADCAST -> You should use MSG_PVS ; no need to send the message to players who don't look the origin.
I prefer MSG_BROADCAST, if a player is around a corner you still can view the light, it's the point. Thanks anyway.
Quote:
- 27 -> Juste write directly TE_DLIGHT ; the define name is here for that.
I try this but get some strange error, it works fine with 27.
Quote:
- Instead of using floatround(), use EngFunc_WriteCoord, it's for float. Better and you don't need to call 3 natives in more.
Done, it works fine, thanks.
Quote:
- You include cstrike and fakemeta_util, no need here.
Removed, thank you very much I credit you in the first post.

I still trying to find the way how to detected if a weapon is silenced and make a cvar to turn on/off, żany suggestions?

Thank you all for reply, and thank Mini_Midget for screenshots
Greetings.
__________________
[IMG]http://img227.**************/img227/3148/celeritasetsubtilitasuw0.jpg[/IMG]
HiSS is offline
bomnacama
Senior Member
Join Date: Dec 2008
Location: Portugal
Old 01-20-2009 , 11:48   Re: Weapon Lights (Beta) * Updated v0.2
Reply With Quote #6

seems fun. nive ak skins
__________________



Please FEED MY HAMSTERS by giving me +karma
bomnacama is offline
Stixsmaster
Veteran Member
Join Date: May 2007
Location: I am all around you...I
Old 01-20-2009 , 12:28   Re: Weapon Lights (Beta) * Updated v0.2
Reply With Quote #7

I think you should make it so that when a silencer is used...have it so the light is not as bright when there is no silencer...

---Stixsmaster
__________________
Stixsmaster is offline
Send a message via AIM to Stixsmaster Send a message via MSN to Stixsmaster
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-20-2009 , 16:20   Re: Weapon Lights (Beta) * Updated v0.2
Reply With Quote #8

Quote:
I dunno what you mean with this, sorry my english is very bad, if you can explaind me please.
Do you understand that you parse each time the cvar, when you need to do one time at least ? Just cache the value.

If you want to keep the use of cvars :

- Hook NewRound event ( or others, like RoundStart or RoundEnd )
- Retrieve cvar value, and parse it
- Save in global vars.

You can create a command acting as cvar, too. When someone change the value, it will save immediately one time in the global vars. Using Cvars, you will have to wait the next event.

Do you see what I was meant now ?

Quote:
I prefer MSG_BROADCAST, if a player is around a corner you still can view the light, it's the point. Thanks anyway.
If player is around a corner, he should see the light. PVS means potentially. If player is enough near, it will works in such situation. Try it and you will see.
It will be better to not send a lot of messages when the player is not around.

Quote:
I try this but get some strange error, it works fine with 27.
Try again, no way that it generates an error ; write_byte ( TE_DLIGHT ); works perfectly fine and more readable.

Quote:
Done, it works fine, thanks.
Btw, if interested, to keep the same "design", I'm using a macro, like that :

Code:
#define message_begin_f(%1,%2,%3) ( engfunc ( EngFunc_MessageBegin, %1, %2, %3 ) ) #define write_coord_f(%1)         ( engfunc ( EngFunc_WriteCoord, %1 ) )
Code:
write_coord_f( light_origin[0] ); write_coord_f( light_origin[1] ); write_coord_f( light_origin[2] );

Quote:
I still trying to find the way how to detected if a weapon is silenced and make a cvar to turn on/off, żany suggestions?
See cs_get_weapon_silen() ; if you don't want to use cstrike, use the offset 88. ( see cstrike.cpp + cstrike.h for more details )


And Mini_Midget is right, you should use the VEN's method.

Last edited by Arkshine; 01-21-2009 at 06:38.
Arkshine is offline
HiSS
Member
Join Date: Nov 2008
Location: Celtic Gallaecia
Old 01-22-2009 , 11:48   I see code around me in the darkest nights
Reply With Quote #9

Hi, I try to implement VEN's method but I can't get it to work.
I'll go insane, I try thousands of ways but it still doesn't work.

I tried to implement a way to find if a weapon si silenced with cs_get_weapon_silen() (I don't know how to use offsets), and make a new cvar for it with 3 options:

0 - disable if is silenced
1 - make the light as a normal weapon
2 - make 50% of radius light if is silenced

But it fails CATASTROPHiCALLY.

If anyone can help me plz, I leave you the code attached (without the silenced option attempts).

Thanks and sorry my bad english.
Greetings.
__________________
[IMG]http://img227.**************/img227/3148/celeritasetsubtilitasuw0.jpg[/IMG]

Last edited by HiSS; 01-26-2009 at 15:54. Reason: Removed attached file beacause that test doesn't work.
HiSS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-22-2009 , 12:23   Re: Weapon Lights (Beta) * Updated v0.2
Reply With Quote #10

Wait a bit. I will send you by PM the corrected plugin with both cvars and command as examples, so to see the difference. Then, feel free to use or not some code with your own style. ( I don't attach here because some people seem to not like when I rewrite a plugin... -_- )

[Edit] Message sent. I have included your "silenced" cvar too. Hope it will help you.

Last edited by Arkshine; 01-22-2009 at 15:02.
Arkshine is offline
Reply


Thread Tools
Display Modes

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:18.


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