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
This commit is contained in:
parent
beb36ee149
commit
cff6ff2223
5
MCServer/Plugins/Core/functions.lua
Normal file
5
MCServer/Plugins/Core/functions.lua
Normal file
@ -0,0 +1,5 @@
|
||||
function SetBackCoordinates( Player )
|
||||
X[Player:GetName()] = Player:GetPosX()
|
||||
Y[Player:GetName()] = Player:GetPosY()
|
||||
Z[Player:GetName()] = Player:GetPosZ()
|
||||
end
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user