Skip to content

TE_PROJECTILE

wootguy edited this page Nov 29, 2025 · 4 revisions

Shoots a model in some direction. The model has no gravity and kills itself after colliding with an entity or the world.

Parameters

Type Name Description
Vector pos Center point for the effect
Vector velocity Speed and direction of the model
CBaseEntity* owner If set, the projectile will not collide with this entity.
const char* model Model to display
uint8_t life Time to display model (seconds * 0.1)

Example Usage

void te_projectile(Vector pos, Vector velocity, CBaseEntity* owner=NULL, 
    const char* model="models/grenade.mdl", uint8_t life=1, 
    int msgType=MSG_BROADCAST, edict_t* dest=NULL)
{
    int ownerId = owner == NULL ? 0 : owner->entindex();
    MESSAGE_BEGIN(msgType, SVC_TEMPENTITY, dest);
    WRITE_BYTE(TE_PROJECTILE);
    WRITE_COORD(pos.x);
    WRITE_COORD(pos.y);
    WRITE_COORD(pos.z);
    WRITE_COORD(velocity.x);
    WRITE_COORD(velocity.y);
    WRITE_COORD(velocity.z);
    WRITE_SHORT(MODEL_INDEX(model));
    WRITE_BYTE(life);
    WRITE_BYTE(ownerId);
    MESSAGE_END();
}

Clone this wiki locally