Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "WriteByte"
From Quake Wiki
(Created page with "''void'' '''WriteByte'''(''float'' type, ''float'' cmd) == Usage == Writes an unsigned byte to the current network message. This is often used to denote that a server command...") |
m |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | ''void'' '''WriteByte'''(''float'' type, ''float'' | + | ''void'' '''WriteByte'''(''float'' type, ''float'' arg) |
== Usage == | == Usage == | ||
− | Writes an unsigned byte to the current network message. This is often used to denote that a server command has started. | + | 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 == | == Parameters == | ||
Line 13: | Line 13: | ||
:*<code>MSG_ALL</code> | :*<code>MSG_ALL</code> | ||
::Similar to <code>MSG_BROADCAST</code> but it guarantees every client receives it. | ::Similar to <code>MSG_BROADCAST</code> but it guarantees every client receives it. | ||
− | *'' | + | *''arg'' |
− | :The server command to run. Any of the internal '''svc_*''' constants will work, but the default exposed ones are: | + | :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: |
:*<code>SVC_TEMPENTITY</code> | :*<code>SVC_TEMPENTITY</code> | ||
:*<code>SVC_KILLEDMONSTER</code> | :*<code>SVC_KILLEDMONSTER</code> |
Latest revision as of 16:23, 1 August 2023
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__; }