19.02.2020, 19:49
Calling a setPlayerHealth function on client-side will only kill the hero or npc for a client.
This action won't be synced, because it doesn't have any sense to synchronize things that are executed on the client-side.
That's why you have the server-side, calling a setPlayerHealth on server-side will cause to set a packet to every player and sync the action.
Also, consider example when calling a client-side function will automatically sync this with the server, that way server will have to TRUST the data from the client, and that's bad in most cases.
Why is it bad? Because it gives the client(s) abitility to fool the server by sending the value that client wants to send, that way client could manipulate the server actions (in some way).
The question is what are you trying to achieve?
You want to kill a player, but why do you want to make this on client-side?
This action won't be synced, because it doesn't have any sense to synchronize things that are executed on the client-side.
That's why you have the server-side, calling a setPlayerHealth on server-side will cause to set a packet to every player and sync the action.
Also, consider example when calling a client-side function will automatically sync this with the server, that way server will have to TRUST the data from the client, and that's bad in most cases.
Why is it bad? Because it gives the client(s) abitility to fool the server by sending the value that client wants to send, that way client could manipulate the server actions (in some way).
The question is what are you trying to achieve?
You want to kill a player, but why do you want to make this on client-side?