Added a function that allows you to change the /back coordinates.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1630 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
nielsbreu@gmail.com 2013-06-28 18:43:29 +00:00
parent beb36ee149
commit cff6ff2223
5 changed files with 9 additions and 9 deletions

View File

@ -0,0 +1,5 @@
function SetBackCoordinates( Player )
X[Player:GetName()] = Player:GetPosX()
Y[Player:GetName()] = Player:GetPosY()
Z[Player:GetName()] = Player:GetPosZ()
end

View File

@ -1,5 +1,6 @@
function OnKilling(Victim, Killer)
if Victim:IsPlayer() then
SetBackCoordinates( Victim )
Server = cRoot:Get():GetServer()
if Killer == nil then
if Victim:IsOnFire() then

View File

@ -1,8 +1,6 @@
function HandleSpawnCommand( Split, Player )
World = Player:GetWorld()
X[Player:GetName()] = Player:GetPosX()
Y[Player:GetName()] = Player:GetPosY()
Z[Player:GetName()] = Player:GetPosZ()
SetBackCoordinates( Player )
Player:TeleportTo( World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ() )
LOGINFO( Player:GetName() .. " returned to spawn." )
return true

View File

@ -8,9 +8,7 @@ function HandleTPCommand( Split, Player )
if( OtherPlayer == Player ) then
Player:SendMessage( cChatColor.Green .. "Already there :)" )
else
X[Player:GetName()] = Player:GetPosX()
Y[Player:GetName()] = Player:GetPosY()
Z[Player:GetName()] = Player:GetPosZ()
SetBackCoordinates( Player )
Player:TeleportToEntity( OtherPlayer )
Player:SendMessage( cChatColor.Green .. "You teleported to "..OtherPlayer:GetName().."!" )
if Split[3] ~= "-h" then

View File

@ -3,9 +3,7 @@ function HandleTopCommand( Split, Player )
local PlayerPos = Player:GetPosition()
local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) )
X[Player:GetName()] = Player:GetPosX()
Y[Player:GetName()] = Player:GetPosY()
Z[Player:GetName()] = Player:GetPosZ()
SetBackCoordinates( Player )
Player:TeleportTo( PlayerPos.x, Height+1, PlayerPos.z )
Player:SendMessage("Teleported to the top block")