Difference between revisions of "TE PLAYERATTACHMENT"

From Sven Co-op
Jump to navigation Jump to search
(Created page with "Attaches a sprite or model to the target player. frame|TE_PLAYERATTACHMENT A CBasePlayer method exists: <code>void ShowOverheadSprite(const s...")
 
m
 
Line 23: Line 23:
 
* <code>string sprite</code> Sprite to display (alpha transparency)
 
* <code>string sprite</code> Sprite to display (alpha transparency)
 
* <code>uint16 life</code> Time to display the attachement (seconds * 0.1)
 
* <code>uint16 life</code> Time to display the attachement (seconds * 0.1)
 +
[[Category:Scripting]]

Latest revision as of 17:23, 31 May 2025

Attaches a sprite or model to the target player.

TE_PLAYERATTACHMENT

A CBasePlayer method exists: void ShowOverheadSprite(const string& in szSpriteName, const float flZOffset, const float flLifeTime)

void te_playerattachment(CBasePlayer@ target, float vOffset=51.0f, 
	string sprite="sprites/bubble.spr", uint16 life=16, 
	NetworkMessageDest msgType=MSG_BROADCAST, edict_t@ dest=null)
{
	NetworkMessage m(msgType, NetworkMessages::SVC_TEMPENTITY, dest);
	m.WriteByte(TE_PLAYERATTACHMENT);
	m.WriteByte(target.entindex());
	m.WriteCoord(vOffset);
	m.WriteShort(g_EngineFuncs.ModelIndex(sprite));
	m.WriteShort(life);
	m.End();
}
  • CBasePlayer@ target Player to attach the sprite/model to
  • float vOffset Vertical sprite offset relative to the player's origin
  • string sprite Sprite to display (alpha transparency)
  • uint16 life Time to display the attachement (seconds * 0.1)