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

FREE MinicopterSpawnPlugin : 1.0.0 1.0.0

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

namespace Oxide.Plugins
{
    [Info("MinicopterSpawnPlugin", "Bojack", "1.0.0")]
    [Description("Spawns a minicopter next to a player if they have enough scrap.")]
    class MinicopterSpawnPlugin : RustPlugin
    {
        private PluginConfig config;

        private class PluginConfig
        {
            public int ScrapPrice { get; set; } = 750;
        }

        private void Init()
        {
            LoadConfig();
        }

        private void LoadConfig()
        {
            config = Config.ReadObject<PluginConfig>();
            SaveConfig();
        }

        private void SaveConfig()
        {
            Config.WriteObject(config);
        }

        // Handle the 'minicopter' command
        [ChatCommand("copter")]
        private void cmdMinicopter(BasePlayer player, string command, string[] args)
        {
            // Check if the player has enough scrap
            int scrapPrice = config.ScrapPrice;
            if (player.inventory.GetAmount(-932201673) < scrapPrice)
            {
                SendReply(player, $"Вам нужно {scrapPrice} скрапа, чтобы купить миникоптер.");
                return;
            }

            // Deduct scrap price from the player's inventory
            player.inventory.Take(null, -932201673, scrapPrice);

            // Spawn a minicopter next to the player
            var playerPos = player.transform.position;
            var minicopterPos = playerPos + (player.transform.forward * 3f) + Vector3.up * 1.5f; // Spawn in front of player, slightly higher
            var minicopter = GameManager.server.CreateEntity("assets/content/vehicles/minicopter/minicopter.entity.prefab", minicopterPos);
            if (minicopter != null)
            {
                minicopter.Spawn();
                SendReply(player, "Рядом с вами появился миникоптер.!");
            }
        }

        protected override void LoadDefaultConfig()
        {
            config = new PluginConfig();
            SaveConfig();
        }
    }
}

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