I didn't understand your question. You want the rocket to explode when it hit objects in the world but it should not stop, instead, it will fly through the object as the spectators and will be removed when it flies out of the world "bounding box"? If so, set the entity move type to noclip as you first thought and constantly trace a monster hull. When the trace hits anything, create an explosion at the point of the collision. To determine if the entity is outside the world boundary, use CBaseEntity::IsInWorld, already implemented in engine_stocks.inc.
If you want to prevent it from exploding if it is already within the object, check if it is the first time that the trace returns true (for that particular entity if isn't -1), may fail in some conditions but I think you will be ok. Pseudo-code:
Code for testing, hit radio1 key to create a Cool Entity that will fly through everything.
Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
new g_spriteIndexLaserBeam
public plugin_init()
{
register_clcmd("radio1", "CreateCoolEntity")
register_think("my_cool_entity", "CoolEntity_Think")
}
public plugin_precache()
{
g_spriteIndexLaserBeam = precache_model("sprites/laserbeam.spr")
}
public CreateCoolEntity(index)
{
new Float:origin[3]
entity_get_vector(index, EV_VEC_origin, origin)
new entity = create_entity("info_target")
entity_set_string(entity, EV_SZ_classname, "my_cool_entity")
entity_set_int(entity, EV_INT_solid, SOLID_BBOX)
entity_set_int(entity, EV_INT_movetype, MOVETYPE_NOCLIP)
entity_set_edict(entity, EV_ENT_owner, index)
entity_set_model(entity, "models/player/sas/sas.mdl")
entity_set_size(entity, Float:{-16.0, -16.0, -16.0}, Float:{16.0, 16.0, 16.0})
entity_set_origin(entity, origin)
new Float:velocity[3]
velocity_by_aim(index, 150, velocity)
entity_set_vector(entity, EV_VEC_velocity, velocity)
entity_set_float(entity, EV_FL_nextthink, get_gametime() + 0.1)
return PLUGIN_HANDLED
}
public CoolEntity_Think(entity)
{
if (!IsInWorld(entity))
{
// Queue entity for deletion
// This is safier than removing the entity directly
entity_set_int(entity, EV_INT_flags, FL_KILLME)
entity_set_int(entity, EV_INT_effects, EF_NODRAW)
return
}
new Float:origin[3]
entity_get_vector(entity, EV_VEC_origin, origin)
static traceHandle
traceHandle = 0
engfunc(EngFunc_TraceMonsterHull, entity, origin, origin, DONT_IGNORE_MONSTERS, entity, traceHandle)
if (get_tr2(traceHandle, TR_StartSolid) || get_tr2(traceHandle, TR_AllSolid))
{
get_tr2(traceHandle, TR_vecEndPos, origin)
// Create an explosion here
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMPOINTS)
write_coord_f(origin[0])
write_coord_f(origin[1])
write_coord_f(origin[2])
write_coord_f(origin[0])
write_coord_f(origin[1])
write_coord_f(origin[2] + 9999.0)
write_short(g_spriteIndexLaserBeam)
write_byte(0)
write_byte(0)
write_byte(100)
write_byte(20)
write_byte(0)
write_byte(255)
write_byte(0)
write_byte(0)
write_byte(255)
write_byte(0)
message_end()
}
entity_set_float(entity, EV_FL_nextthink, get_gametime() + 0.1)
}