void CC_Ent_Create( void ){ MDLCACHE_CRITICAL_SECTION(); bool allowPrecache = CBaseEntity::IsPrecacheAllowed(); CBaseEntity::SetAllowPrecache( true ); // Try to create entity CBaseEntity *entity = dynamic_cast< CBaseEntity * >( CreateEntityByName(engine->Cmd_Argv(1)) ); if (entity) { entity->Precache(); DispatchSpawn(entity); // Now attempt to drop into the world CBasePlayer* pPlayer = UTIL_GetCommandClient(); trace_t tr; Vector forward; pPlayer->EyeVectors( &forward ); UTIL_TraceLine(pPlayer->EyePosition(), pPlayer->EyePosition() + forward * MAX_TRACE_LENGTH,MASK_SOLID, pPlayer, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction != 1.0 ) { // Raise the end position a little up off the floor, place the npc and drop him down tr.endpos.z += 12; entity->Teleport( &tr.endpos, NULL, NULL ); UTIL_DropToFloor( entity, MASK_SOLID ); } } CBaseEntity::SetAllowPrecache( allowPrecache );}