Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Facepunch;
- using Rust;
- using System.Collections.Generic;
- using UnityEngine;
- namespace Oxide.Plugins
- {
- [Info("CombatLog Bug", "miRror", "1.0.0")]
- public class CombatLogBug : RustPlugin
- {
- Dictionary<int, int> kit = new Dictionary<int, int>()
- {
- { 1545779598, 1 }, // AK-47
- { -1211166256, 500 }, // 556 ammo
- };
- object CanBeWounded(BasePlayer victim, HitInfo info)
- {
- return false;
- }
- object OnPlayerDeath(BasePlayer victim, HitInfo info)
- {
- victim.Teleport(victim.transform.position);
- StripInventory(victim);
- victim.StopWounded();
- victim.health = 100f;
- foreach(var kv in kit)
- {
- GiveItem(victim, kv.Key, kv.Value);
- }
- return false;
- }
- [ChatCommand("tp")]
- void cmdChatTP(BasePlayer player, string command, string[] args)
- {
- player.Teleport(new Vector3(-1030f, 10f, -1548f));
- }
- void GiveItem(BasePlayer player, int itemid, int amount)
- {
- Item item = ItemManager.CreateByItemID(itemid, amount);
- if(item == null)
- return;
- BaseProjectile weapon = item.GetHeldEntity() as BaseProjectile;
- if(weapon != null)
- {
- weapon.primaryMagazine.contents = weapon.primaryMagazine.capacity;
- weapon.SendNetworkUpdateImmediate();
- }
- if(!item.MoveToContainer(player.inventory.containerBelt, -1, false))
- item.Remove(0f);
- }
- void StripInventory(BasePlayer player)
- {
- List<Item> itemList = Pool.GetList<Item>();
- itemList.AddRange(player.inventory.containerMain.itemList);
- itemList.AddRange(player.inventory.containerBelt.itemList);
- itemList.AddRange(player.inventory.containerWear.itemList);
- for(int i = 0; i < itemList.Count; i++)
- {
- itemList[i].RemoveFromContainer();
- itemList[i].Remove();
- }
- Pool.FreeList(ref itemList);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment