Skip to content

TE_TEXTMESSAGE

GeckoN edited this page Jan 26, 2017 · 3 revisions

Basically just a game_text. Don't bother using the NetworkMessage version as the API function has the same power and can center text properly.

Parameters

Type Name Description
string test Text to display (max 512 characters)
uint8 channel Text Channel (only 0-3 are valid?)
uint16 x X position on screen. -1 should center but doesn't for some reason (yes, I've tried 65535 and int16)
uint16 y Y position on screen. -1 should center but doesn't for some reason (yes, I've tried 65535 and int16)
uint8 effect Possible effects: 0 : fade in/out 1 : flickery credits 2 : Scan in (write char by char)
Color textColor Color of the text
Color effectColor Text color during effect animation
uint16 fadeInTime Time to fade in
uint16 fadeOutTime Time to fade in
uint16 fadeInTime Time to fade out
uint16 holdTime Time to display text after the initial animation/fade in
uint16 scanTime Time between character prints when effect is "2"

API Function

void CPlayerFuncs::HudMessage(CBasePlayer@ pTargetPlayer, const HUDTextParams& in textParams, const string& in szMessage)
void CPlayerFuncs::HudMessageAll(const HUDTextParams& in textParams, const string& in szMessage)

NetworkMessage Function

void te_textmessage(string text, uint8 channel=1, uint16 x=4000, uint16 y=4000, uint8 effect=2,
    Color textColor=WHITE, Color effectColor=PURPLE, uint16 fadeInTime=16, 
    uint16 fadeOutTime=16, uint16 holdTime=300, uint16 scanTime=20,
    NetworkMessageDest msgType=MSG_BROADCAST, edict_t@ dest=null)
{
    NetworkMessage m(msgType, NetworkMessages::SVC_TEMPENTITY, dest);
    m.WriteByte(TE_TEXTMESSAGE);
    m.WriteByte(channel);
    m.WriteShort(x);
    m.WriteShort(y);
    m.WriteByte(effect);
    m.WriteByte(textColor.r);
    m.WriteByte(textColor.g);
    m.WriteByte(textColor.b);
    m.WriteByte(textColor.a);
    m.WriteByte(effectColor.r);
    m.WriteByte(effectColor.g);
    m.WriteByte(effectColor.b);
    m.WriteByte(effectColor.a);
    m.WriteShort(fadeInTime);
    m.WriteShort(fadeOutTime);
    m.WriteShort(holdTime);
    if (effect == 2 and scanTime > 0) 
        m.WriteShort(scanTime);
    m.WriteString(text);
    m.End();
}

Clone this wiki locally