bool IsClient()
Returns true if the script is running on a client.
Any running instance of ZDoom that has display and input capabilities is considered a client.
If the instance is a client, graphics effects (clientside actors and hud) should be enabled for it.
The following are clients:
!IsClient()
is not equivalent to IsServer()
. Both can be true.
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 it 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