Raised This Month: $ Target: $400
 0% 

Pick up gun owner info


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 02:33.


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