IsRelease = false HelpMessage = "- BetterKill\n" .. " literally just a better kill command because Core's sucks\n" .. "Examples:\n" .. " /bkill Player - kills the player named 'Player'\n" .. " /bkill mtWither - kills all Withers known to the server" MobTypeTable = { [-1] = "mtInvalid", [0] = "mtBat", [1] = "mtBlaze", [3] = "mtCaveSpider", [4] = "mtChicken", [6] = "mtCow", [7] = "mtCreeper", [12] = "mtEnderDragon", [13] = "mtEnderman", [17] = "mtGhast", [18] = "mtGiant", [19] = "mtGuardian", [20] = "mtHorse", [24] = "mtIronGolem", [26] = "mtMagmaCube", [27] = "mtMooshroom", [29] = "mtOcelot", [33] = "mtPig", [34] = "mtPiglin", [35] = "mtPiglinBrute", [39] = "mtRabbit", [42] = "mtSheep", [44] = "mtSilverfish", [45] = "mtSkeleton", [46] = "mtSkeletonHorse", [47] = "mtSlime", [48] = "mtSnowGolem", [49] = "mtSpider", [50] = "mtSquid", [57] = "mtVillager", [60] = "mtWitch", [61] = "mtWither", [62] = "mtWitherSkeleton", [63] = "mtWolf", [65] = "mtZombie", [66] = "mtZombieHorse", [67] = "mtZombiePigman", [68] = "mtZombieVillager" } function Initialize(Plugin) Plugin:SetName("BetterKill") Plugin:SetVersion(1) cPluginManager.BindCommand("/bkill", "betterkill.bkill", OnCommandIssued, HelpMessage) LOG("Initalized BetterKill v" .. Plugin:GetVersion() .. (IsRelease == false and "-rc" or "")) return true end function OnCommandIssued(args, player) LOG("Trying to kill.. something") if (#args < 2) then player:SendMessage("Incorrect usage of /bkill. Please see /help bkill") return true end table.remove(args, 1) for _, testMTStr in ipairs(args) do local i = 0 local doMob = function(entity) if entity:IsMob() then local mt = entity:GetMobType() if (MobTypeTable[mt] == testMTStr) then entity:TakeDamage(17, nil, 9999999, 9999999, 0) i = i + 1 end elseif entity:IsPickup() then if (testMTStr == "mtItem") then entity:SetLifetime(0) i = i + 1 end end end local doPlayer = function(kplayer) local name = kplayer:GetName() if (name == testMTStr) then i = -1 kplayer:TakeDamage(17, nil, 9999999, 9999999, 0) return true end end player:GetWorld():ForEachEntity(doMob) player:GetWorld():ForEachPlayer(doPlayer) if (i >= 0) then player:GetWorld():BroadcastChatDeath("Killed " .. i .. " " .. testMTStr .. "s!") end end return true end