Time for action – Using a server function
With the Use
functionality we already have a function we can test this with, so let's try it out. Since exec functions aren't called on Pawn
classes, we'll need to use AwesomePlayerController
.
Open
AwesomePlayerController
in ConTEXT.First let's write the
Use
function:exec function Use() { `log("I have been used!"); }
Compile the code, and then run the server and the client.
Press the Use key (default: E). We should see the log show up on the client:
[0011.44] ScriptLog: I have been used!
Close the client and the server.
Now that we can see the
Use
function is only called on the client, let's send a function call to the server. Let's change ourUse
function a bit:exec function Use() { `log("I have been used!"); CallTheServer(); }
Now let's write our server function:
reliable server function CallTheServer() { `log("Reliable server function called!"); }
Compile the code and run the server and the client.
Press the Use key and we should see the...