public void Execute(IRocketPlayer caller, string[] args) { if (args.Length == 1) { UnturnedPlayer other = UnturnedPlayer.FromName(args[0]); if (other == null) { UnturnedChat.Say(caller, Util.Translate("invalid_player"), Color.red); } else { UnturnedChat.Say(caller, Util.Translate("other", other.DisplayName, other.GetComponent <PvpPlayer>().PvpEnabled ? "on" : "off")); } } else { PvpPlayer p = ((UnturnedPlayer)caller).GetComponent <PvpPlayer>(); p.PvpEnabled = !p.PvpEnabled; UnturnedChat.Say(caller, Util.Translate("pvp_toggled", p.PvpEnabled ? "on" : "off")); if (p.IndicatorEnabled) { CSteamID id = ((UnturnedPlayer)caller).CSteamID; EffectManager.sendUIEffect(Util.Config().indicatorEffectId, 1201, id, true, p.PvpEnabled ? "PVP" : "PVE"); } } }
private void OnPlayerConnected(UnturnedPlayer player) { PvpPlayer p = player.GetComponent <PvpPlayer>(); if (p.IndicatorEnabled) { EffectManager.sendUIEffect(Util.Config().indicatorEffectId, 1201, player.CSteamID, true, p.PvpEnabled ? "PVP" : "PVE"); } }
public void Execute(IRocketPlayer caller, string[] args) { if (!Util.Config().enableIndicatorEffect) { UnturnedChat.Say(caller, "not_enabled", Color.red); return; } PvpPlayer p = ((UnturnedPlayer)caller).GetComponent <PvpPlayer>(); if (p.IndicatorEnabled) { EffectManager.askEffectClearByID(Util.Config().indicatorEffectId, ((UnturnedPlayer)caller).CSteamID); } else { EffectManager.sendUIEffect(Util.Config().indicatorEffectId, 1201, ((UnturnedPlayer)caller).CSteamID, true, p.PvpEnabled ? "PVP" : "PVE"); } p.IndicatorEnabled = !p.IndicatorEnabled; UnturnedChat.Say(caller, Util.Translate("indicator_toggled", p.IndicatorEnabled ? "on" : "off")); }