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

WriteByte

From Quake Wiki

void WriteByte(float type, float arg)

Usage[edit]

Writes an unsigned byte to the current network message. This is often used to denote that a server command has started, but some server commands also expect a byte as an argument.

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 server command to run or the argument. Can be [0, 255] as whole numbers only. Any of the internal svc_* constants will work, but the default exposed ones are:
  • SVC_TEMPENTITY
  • SVC_KILLEDMONSTER
  • SVC_FOUNDSECRET
  • SVC_INTERMISSION
  • SVC_FINALE
  • SVC_CDTRACK
  • SVC_SELLSCREEN

Example[edit]

// Whenever this trigger is activated, marks that a secret was found
void UseSecretTrigger()
{
    ++found_secrets;
    WriteByte(MSG_ALL, SVC_FOUNDSECRET);
    self.use = __NULL__;
}