Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

WriteChar

From Quake Wiki

void WriteChar(float type, float arg)

Usage[edit]

Writes a signed byte to the current network message. This is used for server commands that expect signed byte arguments.

Parameters[edit]

  • type
The type of network message to write to. Can be one of the following:
  • MSG_BROADCAST
Send a message to every client, not caring if they receive it. This is best used for things that have no affect on the gameplay state e.g. temp entities.
  • MSG_ONE
Send a message to a single client. The client it's sent to is stored in the msg_entity global. Guarantees the client receives it.
  • MSG_ALL
Similar to MSG_BROADCAST but it guarantees every client receives it.
  • arg
The argument to write to the network message. Can be [-128, 127] as whole numbers only.

Example[edit]

// Spawn a brown particle manually
WriteByte(MSG_BROADCAST, 18);
WriteCoord(MSG_BROADCAST, pos.x);
WriteCoord(MSG_BROADCAST, pos.y);
WriteCoord(MSG_BROADCAST, pos.x);
WriteChar(MSG_BROADCAST, vel.x * 16);
WriteChar(MSG_BROADCAST, vel.y * 16);
WriteChar(MSG_BROADCAST, vel.z * 16);
WriteByte(MSG_BROADCAST, 1);
WriteByte(MSG_BROADCAST, 225);