summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Core/teleport.lua
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-02 15:43:46 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-02 15:43:46 +0100
commit476cd25ade814a25a0afbc5d6c5a3b5ae9060b8f (patch)
tree5174a452ff68ead6f25401a076752afa6323f591 /MCServer/Plugins/Core/teleport.lua
parentFixed gcc compilation (diff)
downloadcuberite-476cd25ade814a25a0afbc5d6c5a3b5ae9060b8f.tar
cuberite-476cd25ade814a25a0afbc5d6c5a3b5ae9060b8f.tar.gz
cuberite-476cd25ade814a25a0afbc5d6c5a3b5ae9060b8f.tar.bz2
cuberite-476cd25ade814a25a0afbc5d6c5a3b5ae9060b8f.tar.lz
cuberite-476cd25ade814a25a0afbc5d6c5a3b5ae9060b8f.tar.xz
cuberite-476cd25ade814a25a0afbc5d6c5a3b5ae9060b8f.tar.zst
cuberite-476cd25ade814a25a0afbc5d6c5a3b5ae9060b8f.zip
Diffstat (limited to 'MCServer/Plugins/Core/teleport.lua')
-rw-r--r--MCServer/Plugins/Core/teleport.lua23
1 files changed, 13 insertions, 10 deletions
diff --git a/MCServer/Plugins/Core/teleport.lua b/MCServer/Plugins/Core/teleport.lua
index 90eb3529a..b991b6185 100644
--- a/MCServer/Plugins/Core/teleport.lua
+++ b/MCServer/Plugins/Core/teleport.lua
@@ -1,23 +1,26 @@
function HandleTPCommand( Split, Player )
- if( #Split ~= 2 ) then
- Player:SendMessage( cChatColor.Green .. "Usage: /tp [PlayerName]" )
+ if( Split[2] == nil ) then
+ Player:SendMessage( cChatColor.Green .. "Usage: /tp [PlayerName] (-h)" )
return true
end
- World = Player:GetWorld()
-
local TeleportDestination = function(OtherPlayer)
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()
Player:TeleportToEntity( OtherPlayer )
Player:SendMessage( cChatColor.Green .. "You teleported to "..OtherPlayer:GetName().."!" )
- OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName().." teleported to you!" )
+ if Split[3] ~= "-h" then
+ OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName().." teleported to you!" )
+ end
end
- end
-
- if (not(World:DoWithPlayer(Split[2], TeleportDestination))) then
+ end
+ World = Player:GetWorld()
+ if (not(World:DoWithPlayer(Split[2], TeleportDestination))) then
Player:SendMessage( cChatColor.Green .. "Can't find player " .. Split[2] )
- end
+ end
return true
-end \ No newline at end of file
+end