BetterKill: add player support

master
Drake 2 years ago
parent 40ff78a6d1
commit 2e6850c272

@ -2,7 +2,7 @@ IsRelease = false
HelpMessage = "- BetterKill\n" ..
" literally just a better kill command because Core's sucks\n" ..
"Examples:\n" ..
"Examples:\n" ..
" /bkill Player - kills the player named 'Player'\n" ..
" /bkill mtWither - kills all Withers known to the server\n"
@ -71,7 +71,7 @@ function OnCommandIssued(args, player)
for _, testMTStr in ipairs(args) do
local i = 0
local doThing = function(entity)
local doMob = function(entity)
if entity:IsMob() then
local mt = entity:GetMobType()
if (MobTypeTable[mt] == testMTStr) then
@ -83,9 +83,21 @@ function OnCommandIssued(args, player)
end
end
player:GetWorld():ForEachEntity(doThing)
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():BroadcastChatDeath("Killed " .. i .. " " .. testMTStr .. "s!")
player:GetWorld():ForEachEntity(doMob)
player:GetWorld():ForEachPlayer(doPlayer)
if (i >= 0) then
player:GetWorld():BroadcastChatDeath("Killed " .. i .. " " .. testMTStr .. "s!")
end
end

Loading…
Cancel
Save