public void RpcTakeDamage(int amount, string shooterId, int killVal, int teamVal) { if (!Dead) { currentHealth -= amount; if (currentHealth <= 0) { currentHealth = 0; KillPlayer(); // TODO: fix this if (isLocalPlayer) { CmdGivePlayerMoney(shooterId, killVal, teamVal); } } if (playerUI != null) { playerUI.SetHealth((float)currentHealth / maxHealth); } } }
// Hook functions, These are called by the server // but ran on the client void OnChangeHealth(float currentHealth) { playerHealth = currentHealth; playerUI.SetHealth((int)currentHealth); }