********************************************************************************
* Weapon Icon Display (weapon_icon.sma)
* Copyright (C) 2008-2009 by zenix and fixed by hoboman313
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* when you downloaded AMX Mod X; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
*********************************************************************************
* For a full plugin description read: http://forums.alliedmods.net/showthread.php?t=69664
new user_icons[MAX_PLAYERS+1][16]
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("CurWeapon", "update_icon", "be", "1=1")
register_event("AmmoX", "draw_icon", "be")
register_event("DeathMsg", "event_death", "a")
pcv_iloc = register_cvar("amx_weapon_location", "1")
if( get_pcvar_num(pcv_iloc) == 0 || is_user_bot(id) )
static sprite[16], iwpn, clip, ammo
iwpn = get_user_weapon(id, clip, ammo)
static iwpn, clip, ammo, icon_color[3]
iwpn = get_user_weapon(id, clip, ammo)
// ammo check, this is for the color of the icon
if ((ammo == 0 && clip == 0))
icon_color = {255, 0, 0} // outta ammo!
else if ( ammo==0 && iwpn!=CSW_KNIFE)
icon_color = {255, 160, 0} // last clip!
icon_color = {0, 160, 0}//green icon...decent ammo
// draw the sprite itself
message_begin(MSG_ONE,iconstatus,{0,0,0},id)
write_byte(1) // status (0=hide, 1=show, 2=flash)
write_string(user_icons[id]) // sprite name
write_byte(icon_color[0]) // red
write_byte(icon_color[1]) // green
write_byte(icon_color[2]) // blue
public remove_weapon_icon(id)
message_begin(MSG_ONE,iconstatus,{0,0,0},id)
write_string(user_icons[id])
new id = read_data(2) // the dead player's ID (1-32)
new value = get_pcvar_num(pcv_iloc)
iconstatus = get_user_msgid("StatusIcon")
iconstatus = get_user_msgid("Scenario")