Quake-C Builtin Network functions

Beware: when generating messages, you had better respect the format of the existing messages. Otherwise the game clients might not be able to interpret them (and will likely crash).

The functions below all write to clients (players connected via the network, or the local player).

Global variable for network messages

Variable: msg_entity

entity	msg_entity;
If you want to send a message to just one entity e, then set msg_entity= e and send the message with flag MSG_ONE, instead of MSG_ALL.
Never used. Maybe it doesn't even work.

Builtin functions for composing network messages

Function: WriteByte

void WriteByte(float to, float value)
       to = see messages

Function: WriteChar

void WriteChar(float to, float value)
       to = see messages

Function: WriteShort

void WriteShort(float to, float value)
       to = see messages

Function: WriteLong

void WriteLong(float to, float value)
       to = see messages

Function: WriteCoord

void WriteCoord(float to, float value)
       to = see messages

Function: WriteAngle

void WriteAngle(float to, float value)
       to = see messages
This function writes a single byte, that represents 256*(angle/380).

Function: WriteString

void WriteString(float to, string value)
       to = see messages
This function writes a string, terminated by \0 (the null character in C).

Function: WriteEntity

void WriteEntity(float to, entity value)
       to = see messages
This function writes an entity reference, taking two bytes.