This is an old revision of the document!
These functions enable proper multiplayer support in mods.
Note that ZDoom multiplayer is serverless, and all players run both clientside and serverside code.
bool IsClient()
– returns true if the script is running on a client (which may also be a server).bool IsServer()
– returns true if the script is running on a server (which may also be a client).bool IsClientOnly()
– returns true if the script is running on a client that is not also a server.bool IsServerOnly()
– returns true if the script is running on a server that is not also a client.
Using IsClient
and IsServer
correctly ensures that your mod runs correctly in both singleplayer and multiplayer:
if (IsServer()) { // Run serverside gameplay code. } if (IsClient()) { // Draw hud, spawn effects. }
Use IsClient
or IsServer
to verify that clientside code is not run serverside, while not breaking singleplayer:
if (!IsClient()) error("This function must not be called serverside"); // does not warn in singleplayer