Помощь с плагином

Захар

21 Янв 2016
4
0
6
29
Хочу чтобы получилось так: "Игрок Raymond был убит кабаном", а получается"Игрок Raymond был убит кабаном"
 
Код:
using System.Collections.Generic;
using uLink;
namespace Oxide.Plugins
{
    [Info("CustomDeathMessages", "Trentu", "1.0.4")]
    [Description("Just displays custom death messages.")]

    class CustomDeathMessages : HurtworldPlugin
    {
        protected override void LoadDefaultConfig()

        void LoadDefaultMessages()
        {
            var messages = new Dictionary<string, string>
            {
                {"EntityStats/Sources/Fall Damage","{Name} разбился насмерть"},
                {"EntityStats/Sources/Damage Over Time","{Name} just died"},
                {"EntityStats/Sources/Radiation Poisoning","{Name} just died"},
                {"EntityStats/Sources/Starvation","{Name} just died"},
                {"EntityStats/Sources/Hypothermia","{Name} just died"},
                {"EntityStats/Sources/Asphyxiation","{Name} just died"},
                {"EntityStats/Sources/Poison","{Name} just died"},
                {"EntityStats/Sources/Burning","{Name} just died"},
                {"EntityStats/Sources/Suicide","{Name} committed suicide"},
                {"EntityStats/Sources/Explosives","{Name} dead by explosion"},
                {"EntityStats/Sources/a Vehicle Impact","{Name} killed by a car"},
                {"Creatures/Tokar","{Name} got killed by Tokar"},
                {"Creatures/Shigi","{Name} got killed by a Shigi"},
                {"Creatures/Bor","{Name} got killed by a Bor"},
                {"Creatures/Yeti","{Name} got killed by a Yeti"},
                {"player","{Name} got killed by {Killer}"},
                {"Unknown","{Name} just died on a mystic way"}
            };
          
            lang.RegisterMessages(messages, this);
        }

        void Loaded() => LoadDefaultMessages();

      
        string GetNameOfObject(UnityEngine.GameObject obj){
            //NetworkView view = obj.GetComponent<uLink.NetworkView>();
            var ManagerInstance = GameManager.Instance;
            return ManagerInstance.GetDescriptionKey(obj);
        }
      
      
        object OnDeathNotice(string name, EntityEffectSourceData source)
        {
          
            string KillerName = GetNameOfObject(source.EntitySource);
            if(KillerName == ""){
                hurt.BroadcastChat((lang.GetMessage(source.SourceDescriptionKey, this) ?? lang.GetMessage("Unknown", this)).Replace("{Name}", name));
            }else{
                hurt.BroadcastChat((lang.GetMessage(source.SourceDescriptionKey, this) ?? lang.GetMessage("player", this)).Replace("{Name}", name).Replace("{Killer}", KillerName));
            }

            return true;
        }
    }
}

Вот код который у нас сейчас.
Пробовал сделать
Код:
{"EntityStats/Sources/Fall Damage","<color=#ff0000>{Name}</color> разбился насмерть"},
, не получилось.Просто никакой реакции на это. Хэлп ребята...!!!
 
Код:
using System.Collections.Generic;
using uLink;
namespace Oxide.Plugins
{
    [Info("CustomDeathMessages", "Trentu", "1.0.4")]
    [Description("Just displays custom death messages.")]

    class CustomDeathMessages : HurtworldPlugin
    {
        protected override void LoadDefaultConfig()

        void LoadDefaultMessages()
        {
            var messages = new Dictionary<string, string>
            {
                {"EntityStats/Sources/Fall Damage","{Name} разбился насмерть"},
                {"EntityStats/Sources/Damage Over Time","{Name} just died"},
                {"EntityStats/Sources/Radiation Poisoning","{Name} just died"},
                {"EntityStats/Sources/Starvation","{Name} just died"},
                {"EntityStats/Sources/Hypothermia","{Name} just died"},
                {"EntityStats/Sources/Asphyxiation","{Name} just died"},
                {"EntityStats/Sources/Poison","{Name} just died"},
                {"EntityStats/Sources/Burning","{Name} just died"},
                {"EntityStats/Sources/Suicide","{Name} committed suicide"},
                {"EntityStats/Sources/Explosives","{Name} dead by explosion"},
                {"EntityStats/Sources/a Vehicle Impact","{Name} killed by a car"},
                {"Creatures/Tokar","{Name} got killed by Tokar"},
                {"Creatures/Shigi","{Name} got killed by a Shigi"},
                {"Creatures/Bor","{Name} got killed by a Bor"},
                {"Creatures/Yeti","{Name} got killed by a Yeti"},
                {"player","{Name} got killed by {Killer}"},
                {"Unknown","{Name} just died on a mystic way"}
            };
         
            lang.RegisterMessages(messages, this);
        }

        void Loaded() => LoadDefaultMessages();

     
        string GetNameOfObject(UnityEngine.GameObject obj){
            //NetworkView view = obj.GetComponent<uLink.NetworkView>();
            var ManagerInstance = GameManager.Instance;
            return ManagerInstance.GetDescriptionKey(obj);
        }
     
     
        object OnDeathNotice(string name, EntityEffectSourceData source)
        {
         
            string KillerName = GetNameOfObject(source.EntitySource);
            if(KillerName == ""){
                hurt.BroadcastChat((lang.GetMessage(source.SourceDescriptionKey, this) ?? lang.GetMessage("Unknown", this)).Replace("{Name}", name));
            }else{
                hurt.BroadcastChat((lang.GetMessage(source.SourceDescriptionKey, this) ?? lang.GetMessage("player", this)).Replace("{Name}", name).Replace("{Killer}", KillerName));
            }

            return true;
        }
    }
}

Вот код который у нас сейчас.
Пробовал сделать
Код:
{"EntityStats/Sources/Fall Damage","<color=#ff0000>{Name}</color> разбился насмерть"},
, не получилось.Просто никакой реакции на это. Хэлп ребята...!!!
потому как код идет другой под это дело
 
Код:
using System.Collections.Generic;
using uLink;
namespace Oxide.Plugins
{
    [Info("CustomDeathMessages", "Trentu", "1.0.4")]
    [Description("Just displays custom death messages.")]

    class CustomDeathMessages : HurtworldPlugin
    {
        protected override void LoadDefaultConfig()

        void LoadDefaultMessages()
        {
            var messages = new Dictionary<string, string>
            {
                {"EntityStats/Sources/Fall Damage","{Name} разбился насмерть"},
                {"EntityStats/Sources/Damage Over Time","{Name} just died"},
                {"EntityStats/Sources/Radiation Poisoning","{Name} just died"},
                {"EntityStats/Sources/Starvation","{Name} just died"},
                {"EntityStats/Sources/Hypothermia","{Name} just died"},
                {"EntityStats/Sources/Asphyxiation","{Name} just died"},
                {"EntityStats/Sources/Poison","{Name} just died"},
                {"EntityStats/Sources/Burning","{Name} just died"},
                {"EntityStats/Sources/Suicide","{Name} committed suicide"},
                {"EntityStats/Sources/Explosives","{Name} dead by explosion"},
                {"EntityStats/Sources/a Vehicle Impact","{Name} killed by a car"},
                {"Creatures/Tokar","{Name} got killed by Tokar"},
                {"Creatures/Shigi","{Name} got killed by a Shigi"},
                {"Creatures/Bor","{Name} got killed by a Bor"},
                {"Creatures/Yeti","{Name} got killed by a Yeti"},
                {"player","{Name} got killed by {Killer}"},
                {"Unknown","{Name} just died on a mystic way"}
            };
         
            lang.RegisterMessages(messages, this);
        }

        void Loaded() => LoadDefaultMessages();

     
        string GetNameOfObject(UnityEngine.GameObject obj){
            //NetworkView view = obj.GetComponent<uLink.NetworkView>();
            var ManagerInstance = GameManager.Instance;
            return ManagerInstance.GetDescriptionKey(obj);
        }
     
     
        object OnDeathNotice(string name, EntityEffectSourceData source)
        {
         
            string KillerName = GetNameOfObject(source.EntitySource);
            if(KillerName == ""){
                hurt.BroadcastChat((lang.GetMessage(source.SourceDescriptionKey, this) ?? lang.GetMessage("Unknown", this)).Replace("{Name}", name));
            }else{
                hurt.BroadcastChat((lang.GetMessage(source.SourceDescriptionKey, this) ?? lang.GetMessage("player", this)).Replace("{Name}", name).Replace("{Killer}", KillerName));
            }

            return true;
        }
    }
}

Вот код который у нас сейчас.
Пробовал сделать
Код:
{"EntityStats/Sources/Fall Damage","<color=#ff0000>{Name}</color> разбился насмерть"},
, не получилось.Просто никакой реакции на это. Хэлп ребята...!!!
Ты пытаешься править сам плагин что ли?
Вроде как после запуска должен создаться конфиг для подмены цветов и так далее
А сам плагин зачем менять там другой язык программирования и ты туда тыкаешь html код, конечно не будет работать
 
Ты пытаешься править сам плагин что ли?
Вроде как после запуска должен создаться конфиг для подмены цветов и так далее
А сам плагин зачем менять там другой язык программирования и ты туда тыкаешь html код, конечно не будет работать
Там надо и так и так его подправлять, так как там выдает сообщение: [SERVER] Verhovniy был убит кабаном.
Во первых никаких Server мне не надо, я вырезал переменную полностью. Мне нужно добиться того, чтобы хотябы ник игрока был цветным и всё, понимаете?

Конфиг есть, там можно выбрать цвет надписи SERVER или кабан, а мне ни того, ни другого не надо. Мне игрока выделить нужно.
 
Активность
Пока никто не печатает сообщение

Похожие темы