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

Weapon Icon Display ( zenix )


Post New Thread Reply   
 
Thread Tools Display Modes
Chef^^
Junior Member
Join Date: Jan 2007
Old 09-21-2008 , 10:15   Re: Weapon Icon Display ( zenix )
Reply With Quote #21

Could it be made so I could see which weapons my teammates have on the stats (tab default key) ?
Chef^^ is offline
analogg
Junior Member
Join Date: Sep 2009
Location: Ukraine
Old 09-26-2009 , 18:36   Re: Weapon Icon Display ( zenix )
Reply With Quote #22

i have this error: [AMXX] Run time error 4 (plugin "weapon_icon.amxx") - debug not enabled!
Server Build: <4554>
AmxModX: 1.8.1
analogg is offline
P4rD0nM3
Veteran Member
Join Date: Feb 2006
Old 02-01-2010 , 22:46   Re: Weapon Icon Display ( zenix )
Reply With Quote #23

Can someone make recompile this plug-in for me so that the grenades don't show up (so I wont' see the ugly bug).
P4rD0nM3 is offline
= Cyber =
Member
Join Date: Nov 2009
Location: Bekasi, West Java
Old 02-07-2010 , 06:48   Re: Weapon Icon Display ( zenix )
Reply With Quote #24

thanks i find this for a long time
= Cyber = is offline
EVG^
New Member
Join Date: Jun 2010
Old 06-19-2010 , 13:33   Re: Weapon Icon Display ( zenix )
Reply With Quote #25

There is a grenade bug. It shows 1 and half of grenade. Could you fix it?
__________________
EVG^ :evil:
EVG^ is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-19-2010 , 13:41   Re: Weapon Icon Display ( zenix )
Reply With Quote #26

Quote:
Originally Posted by EVG^ View Post
There is a grenade bug. It shows 1 and half of grenade. Could you fix it?
That is sprite bug not a plugin
__________________
xPaw is offline
m16god
Member
Join Date: Feb 2010
Old 07-11-2010 , 14:51   Re: Weapon Icon Display ( zenix )
Reply With Quote #27

urmm, i tried to edit this into half life deathmatch but its not working, correct weapon name and its sprite. can anyone help me? here's the sma

edit:here's the error log (with debug)
Code:
L 07/12/2010 - 02:44:30: Start of error session.
L 07/12/2010 - 02:44:30: Info (map "crossfire") (file "addons/amxmodx/logs/error_20100712.log")
L 07/12/2010 - 02:44:30: Plugin called message_begin with an invalid message id (0).
L 07/12/2010 - 02:44:30: [AMXX] Displaying debug trace (plugin "weapon_icon.amxx")
L 07/12/2010 - 02:44:30: [AMXX] Run time error 10: native error (native "message_begin")
L 07/12/2010 - 02:44:30: [AMXX]    [0] weapon_icon.sma::draw_icon (line 101)
L 07/12/2010 - 02:44:30: Plugin called message_begin with an invalid message id (0).
L 07/12/2010 - 02:44:30: [AMXX] Displaying debug trace (plugin "weapon_icon.amxx")
L 07/12/2010 - 02:44:30: [AMXX] Run time error 10: native error (native "message_begin")
L 07/12/2010 - 02:44:30: [AMXX]    [0] weapon_icon.sma::draw_icon (line 101)
L 07/12/2010 - 02:44:30: Plugin called message_begin with an invalid message id (0).
L 07/12/2010 - 02:44:30: [AMXX] Displaying debug trace (plugin "weapon_icon.amxx")
L 07/12/2010 - 02:44:30: [AMXX] Run time error 10: native error (native "message_begin")
L 07/12/2010 - 02:44:30: [AMXX]    [0] weapon_icon.sma::draw_icon (line 101)
L 07/12/2010 - 02:44:30: Plugin called message_begin with an invalid message id (0).
L 07/12/2010 - 02:44:30: [AMXX] Displaying debug trace (plugin "weapon_icon.amxx")
L 07/12/2010 - 02:44:30: [AMXX] Run time error 10: native error (native "message_begin")
L 07/12/2010 - 02:44:30: [AMXX]    [0] weapon_icon.sma::draw_icon (line 101)
L 07/12/2010 - 02:44:30: Plugin called message_begin with an invalid message id (0).
L 07/12/2010 - 02:44:30: [AMXX] Displaying debug trace (plugin "weapon_icon.amxx")
L 07/12/2010 - 02:44:30: [AMXX] Run time error 10: native error (native "message_begin")
L 07/12/2010 - 02:44:30: [AMXX]    [0] weapon_icon.sma::remove_weapon_icon (line 113)
L 07/12/2010 - 02:44:30: [AMXX]    [1] weapon_icon.sma::update_icon (line 33)
L 07/12/2010 - 02:44:31: Plugin called message_begin with an invalid message id (0).
L 07/12/2010 - 02:44:31: [AMXX] Displaying debug trace (plugin "weapon_icon.amxx")
L 07/12/2010 - 02:44:31: [AMXX] Run time error 10: native error (native "message_begin")
L 07/12/2010 - 02:44:31: [AMXX]    [0] weapon_icon.sma::remove_weapon_icon (line 113)
L 07/12/2010 - 02:44:31: [AMXX]    [1] weapon_icon.sma::update_icon (line 33)
Attached Files
File Type: sma Get Plugin or Get Source (weapon_icon.sma - 893 views - 2.8 KB)

Last edited by m16god; 07-11-2010 at 14:53. Reason: provide error log
m16god is offline
luxyaself
Junior Member
Join Date: Aug 2010
Old 09-04-2010 , 04:53   Re: Weapon Icon Display ( zenix )
Reply With Quote #28

Changed the plugin though that alle nades show the HE-GREN icon and not the buged flashbang icon.

Code:
/*
********************************************************************************
*  AMX Mod X script.
*
*   Weapon Icon Display (weapon_icon.sma)
*   Copyright (C) 2008-2009 by zenix, fixed by hoboman313 and reedited by lux
*
*   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
*   version.
*
*********************************************************************************
*/

/*
* For a full plugin description read: http://forums.alliedmods.net/showthread.php?t=69664
*/

#include <amxmodx>

#define PLUGIN "Weapon Icon"
#define VERSION "1.2"
#define AUTHOR "hoboman313/Zenix"

#define MAX_PLAYERS 32

new iconstatus, pcv_iloc
new user_icons[MAX_PLAYERS+1][16]


public plugin_init() 
{
    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")
    
    check_icon_loc()
}

public update_icon(id) 
{
    remove_weapon_icon(id)
    
    check_icon_loc()
        
    if( get_pcvar_num(pcv_iloc) == 0 || is_user_bot(id) )
        return
        
    static sprite[16], iwpn, clip, ammo

    iwpn = get_user_weapon(id, clip, ammo)
    
    switch(iwpn) 
    {
        case CSW_P228: 
        sprite = "d_p228"
        case CSW_SCOUT: 
        sprite = "d_scout"
        case CSW_HEGRENADE: 
        sprite = "d_grenade"
        case CSW_XM1014:
        sprite = "d_xm1014"
        case CSW_MAC10: 
        sprite = "d_mac10"
        case CSW_AUG: 
        sprite = "d_aug"
        case CSW_SMOKEGRENADE: 
        sprite = "d_grenade"
        case CSW_ELITE: 
        sprite = "d_elite"
        case CSW_FIVESEVEN: 
        sprite = "d_fiveseven"
        case CSW_UMP45: 
        sprite = "d_ump45"
        case CSW_SG550: 
        sprite = "d_sg550"
        case CSW_GALIL: 
        sprite = "d_galil"
        case CSW_FAMAS: 
        sprite = "d_famas"
        case CSW_USP: 
        sprite = "d_usp"
        case CSW_MP5NAVY: 
        sprite = "d_mp5navy"
        case CSW_M249: 
        sprite = "d_m249"
        case CSW_M3: 
        sprite = "d_m3"
        case CSW_M4A1: 
        sprite = "d_m4a1"
        case CSW_TMP: 
        sprite = "d_tmp"
        case CSW_G3SG1: 
        sprite = "d_g3sg1"
        case CSW_FLASHBANG:
        sprite = "d_grenade"
        case CSW_DEAGLE: 
        sprite = "d_deagle"
        case CSW_SG552: 
        sprite = "d_sg552"
        case CSW_AK47: 
        sprite = "d_ak47"
        case CSW_KNIFE: 
        sprite = "d_knife"
        case CSW_P90: 
        sprite = "d_p90"
        case CSW_GLOCK18: 
        sprite = "d_glock18"
        case CSW_AWP: 
        sprite = "d_awp"
        default: 
        return
    }    
    user_icons[id] = sprite
    
    draw_icon(id)
    
    return
} 


public draw_icon(id)
{
    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!
    else 
        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
    message_end()
}


public remove_weapon_icon(id) 
{
    message_begin(MSG_ONE,iconstatus,{0,0,0},id)
    write_byte(0)
    write_string(user_icons[id])
    message_end()
}


public event_death() 
{
    new id = read_data(2) // the dead player's ID (1-32)
    
    if (!is_user_bot(id)) 
        remove_weapon_icon(id) 
}


public check_icon_loc() 
{
    new value = get_pcvar_num(pcv_iloc)
    
    if (value == 1)
        iconstatus = get_user_msgid("StatusIcon")
    else if (value == 2)
        iconstatus = get_user_msgid("Scenario")
    else
        iconstatus = 0
    
    return PLUGIN_CONTINUE
}
Also someone wanted to have a version where all icons are green:
Code:
/*
********************************************************************************
*  AMX Mod X script.
*
*   Weapon Icon Display (weapon_icon.sma)
*   Copyright (C) 2008-2009 by zenix, fixed by hoboman313 and reedited by lux
*
*   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
*   version.
*
*********************************************************************************
*/

/*
* For a full plugin description read: http://forums.alliedmods.net/showthread.php?t=69664
*/

#include <amxmodx>

#define PLUGIN "Weapon Icon"
#define VERSION "1.2"
#define AUTHOR "hoboman313/Zenix"

#define MAX_PLAYERS 32

new iconstatus, pcv_iloc
new user_icons[MAX_PLAYERS+1][16]


public plugin_init() 
{
    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")
    
    check_icon_loc()
}

public update_icon(id) 
{
    remove_weapon_icon(id)
    
    check_icon_loc()
        
    if( get_pcvar_num(pcv_iloc) == 0 || is_user_bot(id) )
        return
        
    static sprite[16], iwpn, clip, ammo

    iwpn = get_user_weapon(id, clip, ammo)
    
    switch(iwpn) 
    {
        case CSW_P228: 
        sprite = "d_p228"
        case CSW_SCOUT: 
        sprite = "d_scout"
        case CSW_HEGRENADE: 
        sprite = "d_grenade"
        case CSW_XM1014:
        sprite = "d_xm1014"
        case CSW_MAC10: 
        sprite = "d_mac10"
        case CSW_AUG: 
        sprite = "d_aug"
        case CSW_SMOKEGRENADE: 
        sprite = "d_grenade"
        case CSW_ELITE: 
        sprite = "d_elite"
        case CSW_FIVESEVEN: 
        sprite = "d_fiveseven"
        case CSW_UMP45: 
        sprite = "d_ump45"
        case CSW_SG550: 
        sprite = "d_sg550"
        case CSW_GALIL: 
        sprite = "d_galil"
        case CSW_FAMAS: 
        sprite = "d_famas"
        case CSW_USP: 
        sprite = "d_usp"
        case CSW_MP5NAVY: 
        sprite = "d_mp5navy"
        case CSW_M249: 
        sprite = "d_m249"
        case CSW_M3: 
        sprite = "d_m3"
        case CSW_M4A1: 
        sprite = "d_m4a1"
        case CSW_TMP: 
        sprite = "d_tmp"
        case CSW_G3SG1: 
        sprite = "d_g3sg1"
        case CSW_FLASHBANG:
        sprite = "d_grenade"
        case CSW_DEAGLE: 
        sprite = "d_deagle"
        case CSW_SG552: 
        sprite = "d_sg552"
        case CSW_AK47: 
        sprite = "d_ak47"
        case CSW_KNIFE: 
        sprite = "d_knife"
        case CSW_P90: 
        sprite = "d_p90"
        case CSW_GLOCK18: 
        sprite = "d_glock18"
        case CSW_AWP: 
        sprite = "d_awp"
        default: 
        return
    }    
    user_icons[id] = sprite
    
    draw_icon(id)
    
    return
} 


public draw_icon(id)
{
    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 = {0, 160, 0} // outta ammo!
    else if ( ammo==0 && iwpn!=CSW_KNIFE)
        icon_color = {0, 160, 0} // last clip!
    else 
        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
    message_end()
}


public remove_weapon_icon(id) 
{
    message_begin(MSG_ONE,iconstatus,{0,0,0},id)
    write_byte(0)
    write_string(user_icons[id])
    message_end()
}


public event_death() 
{
    new id = read_data(2) // the dead player's ID (1-32)
    
    if (!is_user_bot(id)) 
        remove_weapon_icon(id) 
}


public check_icon_loc() 
{
    new value = get_pcvar_num(pcv_iloc)
    
    if (value == 1)
        iconstatus = get_user_msgid("StatusIcon")
    else if (value == 2)
        iconstatus = get_user_msgid("Scenario")
    else
        iconstatus = 0
    
    return PLUGIN_CONTINUE
}
Attached Files
File Type: zip weapon_icon_nade_fix.zip (4.8 KB, 363 views)
File Type: zip weapon_icon_nade_fix_1all_green.zip (4.8 KB, 355 views)
luxyaself is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 10-02-2010 , 14:52   Re: Weapon Icon Display ( zenix )
Reply With Quote #29

cool
.Dare Devil. is offline
SpyDevil
BANNED
Join Date: Jul 2010
Location: TURKiYE
Old 10-16-2010 , 14:51   Re: Weapon Icon Display ( zenix )
Reply With Quote #30

there is a bug in this plugin. Server crashes...
SpyDevil is offline
Send a message via ICQ to SpyDevil Send a message via MSN to SpyDevil
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 13:45.


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