summaryrefslogtreecommitdiffstats
path: root/Plugins
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-13 19:22:58 +0200
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-13 19:22:58 +0200
commitf4b66cbbdbcf26461fb7104339d5d6460193029d (patch)
tree7c156f4a80c8a79495c6ea55a0b9f519341ce223 /Plugins
parentThe gamemode is now only saved if it is different from the current gamemode. (diff)
downloadcuberite-f4b66cbbdbcf26461fb7104339d5d6460193029d.tar
cuberite-f4b66cbbdbcf26461fb7104339d5d6460193029d.tar.gz
cuberite-f4b66cbbdbcf26461fb7104339d5d6460193029d.tar.bz2
cuberite-f4b66cbbdbcf26461fb7104339d5d6460193029d.tar.lz
cuberite-f4b66cbbdbcf26461fb7104339d5d6460193029d.tar.xz
cuberite-f4b66cbbdbcf26461fb7104339d5d6460193029d.tar.zst
cuberite-f4b66cbbdbcf26461fb7104339d5d6460193029d.zip
Diffstat (limited to '')
-rw-r--r--Plugins/Core/teleport.lua25
1 files changed, 15 insertions, 10 deletions
diff --git a/Plugins/Core/teleport.lua b/Plugins/Core/teleport.lua
index 4dd13c64d..90eb3529a 100644
--- a/Plugins/Core/teleport.lua
+++ b/Plugins/Core/teleport.lua
@@ -3,16 +3,21 @@ function HandleTPCommand( Split, Player )
Player:SendMessage( cChatColor.Green .. "Usage: /tp [PlayerName]" )
return true
end
- local World = Player:GetWorld()
- local OtherPlayer = World:GetPlayer( Split[2] )
- if( OtherPlayer == nil ) then
+
+ World = Player:GetWorld()
+
+ local TeleportDestination = function(OtherPlayer)
+ if( OtherPlayer == Player ) then
+ Player:SendMessage( cChatColor.Green .. "Already there :)" )
+ else
+ Player:TeleportToEntity( OtherPlayer )
+ Player:SendMessage( cChatColor.Green .. "You teleported to "..OtherPlayer:GetName().."!" )
+ OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName().." teleported to you!" )
+ end
+ end
+
+ if (not(World:DoWithPlayer(Split[2], TeleportDestination))) then
Player:SendMessage( cChatColor.Green .. "Can't find player " .. Split[2] )
- elseif( OtherPlayer == Player ) then
- Player:SendMessage( cChatColor.Green .. "Already there :)" )
- else
- Player:TeleportToEntity( OtherPlayer )
- Player:SendMessage( cChatColor.Green .. "You teleported to "..OtherPlayer:GetName().."!" )
- OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName().." teleported to you!" )
- end
+ end
return true
end \ No newline at end of file