ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


client_server_detection

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
client_server_detection [2019/09/05 23:46] – [How it works] korshunclient_server_detection [2019/09/05 23:54] (current) – [Writing robust multiplayer code] korshun
Line 43: Line 43:
 { {
     // Draw hud, spawn effects.     // Draw hud, spawn effects.
 +}
 +</code>
 +
 +You can also make sure that a serverside-only function is not called on the client, and a clientside-only function is not called on the server.
 +
 +<code>
 +function ServersideOnlyFunction(void)
 +{
 +    // writing if (IsClient()) would incorrectly display the warning in singleplayer.
 +    if (!IsServer())
 +        printbold(s:"Error: ServersideOnlyFunction was called clientside");
 +        
 +    ...
 +}
 +
 +function ClientsideOnlyFunction(void)
 +{
 +    // writing if (IsServer()) would incorrectly display the warning in singleplayer.
 +    if (!IsClient())
 +        printbold(s:"Error: ClientsideOnlyFunction was called serverside");
 +        
 +    ...
 } }
 </code> </code>
client_server_detection.1567716375.txt.gz · Last modified: 2019/09/05 23:46 by korshun