ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:isserver

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
functions:isserver [2017/06/19 21:16] korshunfunctions:isserver [2019/08/26 04:23] (current) – removed korshun
Line 1: Line 1:
-====== IsServer ====== 
-{{tag>zandronum info needs_examples}} 
-''bool IsServer()'' 
  
-===== Description ===== 
-Returns true if the script is running on a server. 
- 
-Any running instance of ZDoom that performs authoritative gameplay calculations is considered to be a server. 
- 
-<note tip>The same instance can be both a client and a server (e.g. in singleplayer).</note> 
- 
-The following are servers: 
-  * A singleplayer game. 
-  * A server in client-server Zandronum multiplayer (but not the clients). 
-  * A client that is also acting as a server for other clients (this mode is not supported in Zandronum yet but other game engines have it). 
-  * A player in (G)ZDoom multiplayer, which is not client-server, but makes all players run exactly the same game. 
- 
-<note important>**All** players are both servers and clients in **(G)ZDoom multiplayer**, which is not client-server.</note> 
- 
-<note warning>''!IsClient()'' is **not** equivalent to ''IsServer()''. Both can be true.</note> 
- 
-===== Examples ===== 
-Using [[IsClient]] and IsServer correctly ensures that your mod runs correctly in both singleplayer and multiplayer: 
-<code> 
-if (IsServer()) 
-{ 
-    // Run serverside gameplay code. 
-} 
-if (IsClient()) 
-{ 
-    // Draw hud, spawn effects. 
-} 
-</code> 
- 
-Use it to verify that serverside code is not run clientside, while not breaking singleplayer: 
-<code> 
-if (!IsServer()) 
-    error("This function must not be called clientside"); // does not warn in singleplayer 
-</code> 
functions/isserver.1497896199.txt.gz · Last modified: 2017/06/19 21:16 by korshun