summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Core/onkilling.lua
diff options
context:
space:
mode:
authornielsbreu@gmail.com <nielsbreu@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-24 16:44:44 +0100
committernielsbreu@gmail.com <nielsbreu@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-24 16:44:44 +0100
commit03e29802cdde309f3734ab7b6dd17ab60b9a359f (patch)
treebcc0712b29b55fa6ede3df3757f14e0c428b8af4 /MCServer/Plugins/Core/onkilling.lua
parentFixed a problem in Linux handling of ListenThread. (diff)
downloadcuberite-03e29802cdde309f3734ab7b6dd17ab60b9a359f.tar
cuberite-03e29802cdde309f3734ab7b6dd17ab60b9a359f.tar.gz
cuberite-03e29802cdde309f3734ab7b6dd17ab60b9a359f.tar.bz2
cuberite-03e29802cdde309f3734ab7b6dd17ab60b9a359f.tar.lz
cuberite-03e29802cdde309f3734ab7b6dd17ab60b9a359f.tar.xz
cuberite-03e29802cdde309f3734ab7b6dd17ab60b9a359f.tar.zst
cuberite-03e29802cdde309f3734ab7b6dd17ab60b9a359f.zip
Diffstat (limited to 'MCServer/Plugins/Core/onkilling.lua')
-rw-r--r--MCServer/Plugins/Core/onkilling.lua99
1 files changed, 81 insertions, 18 deletions
diff --git a/MCServer/Plugins/Core/onkilling.lua b/MCServer/Plugins/Core/onkilling.lua
index 19bf0ea9d..b3361355f 100644
--- a/MCServer/Plugins/Core/onkilling.lua
+++ b/MCServer/Plugins/Core/onkilling.lua
@@ -1,24 +1,87 @@
function OnKilling(Victim, Killer)
- if (Killer == nil) then
- local KilledPlayer = tolua.cast(Victim, "cPlayer")
- if( not KilledPlayer:IsA("cPlayer") or KilledPlayer == nil ) then
- return false
+ if Victim:IsPlayer() == true then
+ Server = cRoot:Get():GetServer()
+ if Killer == nil then
+ if Victim:IsOnFire() then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " burned away." )
+ CheckHardcore(Victim)
+ return false
+ end
+ if Victim:GetWorld():GetBlock(Victim:GetPosX(), Victim:GetPosY(), Victim:GetPosZ()) == 10 or Victim:GetWorld():GetBlock(Victim:GetPosX(), Victim:GetPosY(), Victim:GetPosZ()) == 11 then
+ Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " tried to swim in lava" )
+ CheckHardcore(Victim)
+ return false
+ end
+ else
+ if Killer:IsPlayer() == true then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by " .. Killer:GetName() )
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsMob() == true then
+ if Killer:IsA("cZombie") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is eaten by a zombie")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cSkeleton") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a skeleton" )
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cCreeper") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a creeper")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cSpider") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a spider")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cCaveSpider") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a cavespider")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cBlaze") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a blaze")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cEnderman") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is slain by a enderman")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cSilverfish") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a silverfish")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cSlime") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a slime")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cWitch") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a witch")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cZombiepigman") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is slain by a zombiepigman")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cMagmacube") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a magmacube")
+ CheckHardcore(Victim)
+ return false
+ elseif Killer:IsA("cWolf") then
+ Server:SendMessage( cChatColor.Red .. "Player " .. Victim:GetName() .. " is killed by a wolf")
+ CheckHardcore(Victim)
+ return false
+ end
+ end
end
+ Server:SendMessage( cChatColor.Red .. Victim:GetName() .. " Died")
+ end
+end
- local Server = cRoot:Get():GetServer()
- Server:SendMessage( cChatColor.Red .. KilledPlayer:GetName() .. " died" )
- else
- local KilledPlayer = tolua.cast(Victim, "cPlayer")
- if( not KilledPlayer:IsA("cPlayer") or KilledPlayer == nil ) then
- return false
- end
- local KillerPlayer = tolua.cast(Killer, "cPlayer")
- if( not KillerPlayer:IsA("cPlayer") or KillerPlayer == nil ) then
- return false
+function CheckHardcore(Victim)
+ if HardCore == "true" then
+ if Victim:IsPlayer() == true then
+ local KilledPlayer = tolua.cast(Victim, "cPlayer")
+ BanPlayer(KilledPlayer:GetName(), "You Died")
end
-
- local Server = cRoot:Get():GetServer()
- Server:SendMessage( cChatColor.Red .. KilledPlayer:GetName() .. " was killed by " .. KillerPlayer:GetName() .. "!" )
end
- return false
end \ No newline at end of file