You may have noiticed in that last bit of code the [Server] attribute on the function. That means it should always be run on the server. It can be called by the client that owns the weapon.
How does the client call it?
Just like a normal function. Sandbox's engine knows you're a client and this function needs to be called on the server, so sends an network message to the server to call it.
These network functions can have multiple arguments, so you can basically use them like normal functions.
They work from server to client too.
You can make Multicast functions, these are for when you want to call the function on all clients.
User Comments