Иконка ресурса

FREE KillerName : 1.0.0 1.0.0

Нет прав для скачивания
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Plugins;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("KillerName", "дефектный чизик", "1.0.0")]
    public class KillerName : RustPlugin
    {
        private PluginConfig cfg;

        public class PluginConfig
        {
            [JsonProperty("Текст для трупа/рюкзака | Text for corpse/backpack")]
            public string text = "<color=#42beeb>{0}</color> убил <color=#42beeb>{1}</color>";
        }

        private void Init()
        {
            cfg = Config.ReadObject<PluginConfig>();
            Config.WriteObject(cfg);
        }

        protected override void LoadDefaultConfig()
        {
            Config.WriteObject(new PluginConfig(), true);
        }

        void OnPlayerCorpseSpawned(BasePlayer player, PlayerCorpse corpse)
        {
            if (player == null || corpse == null) return;
            if (player.lastAttacker == null) return;
            BasePlayer attacker = player.lastAttacker.ToPlayer();
            if (attacker == null) return;

            string text = cfg.text;
            if (!IsRealPlayer(player)) text = text.Replace("{1}", "NPC");
            else text = text.Replace("{1}", player.displayName);

            if (!IsRealPlayer(attacker)) text = text.Replace("{0}", "NPC");
            else text = text.Replace("{0}", attacker.displayName);

            corpse.playerName = text;
        }

        bool IsRealPlayer(BasePlayer player)
        {
            if (player == null) return false;
            bool real = false;
            if (player.UserIDString.StartsWith("765611")) real = true;
            return real;
        }

        BaseCorpse OnCorpsePopulate(BasePlayer npcPlayer, BaseCorpse corpse)
        {
            Puts("OnCorpsePopulate works!");
            return null;
        }
    }
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок

Другие ресурсы пользователя 15FPS

Сверху