View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-13-2016 , 11:11   Re: Changing weapon models (Extended)
Reply With Quote #123

Quote:
Originally Posted by ish12321 View Post
That way I get weaponbox but I want the name of weapon ,i.e., something link weapon_ak47 or. ...

So is that possible ?
Sorry. You need to loop all slots from the box to get the weapon entity, after that you can use pev_classname on it and get what you need.
PHP Code:
RetrieveWeapon(WeaponBoxEntity

    const 
XoWeapon 4
    
new const m_rgpPlayerItems_CWeaponBox[6] = {3435, ...}
    
    new 
WeaponEntity
    
for(new 1isizeof m_rgpPlayerItems_CWeaponBoxi++) 
    { 
        
WeaponEntity get_pdata_cbase(WeaponBoxEntitym_rgpPlayerItems_CWeaponBox[i], XoWeapon
        if(
pev_valid(WeaponEntity)) 
        { 
            break
        } 
    } 

    return 
WeaponEntity

Use this stock, it returns the weapon entity index that's inside the weaponbox.
__________________
HamletEagle is offline