View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-16-2015 , 12:32   Re: [FAQ]armoury_entity
Reply With Quote #10

Well...yes.

remove_entity and remove_entity_name are the same thing, the last one is a stock which call remove_entity on the specified classname(it loops all ents that have the given identifier). Since remove means actually remove, using such functions on armoury_entities will make them unable to spawn on new round.
Metalicross way sets the item count to 0, so it will contain 0 weapons of it's type and make them invisible, this is the trick.

Now, why removing them make them unable to respawn ?

When the item count from an armoury is decremented to 0 the armoury will get hidden and on new round the m_iCount is restored, so the actual ent is not removed when m_iCount is 0.

Look at this decompiled code by Arkshine:
PHP Code:
void CArmoury::ArmouryTouchCBaseEntity *pOther )
{
    if( 
pOther->IsPlayer() && !pOther->m_fIsVIP )
    {
        if( 
m_iCount )
        {
            if( 
m_iItem <= 13 )
            {
                if( 
pOther->m_fHasPrimaryWeapon )
                {
                    return;
                }
                
                
m_iCount--;

                switch ( 
m_iItem )
                {
                  case 
:
                    
pOther->GiveNamedItem"weapon_mp5navy" );
                    
pOther->GiveAmmo60"9mm"120 );
                    break;
                  case 
:
                    
pOther->GiveNamedItem"weapon_tmp" );
                    
pOther->GiveAmmo60"9mm"120 );
                    break;
                  case 
:
                    
pOther->GiveNamedItem"weapon_p90" );
                    
pOther->GiveAmmo50"57mm"100 );
                    break;
                  case 
:
                    
pOther->GiveNamedItem"weapon_mac10" );
                    
pOther->GiveAmmo60"45acp"100 );
                    break;
                  case 
:
                    
pOther->GiveNamedItem"weapon_ak47" );
                    
pOther->GiveAmmo60"762Nato"90 );
                    break;
                  case 
:
                    
pOther->GiveNamedItem"weapon_sg552" );
                    
pOther->GiveAmmo60"556Nato"90 );
                    break;
                  case 
:
                    
pOther->GiveNamedItem"weapon_m4a1" );
                    
pOther->GiveAmmo60"556Nato"90 );
                    break;
                  case 
:
                    
pOther->GiveNamedItem"weapon_aug" );
                    
pOther->GiveAmmo60"556Nato"90 );
                    break;
                  case 
:
                    
pOther->GiveNamedItem"weapon_scout" );
                    
pOther->GiveAmmo30"762Nato"90 );
                    break;
                  case 
:
                    
pOther->GiveNamedItem"weapon_g3sg1" );
                    
pOther->GiveAmmo30"762Nato"90 );
                    break;
                  case 
10 :
                    
pOther->GiveNamedItem"weapon_awp" );
                    
pOther->GiveAmmo20"338Magnum"30 );
                    break;
                  case 
11 :
                    
pOther->GiveNamedItem"weapon_m3" );
                    
pOther->GiveAmmo24"buckshot"32 );
                    break;
                  case 
12 :
                    
pOther->GiveNamedItem"weapon_xm1014" );
                    
pOther->GiveAmmo24"buckshot"32 );
                    break;
                  case 
13 :
                    
pOther->GiveNamedItem"weapon_m249" );
                    
pOther->GiveAmmo60"556NatoBox"200 );
                    break;
                  default:
                    break;
                }
            }
            else
            {
                switch ( 
m_iItem )
                {
                  case 
14 :
                    if( 
pOther->AmmoInventorypOther->GetAmmoIndex"Flashbang" ) ) >= )
                        return;
                    
pOther->GiveNamedItem"weapon_flashbang" );
                    break;
                  case 
15 :
                    if( 
pOther->AmmoInventorypOther->GetAmmoIndex"HEGrenade" ) ) >= )
                        return;
                    
pOther->GiveNamedItem"weapon_hegrenade" );
                    break;
                  case 
16 :
                    if( 
m_iKevlar == )
                        return;
                    
pOther->GiveNamedItem"item_kevlar" );
                    break;
                  case 
17 :
                    if( 
m_iKevlar == )
                        return;
                    
pOther->GiveNamedItem"item_assaultsuit" );
                    break;
                  case 
18 :
                    if( 
pOther->AmmoInventorypOther->GetAmmoIndex"SmokeGrenade" ) ) >= )
                        return;
                    
pOther->GiveNamedItem"weapon_smokegrenade" );
                    break;
                  default:
                    break;
                }
                
                
m_iCount--;
            }
        }
        
        if( !
m_iCount )
        {
             
pev->effects |= EF_NODRAW;
        }
    }

PHP Code:
if( !m_iCount )
{
             
pev->effects |= EF_NODRAW;

The snippet shows that when the item count is 0 the armoury is set to invisible.
__________________

Last edited by HamletEagle; 01-16-2015 at 12:33.
HamletEagle is offline