This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| functions:isclient [2017/04/15 14:22] – korshun | functions:isclient [2019/08/26 01:23] (current) – removed korshun | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== IsClient ====== | ||
| - | {{tag> | ||
| - | '' | ||
| - | ===== Description ===== | ||
| - | 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. | ||
| - | |||
| - | <note tip>The same instance can be both a client and a server (e.g. in singleplayer).</ | ||
| - | |||
| - | The following are clients: | ||
| - | * A singleplayer game. | ||
| - | * A client in client-server Zandronum multiplayer (but not the server). | ||
| - | * 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, | ||
| - | |||
| - | <note important> | ||
| - | |||
| - | ===== Examples ===== | ||
| - | 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. | ||
| - | } | ||
| - | </ | ||