lo

I've got a slight problem, we are using an ammo box much like Firearms to
let ppl rearm and get more armor etc, however try as I might I cant get the
thing to accept 'use' messages
After a bit of trying I got the thing solid, which is a step in the right
direction.. but it wont let me use it :(

Anyone got any pointers as looking thought the HL code aint helpped me at
all.

Code follows :

class CAmmoclass : public CBaseToggle
{
 void Spawn( void );
 void Precache( void );
// void KeyValue( KeyValueData *pkvd );
 void EXPORT AmmoUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
USE_TYPE useType, float value );
};

void CAmmoclass::Precache( void )
{
 PRECACHE_MODEL( "models/ammobox.mdl" );
}

void CAmmoclass::Spawn( void )
{
 Precache();

 SET_MODEL( ENT(pev), "models/ammobox.mdl" );

    UTIL_SetOrigin( pev, pev->origin );
    UTIL_SetSize( pev, Vector(-34, -25, 0), Vector(34, 25, 36) );
// onlyway I could make the boxes solid
    pev->solid = SOLID_BBOX;
 pev->movetype = MOVETYPE_PUSHSTEP;

 SetUse ( AmmoUse );

}

void CAmmoclass::AmmoUse(CBaseEntity *pActivator, CBaseEntity *pCaller,
USE_TYPE useType, float value )
{
 // Make sure that we have a caller - commented out for test reasons
/* if (!pActivator)
  return;
 // if it's not a player, ignore
 if ( !pActivator->IsPlayer() )
  return;

 // Erads dont use these boxes
// if (pActivator->m_iPlayerClass == CLASS_ERAD)
  return;
*/ ALERT(at_console, "Rearming!\n");
 // if we've made it here we are a human
 // so we need to display the rearm/change class menu
 pActivator->ShowMenu ( 0x3FF, 0, 0, "#Rearm" );
 pActivator->m_iMenuid = MENU_REARM;

}
LINK_ENTITY_TO_CLASS(func_ammoclass, CAmmoclass)
LINK_ENTITY_TO_CLASS(func_dave, CAmmoclass)

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to