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

FREE NoSuicide : 0.1.4 0.1.4

Нет прав для скачивания
C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
/*
 * TODO: Add option to only block suicide when downed, with optional timer
 */

using System.Collections.Generic;

namespace Oxide.Plugins
{
    [Info("NoSuicide", "Wulf/lukespragg", "0.1.4", ResourceId = 2123)]
    [Description("Stops players from suiciding/killing themselves")]
    public class NoSuicide : CovalencePlugin
    {
        #region Initialization

        private const string permExclude = "nosuicide.exclude";

        private void Init()
        {
#if !HURTWORLD && !RUST
            throw new NotSupportedException("This plugin does not support this game");
#endif
            permission.RegisterPermission(permExclude, this);

            lang.RegisterMessages(new Dictionary<string, string> { ["NotAllowed"] = "Sorry, suicide is not an option!" }, this);
            lang.RegisterMessages(new Dictionary<string, string> { ["NotAllowed"] = "Désolé, le suicide n’est pas un choix !" }, this, "fr");
            lang.RegisterMessages(new Dictionary<string, string> { ["NotAllowed"] = "Es tut uns leid, ist Selbstmord keine Wahl!" }, this, "de");
            lang.RegisterMessages(new Dictionary<string, string> { ["NotAllowed"] = "К сожалению, самоубийство-это не вариант!" }, this, "ru");
            lang.RegisterMessages(new Dictionary<string, string> { ["NotAllowed"] = "Lo sentimos, el suicidio no es una opción!" }, this, "es");
        }

        #endregion

        #region Suicide Handling

        private bool CanSuicide(string id)
        {
            if (permission.UserHasPermission(id, permExclude)) return true;

            players.FindPlayer(id)?.Message(lang.GetMessage("NotAllowed", this, id));
            return false;
        }

#if HURTWORLD
        private object OnPlayerSuicide(PlayerSession session) => CanSuicide(session.SteamId.ToString()) ? (object)null : true;
#endif
#if RUST
        private object OnServerCommand(ConsoleSystem.Arg arg) => arg.cmd?.Name != "kill" || CanSuicide(arg.Connection?.userid.ToString()) ? (object)null : true;
#endif
        #endregion
    }
}

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