public void ExecuteCommandShowCoords(IRP caller, string[] command)
 {
     if (caller is UP player)
     {
         CSteamID steamid = player.CSteamID;
         if (command.Length == 0)
         {
             dict.TryGetValue(steamid, out var value);
             if (value == 1)
             {
                 dict[steamid] = 0;
                 EffectManager.askEffectClearByID(56843, steamid);
                 UnturnedChat.Say(player, Translate("ShowCoords"), Color.green);
             }
             else
             {
                 dict[steamid] = 1;
                 var x = Math.Ceiling(player.Position.x).ToString();
                 var y = Math.Ceiling(player.Position.y).ToString();
                 var z = Math.Ceiling(player.Position.z).ToString();
                 EffectManager.sendUIEffect(56843, 3457, steamid, true, x, y, z);
                 UnturnedChat.Say(player, Translate("HideCoords"), Color.green);
             }
         }
         else
         {
             UnturnedChat.Say(player, Translate("Usage"), Color.red);
         }
     }
 }
Esempio n. 2
0
 public ManageUI(byte pagesCount, Player caller, Rocket.API.IRocketPlayer callerP)
 {
     currentPage         = 1;
     callerPlayer        = caller;
     ManageUI.PagesCount = pagesCount;// !
     UIitemsPages        = new List <List <MyItem> >();
     Instances.Add(this);
     overload    = EOverload.None;
     selectedId  = 0;
     this.caller = callerP;
 }
 public void Execute(IRP caller, string[] command)
 {
     if (caller is UP)
     {
         UP up = (UP)caller;
         if (command.Length == 1)
         {
             if (!TryFindPlayer(command[0], out UP target))
             {
                 SendChat(up, $"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", Color.white);
                 return;
             }
             target.Player.Heal();
             SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyHealedPlayer", target.CharacterName)}", Color.white);
             if (Config.MessageHeal)
             {
                 SendChat(target, $"{Instance.DefaultTranslations.Translate("YouWasHealed")}", Color.white);
             }
         }
         else if (command.Length == 0)
         {
             up.Player.Heal();
             SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyHealedYourself")}", Color.white);
         }
         else
         {
             SendChat(up, $"{Syntax}", Color.white);
         }
     }
     else
     {
         if (command.Length == 1)
         {
             if (!TryFindPlayer(command[0], out UP target))
             {
                 SendConsole($"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", ConsoleColor.White);
                 return;
             }
             target.Player.Heal();
             SendConsole($"{Instance.DefaultTranslations.Translate("SuccessfullyHealedPlayer", target.CharacterName)}", ConsoleColor.White);
             if (Config.MessageHeal)
             {
                 SendChat(target, $"{Instance.DefaultTranslations.Translate("YouWasHealed")}", Color.white);
             }
         }
         else
         {
             SendConsole($"{Syntax}", ConsoleColor.White);
         }
     }
 }
Esempio n. 4
0
        public override void Execute(IRP caller, string[] args)
        {
            var    message = Translate(caller, LangError);
            var    color   = Color.yellow;
            string lang;
            var    id = caller.GetId();

            if (args.Length == 1 && (lang = args[0]).All(x => char.IsLetter(x)))
            {
                conf.SetLanguage(id, lang);
                message = Translate(lang, LangChanged, lang);
                color   = Color.green;
            }
            caller.Say(message, color);
        }
        public void Execute(IRP caller, string[] command)
        {
            UP up = (UP)caller;

            if (command.Length == 1)
            {
                if (command[0] == "*")
                {
                    foreach (var pl in Provider.clients)
                    {
                        pl.player.Heal();
                        if (Config.MessageHeal)
                        {
                            SendChat(UP.FromSteamPlayer(pl), $"{Instance.DefaultTranslations.Translate("YouWasHealed")}", Color.white);
                        }
                    }
                    SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyHealed")}", Color.white);
                }
                else
                {
                    if (int.Parse(command[0]) > 0 && int.Parse(command[0]) <= Config.MaximumRadius)
                    {
                        var pls = Provider.clients.FindAll(x => Vector3.Distance(up.Position, UP.FromSteamPlayer(x).Position) <= int.Parse(command[0]) && x.playerID.steamID.m_SteamID != up.CSteamID.m_SteamID);
                        foreach (var pl in pls)
                        {
                            pl.player.Heal();
                            if (Config.MessageHeal)
                            {
                                SendChat(UP.FromSteamPlayer(pl), $"{Instance.DefaultTranslations.Translate("YouWasHealed")}", Color.white);
                            }
                        }
                        SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullyHealedRadius", pls.Count, command[0])}", Color.white);
                    }
                    else
                    {
                        SendChat(up, $"{Instance.DefaultTranslations.Translate("IncorrectRadius", Config.MaximumRadius)}", Color.white);
                    }
                }
            }
            else
            {
                SendChat(up, $"{Syntax}", Color.white);
            }
        }
Esempio n. 6
0
 public void Execute(IRP caller, string[] command)
 {
     if (caller is UP)
     {
         UP up = (UP)caller;
         if (command.Length == 2)
         {
             var health = int.Parse(command[1]);
             if (health == 0)
             {
                 SendChat(up, $"{Instance.DefaultTranslations.Translate("ErrorIncorrectCount")}", Color.white);
                 return;
             }
             if (!TryFindPlayer(command[0], out UP target))
             {
                 SendChat(up, $"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", Color.white);
                 return;
             }
             if (target.Health < health)
             {
                 target.Heal((byte)(health - int.Parse(target.Health.ToString())));
             }
             else
             {
                 target.Damage((byte)(int.Parse(target.Health.ToString()) - health), Vector3.zero, EDeathCause.PUNCH, ELimb.SKULL, CSteamID.Nil);
                 target.Player.life.serverSetBleeding(false);
             }
             SendChat(up, $"{Instance.DefaultTranslations.Translate("SuccessfullySetHealth", target.CharacterName, health)}", Color.white);
             if (Config.MessageSetHealth)
             {
                 SendChat(target, $"{Instance.DefaultTranslations.Translate("HealthWasChanged", health)}", Color.white);
             }
         }
         else
         {
             SendChat(up, $"{Syntax}", Color.white);
         }
     }
     else
     {
         if (command.Length == 2)
         {
             var health = int.Parse(command[1]);
             if (health == 0)
             {
                 SendConsole($"{Instance.DefaultTranslations.Translate("ErrorIncorrectCount")}", ConsoleColor.White);
                 return;
             }
             if (!TryFindPlayer(command[0], out UP target))
             {
                 SendConsole($"{Instance.DefaultTranslations.Translate("ErrorIncorrectPlayer")}", ConsoleColor.White);
                 return;
             }
             if (target.Health < health)
             {
                 target.Heal((byte)(health - int.Parse(target.Health.ToString())));
             }
             else
             {
                 target.Damage((byte)(int.Parse(target.Health.ToString()) - health), Vector3.zero, EDeathCause.KILL, ELimb.LEFT_ARM, CSteamID.Nil);
                 target.Player.life.serverSetBleeding(false);
             }
             SendConsole($"{Instance.DefaultTranslations.Translate("SuccessfullySetHealth", target.CharacterName, health)}", ConsoleColor.White);
             if (Config.MessageSetHealth)
             {
                 SendChat(target, $"{Instance.DefaultTranslations.Translate("HealthWasChanged", health)}", Color.white);
             }
         }
         else
         {
             SendConsole($"{Syntax}", ConsoleColor.White);
         }
     }
 }