diff --git a/Assets/Scripts/Player/PlayerInteractionHandler.cs b/Assets/Scripts/Player/PlayerInteractionHandler.cs index 8f670f5..a3ff2f1 100644 --- a/Assets/Scripts/Player/PlayerInteractionHandler.cs +++ b/Assets/Scripts/Player/PlayerInteractionHandler.cs @@ -76,6 +76,16 @@ public class PlayerInteractionHandler : NetworkBehaviour shift = GameObject.Find("CameraHidden").GetComponent(); } + [ServerRpc] + public void SwitchWeaponMode() + { + GunEnabled = !GunEnabled; + if (!GunEnabled) + pistol.Disable(); + pistol.gameObject.SetActive(GunEnabled); + if (GunEnabled) + pistol.Enable(); + } // Update is called once per frame private void Update() @@ -188,6 +198,7 @@ public class PlayerInteractionHandler : NetworkBehaviour if (Input.GetButtonDown("Fire3")&&inputEnbaled) if (!IsCarrying) { + SwitchWeaponMode(); GunEnabled = !GunEnabled; if (!GunEnabled) pistol.Disable();