Damage from client to server

How do I check if I’m the client or the server? And how do I properly apply the damage?