forked from cuberite/Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kill.lua
27 lines (23 loc) · 786 Bytes
/
kill.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function HandleKillCommand( Split, Player )
if (Split[2] == nil) then
LOGINFO(Player:GetName() .. " used commands to kill themselves.")
Player:TakeDamage(dtInVoid, nil, 1000, 1000, 0)
return true
end
local HasKilled = false
local KillPlayer = function(OtherPlayer)
if (OtherPlayer:GetName() == Split[2]) then
OtherPlayer:TakeDamage(dtPlugin, nil, 1000, 1000, 0)
HasKilled = true
end
end
cRoot:Get():FindAndDoWithPlayer(Split[2], KillPlayer)
if (HasKilled) then
LOGINFO(Player:GetName() .. " used commands to kill " .. Split[2] .. ".")
SendMessageSuccess(Player, cChatColor.LightGray .. "Killed the player " .. Split[2] .. ".")
return true
else
SendMessageFailure(Player, cChatColor.LightGray .. "Couldn't find that player.")
return true
end
end