Raised This Month: $ Target: $400
 0% 

Weapon Id get WeaponName


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
uxMal
Member
Join Date: Oct 2007
Old 10-11-2009 , 14:08   Weapon Id get WeaponName
Reply With Quote #1

Uhhmm don't know why i cant find a solution but i have a weaponID and i want to get the weapon name...
pev_classname and pev_viewmodel are not working ...

pev_weaponmodel returns a huge number...

Last edited by uxMal; 10-11-2009 at 14:16.
uxMal is offline
toader_octavian
Member
Join Date: Oct 2006
Location: Romania
Old 10-11-2009 , 14:10   Re: Weapon Id get WeaponName
Reply With Quote #2

PHP Code:
new name[32]
get_weaponname WEP_IDname31 
__________________
I will be banned soon.
toader_octavian is offline
uxMal
Member
Join Date: Oct 2007
Old 10-11-2009 , 14:20   Re: Weapon Id get WeaponName
Reply With Quote #3

Hmm thanks but thats not working either

and now i know why...

I use RegisterHam(Ham_TakeDamage,"player","dmg_func ")

ham_const.inc says

Code:
/**
     * Description:        Usually called whenever an entity takes any kind of damage.
     *                    Inflictor is the entity that caused the damage (such as a gun).
     *                    Attacker is the entity that tirggered the damage (such as the gun's owner).
     * Forward params:    function(this, idinflictor, idattacker, Float:damage, damagebits);
     * Return type:        Integer.
     * Execute params:    ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, Float:damage, damagebits);
     */
    Ham_TakeDamage,
But idinflictor and idattacker are the SAME ...

I dont want to use get_user_attacker because that returns the weapon the attacker is holding currently! if i throw a he and switch to an other weapon not the he is registered as an attacker but the other weapon
uxMal is offline
toader_octavian
Member
Join Date: Oct 2006
Location: Romania
Old 10-11-2009 , 14:28   Re: Weapon Id get WeaponName
Reply With Quote #4

The best way is to hook CurWeapon event and remember the weapon each player has. When a player takes damage and (damagebits & DMG_BULLET && inflictor == attacker) is true that means that our user is shooted. Then you can get the weapon that he was shot.
PHP Code:
public fw_takedamage(victiminflictorattackerFloat:dambits)
{
 if (!(
bits DMG_BULLET && inflictor == attacker))
  return 
HAM_IGNORED

 client_print
(victimprint_chat"[TAKEDAM] Weap:%d Damage:%f"get_weapon(attacker), dam)
 return 
HAM_IGNORED

__________________
I will be banned soon.
toader_octavian is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-11-2009 , 14:29   Re: Weapon Id get WeaponName
Reply With Quote #5

pev_classname or get_weaponname( cs_get_weapon_id( idinflictor ) ...... )
Jon is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-11-2009 , 14:34   Re: Weapon Id get WeaponName
Reply With Quote #6

Also, when damage is made by a hegrenade, in that case inflictor is the grenade entity, attacker is the player, and damagebit is (or contains) 1<<24
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
uxMal
Member
Join Date: Oct 2007
Old 10-11-2009 , 14:58   Re: Weapon Id get WeaponName
Reply With Quote #7

Thanks for the help i got it working now but tell me is Ham_TakeDamage bugged ?

Why is idinflictor and idattacker the same ?
uxMal is offline
toader_octavian
Member
Join Date: Oct 2006
Location: Romania
Old 10-11-2009 , 15:00   Re: Weapon Id get WeaponName
Reply With Quote #8

No, it is not bugged.
Infilctor and attacker are the same when the damage is done by the player entity, (when you are shot by a weapon or knife).
If you are hurt by a grenade then the attacker will be the owner of the grenade and the inflictor the grenade.
__________________
I will be banned soon.
toader_octavian 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 22:41.


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