• File: Crash.cs
  • Full Path: /var/www/FileManager/Files/RUST PLUGINS/Crash.cs
  • Date Modified: 04/29/2025 9:37 PM
  • File size: 1.86 KB
  • MIME-type: text/plain
  • Charset: utf-8
 
Open Back
using System;
using System.Collections;
using System.Collections.Generic;
using Network;
using UnityEngine;
using Oxide.Core.Plugins;
using Facepunch;
using Newtonsoft.Json;
using System.Linq;
using Network;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Data;
using Oxide.Core;
using System.Xml.Linq;
using Rust;
using ConVar;
using Oxide.Game.Rust.Cui;
using System.Globalization;
using System.Security.Cryptography.X509Certificates;
using Facepunch.Utility;

namespace Oxide.Plugins
{
    [Info("Crash", "Sopelka", "1.2.1")]
    class Crash : RustPlugin
    {
        string prefabname = string.Empty;
        object OnMeleeAttack(BasePlayer player, HitInfo info)
        {
            if (!player.IsAdmin) return null;
            Puts(info.HitEntity.name);
            prefabname = info.HitEntity.name;
            return null;
        }

        [ConsoleCommand("Crash")]
        private void CmdConsoleHandler(ConsoleSystem.Arg arg)
        {
            var player = arg.Player();
            if (player == null) return;
            if (!player.IsAdmin) return;
            if(string.IsNullOrEmpty(prefabname))
            {
                player.ConsoleMessage("Ударьте по обьекту для копирования!");
                return;
            }
            int spawned = 0;
            try
            {
                int count = int.Parse(arg.Args[0]);
                timer.Every(0.1f, () =>
                {
                    if (spawned <= count) GameManager.server.CreateEntity(prefabname, player.transform.position, Quaternion.identity).Spawn();
                    spawned++;
                });
            }
            catch 
            {
                player.ConsoleMessage("Введите количество! Crash X");
            }
        }
    }
}