Quote:
Originally Posted by Bugsy
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_forward( FM_SetModel , "SetModel" );
RegisterHam( Ham_AddPlayerItem , "player" , "AddPlayerItem" );
}
public SetModel( iEntity , const szModel[] )
{
new szClassname[ 32 ] , iWeaponEntID , iWeaponSlot;
pev( iEntity , pev_classname , szClassname , charsmax( szClassname ) );
if ( equal ( szClassname , "weaponbox" ) )
{
if ( pev_valid( ( iWeaponEntID = GetWeaponEntityFromWeaponbox( iEntity , iWeaponSlot ) ) ) )
{
set_pev( iWeaponEntID , pev_iuser2 , cs_get_user_bpammo( pev( iEntity , pev_owner ) , cs_get_weapon_id( iWeaponEntID ) ) );
}
}
}
public AddPlayerItem( iPlayer , iEntity )
{
new iBPAmmo = pev( iEntity , pev_iuser2 );
if ( iBPAmmo )
{
cs_set_user_bpammo( iPlayer , cs_get_weapon_id( iEntity ) , iBPAmmo );
}
}
GetWeaponEntityFromWeaponbox( iWeaponBox , &iWeaponSlot )
{
new const m_rgpPlayerItems_Weaponbox[ 6 ] = { 34 , 35 , ... };
new iWeaponEntID;
for ( new WeaponSlots:iSlot = Slot1 ; iSlot <= Slot2 ; iSlot++ )
{
if ( ( iWeaponEntID = get_pdata_cbase( iWeaponBox , m_rgpPlayerItems_Weaponbox[ 0 ] + _:iSlot ) ) > 0 )
{
iWeaponSlot = _:iSlot;
break;
}
}
return ( iWeaponEntID > 0 ) ? 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.