Weapon Icon Display - display your current weapon as an icon in your hud!
~Weapon Icon Display~
I don't know of any use of this in a game or something, but I saw it in GunGame and thought it was cool, so I opened it up, found that it was mostly just related code and really couldn't just take the 1 function that does it and put it into another file.

So, I just pretty much made this from scratch.
Modules
#include <amxmodx>
Cvars
amx_show_weapon_icon - Show the icon?
Commands
amx_weapon_icon - Command toggle wrapper for amx_show_weapon_icon
Known Bugs/Glitches- MUST COMPILE USING AMX MOD X STUDIO!!!
- Gernade sprites are scewing up - flashbang is showing part of HE, Smoke is HE gernade, sigh...
Thanks/Credits- SAMURAI16 - For his awsome User Icon Status tutorial
- XxAvalanchexX - For writing GunGame which gave me this idea
- pizzahut - use CurWeapon event instead of PlayerPreThink
- Deviance - use get_players()
Todos- Move the icon next to the time remaining (like in GunGame) - Maybe, maybe not. You can not change the color of the icon when it's next to the time display [ATTEMPTING]
- Add support for other mods/special weapons (like a rocket launcher or jetpack) [UNKNOWN]
Notes
I put this mod as Counter Strike only as I don't know if the weapon icons/id's are the same between most of the mods. CZ, maybe, but I have not tested it yet.
1st plugin!
Due to how the plugin ensures that each user has his/her own icon and keeps status of each one seperatly, players may experience a momentary delay of 1-3 secs before the icon changes to reflect their current weapon. The more players, the more likely and longer this effect. This may also happen with a rapid change of guns (ie picking up/dropping until finding desired one on an fy_ map)
Changelog
Code:
/**
* Changelog
*
* version 0.1
* - Intial Release
*
* version 0.2
* - Fixed intial blank display of status
* - Fixed on/off bug
* version 0.3
* - Added suggestion: Use else/if
* - Added suggestion: use get_players() instead of hardcoded 32
* - Added suggestion: Changed register_forward() to register_event("CurWeapon"...)
* - Added attempt to remove icon on death (remove_weapon_icon)
* version 0.4
* - Completley added get_players() (whoops :| )
* - Fixed crashing bug
* - 2nd related bug - crashed CS upon death FIXED
* - Finally posted some screenys :)
* - Reverted icon_origin to a normal variable and set it to {0,0,0}
* version 0.5 (now == 5.0 KB! ha ha ha)
* - Added "is_user_ok()" function
* - Added "add_weapon_icon()" function
* - Added "remove_weapon_icon()" function
* - Changed use of direct manipulation of cvar "amx_show_weapon_icon" to use of a pcvar instead
* - Attempt at removal of icon upon player's death #2 (with combo of attempt 1)
* - No more fakemeta depedency! (for sure)
* version 0.5c
* - Removed add_weapon_icon() function, caused the icon to continue the stay after gun change and simply add the icon to the display
* - Modified color to a lighter green, request for a different color started
* version 0.6
* - Added color changing icon to represent how much ammo is left
* - Weapon icon now is removed upon death & replaced when user spawns (for sure)
* version 1.0 (Finally! w00t)
* - Approved it! AWESOME! Thanks Hawk552!
* - Change color back to green (sorry about the purple)
* - Added notes to file with possible ideas
*/
Screenshots
1st - In the buy zone, in cs_italy and just started the map. Glock anyone?
2nd - Just bought a TMP and moved out of the buy zone