7d28f8bbff
commit 52a6f4e35bdea2ae9f33977928b6693f5800e515 Merge: f5d56ff 2af1da8 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 08:51:45 2013 -0700 Merge pull request #1 from tigerw/master Added TPA (tonibm9's fork) commit 2af1da8a3cd8e94674b22805662b83de87ac4a95 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 16:38:10 2013 +0100 Added TPA (tonibm9's fork) With code from STR_Warrior. commit f5d56ffeb02fef4735e846661fa71d15622d25b9 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Sat Jul 27 15:51:18 2013 +0100 Integrated SpawnProtect & Bugfixes [SEE DESC.] Integrated bearbin's SpawnProtect. Fixed config file bugs. Improved SpawnProtect to use settings.ini. Variable cleanup (SHOW_PLUGIN_NAMES). File and filename cleanup. commit 56dc51c00af4514253c04e38b5ccc9fbed2f0022 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Jul 26 23:14:40 2013 +0100 Update README.md Added info. commit acd7e2849dcd7f3ee7bdc6b0f9b777ee1d9cbb3c Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Jul 26 19:37:59 2013 +0100 Implemented Block Property checking for Collisions Used g_BlockIsSolid, instead of checking data values. commit 246d423ff9660a2b00a1c51e6276ec74eb3419de Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Fri Jul 26 15:49:55 2013 +0100 Updated Files Buildpermandcollision: updated collision code to check for torches and redstone torches. Help: attempt at always showing page number Web_serversettings: attempt at introducing a check for Maximum Players (must be above zero). commit 868f99ab49edeee78f4fc1c212c6bf614b860378 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 19:46:08 2013 +0100 Update README.md Extended 'GUI Redesign' section. commit e0df40bd082bdeb5c6823b485bc5001103a77502 Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 19:43:00 2013 +0100 Update README.md Added features and fixes and instructions for use. commit 332d8221f753f1a38d6c21bfc30af5890f48e3bb Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 19:35:27 2013 +0100 Uploaded All Files All Core files, both modified and unmodified. commit 3dd191f6bed71c863ee264856fbc3660e52cf88b Author: Tiger Wang <ziwei.tiger@hotmail.co.uk> Date: Thu Jul 25 04:59:50 2013 -0700 Initial commit
80 lines
3.3 KiB
Lua
80 lines
3.3 KiB
Lua
function HandleTPCommand(a_Split, a_Player)
|
|
if ((#a_Split == 2) or (#a_Split == 3)) then
|
|
-- Teleport to player specified in a_Split[2], tell them unless a_Split[3] equals "-h":
|
|
TeleportToPlayer(a_Player, a_Split[2], (a_Split[3] ~= "-h"));
|
|
return true;
|
|
elseif (#a_Split == 4) then
|
|
-- Teleport to XYZ coords specified in a_Split[2, 3, 4]:
|
|
SetBackCoordinates(a_Player);
|
|
a_Player:TeleportToCoords(a_Split[2], a_Split[3], a_Split[4]);
|
|
a_Player:SendMessage(cChatColor.Green .. "You teleported to {" .. a_Split[2] .. ", " .. a_Split[3] .. ", " .. a_Split[4] .. "}");
|
|
return true;
|
|
else
|
|
a_Player:SendMessage( cChatColor.Green .. "Usage: /tp [PlayerName] (-h) or /tp [X Y Z]" )
|
|
return true
|
|
end
|
|
end
|
|
|
|
function HandleTPACommand( Split, Player )
|
|
if Split[2] == nil then
|
|
Player:SendMessage( cChatColor.Green .. "Usage: /tpa [Player]" )
|
|
return true
|
|
end
|
|
local loopPlayer = function( OtherPlayer )
|
|
if OtherPlayer:GetName() == Split[2] then
|
|
OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName() .. " send a teleport request" )
|
|
Player:SendMessage( cChatColor.Green .. "You send a teleport request to " .. OtherPlayer:GetName() )
|
|
Destination[OtherPlayer:GetName()] = Player:GetName()
|
|
end
|
|
end
|
|
local loopWorlds = function( World )
|
|
World:ForEachPlayer( loopPlayer )
|
|
end
|
|
cRoot:Get():ForEachWorld( loopWorlds )
|
|
return true
|
|
end
|
|
|
|
function HandleTPAcceptCommand( Split, Player )
|
|
if Destination[Player:GetName()] == nil then
|
|
Player:SendMessage( cChatColor.Green .. "Nobody has send you a teleport request" )
|
|
return true
|
|
end
|
|
local loopPlayer = function( OtherPlayer )
|
|
if Destination[Player:GetName()] == OtherPlayer:GetName() then
|
|
if OtherPlayer:GetWorld():GetName() ~= Player:GetWorld():GetName() then
|
|
OtherPlayer:MoveToWorld( Player:GetWorld():GetName() )
|
|
end
|
|
OtherPlayer:TeleportToEntity( Player )
|
|
Player:SendMessage( cChatColor.Green .. OtherPlayer:GetName() .. " teleported to you" )
|
|
OtherPlayer:SendMessage( cChatColor.Green .. "You teleported to " .. Player:GetName() )
|
|
Destination[Player:GetName()] = nil
|
|
end
|
|
end
|
|
local loopWorlds = function( World )
|
|
World:ForEachPlayer( loopPlayer )
|
|
end
|
|
cRoot:Get():ForEachWorld( loopWorlds )
|
|
return true
|
|
end
|
|
|
|
-- Teleports a_SrcPlayer to a player named a_DstPlayerName; if a_TellDst is true, will send a notice to the destination player
|
|
function TeleportToPlayer(a_SrcPlayer, a_DstPlayerName, a_TellDst)
|
|
local teleport = function(OtherPlayer)
|
|
if (OtherPlayer == a_SrcPlayer) then
|
|
-- Asked to teleport to self?
|
|
a_SrcPlayer:SendMessage(cChatColor.Green .. "Y' can't teleport to yerself!");
|
|
else
|
|
SetBackCoordinates(a_SrcPlayer);
|
|
a_SrcPlayer:TeleportToEntity(OtherPlayer);
|
|
a_SrcPlayer:SendMessage(cChatColor.Green .. "You teleported to " .. OtherPlayer:GetName() .. "!");
|
|
if (a_TellDst) then
|
|
OtherPlayer:SendMessage(cChatColor.Green .. Player:GetName().." teleported to you!");
|
|
end
|
|
end
|
|
end
|
|
|
|
local World = a_SrcPlayer:GetWorld();
|
|
if (not(World:DoWithPlayer(a_DstPlayerName, teleport))) then
|
|
a_SrcPlayer:SendMessage(cChatColor.Green .. "Can't find player " .. a_DstPlayerName);
|
|
end
|
|
end |