View Single Post
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 06-11-2022 , 13:34   Re: (Request) Is still impossible to pick up more than 1 weapon?
Reply With Quote #38

Quote:
Originally Posted by Bugsy View Post
Hardly tested
PHP Code:

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

new const Version[] = "0.1";

enum WeaponSlots
{
    
Slot1 1,
    
Slot2
}
    
public 
plugin_init() 
{
    
register_plugin"Drop BP Ammo with Weapon" Version "bugsy" );
   
    
register_forwardFM_SetModel "SetModel" );
    
RegisterHamHam_AddPlayerItem "player" "AddPlayerItem" );
}

public 
SetModeliEntity , const szModel[] )
{
    new 
szClassname32 ] , iWeaponEntID iWeaponSlot;
    
    
peviEntity pev_classname szClassname charsmaxszClassname ) );
    
    if ( 
equal szClassname "weaponbox" ) )
    {
        if ( 
pev_valid( ( iWeaponEntID GetWeaponEntityFromWeaponboxiEntity iWeaponSlot ) ) ) )
        {
            
set_peviWeaponEntID pev_iuser2 cs_get_user_bpammopeviEntity pev_owner ) , cs_get_weapon_idiWeaponEntID ) ) );
        }
    }


public 
AddPlayerItemiPlayer iEntity )
{
    new 
iBPAmmo peviEntity pev_iuser2 );
    
    if ( 
iBPAmmo )
    {
        
cs_set_user_bpammoiPlayer cs_get_weapon_idiEntity ) , iBPAmmo );
    }
}

GetWeaponEntityFromWeaponboxiWeaponBox , &iWeaponSlot )
{
    new const 
m_rgpPlayerItems_Weaponbox] = { 34 35 , ... };
    new 
iWeaponEntID;

    for ( new 
WeaponSlots:iSlot Slot1 iSlot <= Slot2 iSlot++ )
    {
        if ( ( 
iWeaponEntID get_pdata_cbaseiWeaponBox m_rgpPlayerItems_Weaponbox] + _:iSlot ) ) > )
        {
            
iWeaponSlot _:iSlot;
            break;
        }
    }    
    
    return ( 
iWeaponEntID ) ? iWeaponEntID 0;

Thanks for your time and effort.

Do you think this or the other version have something in the code that could make the following bug?:

"a primary weapon after firing and getting its clip emptied, it wont reload even if you press R, till you switch to other weapon and back"

can your code possibly cause that, or is there no remote chance and should i look somewhere else?
your expert opinion will help me debug this since that bug does not happen frequently and i am unable to reproduce at will.

Thank you.
Ark_Procession is offline