Raised This Month: $62 Target: $400
 15% 

Pick up gun owner info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 04-18-2021 , 12:18   Pick up gun owner info
Reply With Quote #1

Hi, guys!

How can I get information about the owner of the dropped weapon? Whether the skin is activated or not.
FeehSK is offline
Send a message via Skype™ to FeehSK
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-18-2021 , 22:13   Re: Pick up gun owner info
Reply With Quote #2

You can get the player who dropped it by checking the pev_owner value of the weaponbox entity. To get additional details, you can use pev_classname, pev_model, etc. If you need a specific value customer for your plugin, you can use a pev_iuser field. But be aware that other plugins may use the field and could cause conflict with yours.

PHP Code:

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

public plugin_init() 
{
    
RegisterHamHam_Touch "weaponbox" "WeaponboxTouch" true );
    
register_forwardFM_SetModel "SetModel" );
}

public 
WeaponboxTouchiEntity )
{
    static 
iOwner iOtherInfo
    
    if ( 
peviEntity pev_flags ) & FL_ONGROUND )
    {
        
iOwner peviEntity pev_owner );
        
//iOwner = player who dropped item
        
        
iOtherInfo peviEntity pev_iuser2 );
        
//iOtherInfo = value set to pev_iuser2 when item was dropped
    
}


public 
SetModeliEntity , const szModel[] )
{
    new 
szClassname32 ];
    
    
peviEntity pev_classname szClassname charsmaxszClassname ) );
    
    if ( 
equal szClassname "weaponbox" ) )
    {
        
set_peviEntity pev_iuser2 12345 );
    }

__________________

Last edited by Bugsy; 04-18-2021 at 22:15.
Bugsy is offline
Old 04-19-2021, 22:28
FeehSK
This message has been deleted by FeehSK.
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 04-19-2021 , 22:29   Re: Pick up gun owner info
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
You can get the player who dropped it by checking the pev_owner value of the weaponbox entity. To get additional details, you can use pev_classname, pev_model, etc. If you need a specific value customer for your plugin, you can use a pev_iuser field. But be aware that other plugins may use the field and could cause conflict with yours.

PHP Code:

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

public plugin_init() 
{
    
RegisterHamHam_Touch "weaponbox" "WeaponboxTouch" true );
    
register_forwardFM_SetModel "SetModel" );
}

public 
WeaponboxTouchiEntity )
{
    static 
iOwner iOtherInfo
    
    if ( 
peviEntity pev_flags ) & FL_ONGROUND )
    {
        
iOwner peviEntity pev_owner );
        
//iOwner = player who dropped item
        
        
iOtherInfo peviEntity pev_iuser2 );
        
//iOtherInfo = value set to pev_iuser2 when item was dropped
    
}


public 
SetModeliEntity , const szModel[] )
{
    new 
szClassname32 ];
    
    
peviEntity pev_classname szClassname charsmaxszClassname ) );
    
    if ( 
equal szClassname "weaponbox" ) )
    {
        
set_peviEntity pev_iuser2 12345 );
    }


Can you show me an example of what it would be like for the Y player to see the skin that X dropped?
FeehSK is offline
Send a message via Skype™ to FeehSK
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 04-27-2021 , 21:26   Re: Pick up gun owner info
Reply With Quote #4

Quote:
Originally Posted by FeehSK View Post
Can you show me an example of what it would be like for the Y player to see the skin that X dropped?
?
FeehSK is offline
Send a message via Skype™ to FeehSK
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-27-2021 , 21:43   Re: Pick up gun owner info
Reply With Quote #5

I would need to see how the the skin is applied to the weapon. Is it only set as the model?
__________________
Bugsy is offline
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 04-28-2021 , 20:30   Re: Pick up gun owner info
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
I would need to see how the the skin is applied to the weapon. Is it only set as the model?
PHP Code:
new V_MODEL[64] = "models/new/v_ak47.mdl"
new P_MODEL[64] = "models/new/p_ak47.mdl"


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

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

replace_weapon_models(idweaponid)
{
    switch (
weaponid)
    {
        case 
CSW_AK47:
        {
            if(
iSelect[id])
            {
                
set_pev(idpev_viewmodel2V_MODEL)
                
set_pev(idpev_weaponmodel2P_MODEL)
            }            
        }
    }

FeehSK is offline
Send a message via Skype™ to FeehSK
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
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 05-04-2021 , 12:38   Re: Pick up gun owner info
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
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 );
                }
            }            
        }
    }

Is it possible to make a switch with pev?
FeehSK is offline
Send a message via Skype™ to FeehSK
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-04-2021 , 17:40   Re: Pick up gun owner info
Reply With Quote #9

Of course, but why? It's either 0 or 1 in which an if-statement works fine.
__________________
Bugsy is offline
FeehSK
Junior Member
Join Date: Jul 2019
Location: MT - BRAZIL.
Old 05-04-2021 , 20:19   Re: Pick up gun owner info
Reply With Quote #10

Quote:
Originally Posted by Bugsy View Post
Of course, but why? It's either 0 or 1 in which an if-statement works fine.
I will add more skin and with that more pev. I will add 3 skins. I was wondering if you have a problem using a switch
FeehSK is offline
Send a message via Skype™ to FeehSK
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 06:55.


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