1
0
cuberite-2a/MCServer/Plugins/Core/onkilling.lua
nielsbreu@gmail.com 03e29802cd Updated core plugin.
Added limited world. Configurable through webadmin.
Added a Manage server page in webadmin where you can reload/restart/stop the server.
You can add players to groups with the webadmin. without the player have to relog first
You can change someone's group in-game with a command, without the player have to relog first
Hardcore mode
Improved death messages

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1306 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-03-24 15:44:44 +00:00

87 lines
3.6 KiB
Lua

function OnKilling(Victim, Killer)
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
function CheckHardcore(Victim)
if HardCore == "true" then
if Victim:IsPlayer() == true then
local KilledPlayer = tolua.cast(Victim, "cPlayer")
BanPlayer(KilledPlayer:GetName(), "You Died")
end
end
end