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)
|
function OnKilling(Victim, Killer)
|
||||||
if Victim:IsPlayer() then
|
if Victim:IsPlayer() then
|
||||||
|
SetBackCoordinates( Victim )
|
||||||
Server = cRoot:Get():GetServer()
|
Server = cRoot:Get():GetServer()
|
||||||
if Killer == nil then
|
if Killer == nil then
|
||||||
if Victim:IsOnFire() then
|
if Victim:IsOnFire() then
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
function HandleSpawnCommand( Split, Player )
|
function HandleSpawnCommand( Split, Player )
|
||||||
World = Player:GetWorld()
|
World = Player:GetWorld()
|
||||||
X[Player:GetName()] = Player:GetPosX()
|
SetBackCoordinates( Player )
|
||||||
Y[Player:GetName()] = Player:GetPosY()
|
|
||||||
Z[Player:GetName()] = Player:GetPosZ()
|
|
||||||
Player:TeleportTo( World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ() )
|
Player:TeleportTo( World:GetSpawnX(), World:GetSpawnY(), World:GetSpawnZ() )
|
||||||
LOGINFO( Player:GetName() .. " returned to spawn." )
|
LOGINFO( Player:GetName() .. " returned to spawn." )
|
||||||
return true
|
return true
|
||||||
|
@ -8,9 +8,7 @@ function HandleTPCommand( Split, Player )
|
|||||||
if( OtherPlayer == Player ) then
|
if( OtherPlayer == Player ) then
|
||||||
Player:SendMessage( cChatColor.Green .. "Already there :)" )
|
Player:SendMessage( cChatColor.Green .. "Already there :)" )
|
||||||
else
|
else
|
||||||
X[Player:GetName()] = Player:GetPosX()
|
SetBackCoordinates( Player )
|
||||||
Y[Player:GetName()] = Player:GetPosY()
|
|
||||||
Z[Player:GetName()] = Player:GetPosZ()
|
|
||||||
Player:TeleportToEntity( OtherPlayer )
|
Player:TeleportToEntity( OtherPlayer )
|
||||||
Player:SendMessage( cChatColor.Green .. "You teleported to "..OtherPlayer:GetName().."!" )
|
Player:SendMessage( cChatColor.Green .. "You teleported to "..OtherPlayer:GetName().."!" )
|
||||||
if Split[3] ~= "-h" then
|
if Split[3] ~= "-h" then
|
||||||
|
@ -3,9 +3,7 @@ function HandleTopCommand( Split, Player )
|
|||||||
|
|
||||||
local PlayerPos = Player:GetPosition()
|
local PlayerPos = Player:GetPosition()
|
||||||
local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) )
|
local Height = World:GetHeight( math.floor(PlayerPos.x), math.floor(PlayerPos.z) )
|
||||||
X[Player:GetName()] = Player:GetPosX()
|
SetBackCoordinates( Player )
|
||||||
Y[Player:GetName()] = Player:GetPosY()
|
|
||||||
Z[Player:GetName()] = Player:GetPosZ()
|
|
||||||
Player:TeleportTo( PlayerPos.x, Height+1, PlayerPos.z )
|
Player:TeleportTo( PlayerPos.x, Height+1, PlayerPos.z )
|
||||||
Player:SendMessage("Teleported to the top block")
|
Player:SendMessage("Teleported to the top block")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user