View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-28-2021 , 22:18   Re: Pick up gun owner info
Reply With Quote #7

Try this.. when a weapon is touched/picked up, check the pev_iuser2 value of the entity [ pev( [entity id] , pev_iuser2 ) ], if it's 1, then it had the model set. If your plugin removes the models, then be sure to call set_pev( iEntID , pev_iuser2 , 0 ) on it.
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define m_pActiveItem 373
#define XO_PLAYER 5

new V_MODEL[64] = "models/new/v_ak47.mdl"
new P_MODEL[64] = "models/new/p_ak47.mdl"

new iSelectMAX_PLAYERS ];

public 
plugin_init()
{
    
register_event("CurWeapon","CurrentWeapon","be","1=1")
}

public 
CurrentWeapon(id)
{
    
replace_weapon_models(idread_data(2))
}

replace_weapon_models(idweaponid)
{
    new 
iEntID;
    
    switch ( 
weaponid )
    {
        case 
CSW_AK47:
        {
            if ( 
iSelectid ] )
            {
                
set_pev(idpev_viewmodel2V_MODEL)
                
set_pev(idpev_weaponmodel2P_MODEL)

                if ( ( 
iEntID get_pdata_cbaseid m_pActiveItem XO_PLAYER ) ) > 
                {
                    
set_peviEntID pev_iuser2 );
                }
            }            
        }
    }

__________________

Last edited by Bugsy; 04-28-2021 at 22:22.
Bugsy is offline