Plugin developement
#11
well since a tpa is different from a normal teleport i'd suggest writing it from scratch.
i quickly made this i hope it makes sense for you Wink:
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
Reply
Thanks given by:


Messages In This Thread
Plugin developement - by tonibm19 - 04-14-2013, 10:00 PM
RE: Plugin developement - by NiLSPACE - 04-14-2013, 10:08 PM
RE: Plugin developement - by tonibm19 - 04-14-2013, 10:23 PM
RE: Plugin developement - by NiLSPACE - 04-14-2013, 10:29 PM
RE: Plugin developement - by tonibm19 - 04-14-2013, 10:34 PM
RE: Plugin developement - by NiLSPACE - 04-14-2013, 10:42 PM
RE: Plugin developement - by FakeTruth - 04-14-2013, 10:49 PM
RE: Plugin developement - by tonibm19 - 04-14-2013, 11:41 PM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 12:04 AM
RE: Plugin developement - by tonibm19 - 04-15-2013, 12:13 AM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 12:33 AM
RE: Plugin developement - by tonibm19 - 04-15-2013, 12:43 AM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 12:44 AM
RE: Plugin developement - by tonibm19 - 04-15-2013, 12:46 AM
RE: Plugin developement - by FakeTruth - 04-15-2013, 12:46 AM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 12:47 AM
RE: Plugin developement - by tonibm19 - 04-15-2013, 12:49 AM
RE: Plugin developement - by FakeTruth - 04-15-2013, 12:45 AM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 12:53 AM
RE: Plugin developement - by tonibm19 - 04-15-2013, 12:54 AM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 03:12 AM
RE: Plugin developement - by tonibm19 - 04-15-2013, 03:52 AM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 03:58 AM
RE: Plugin developement - by tonibm19 - 04-15-2013, 04:45 AM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 04:46 AM
RE: Plugin developement - by tonibm19 - 04-15-2013, 04:49 AM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 04:52 AM
RE: Plugin developement - by tonibm19 - 04-15-2013, 04:54 AM
RE: Plugin developement - by NiLSPACE - 04-15-2013, 05:12 AM
RE: Plugin developement - by tonibm19 - 04-16-2013, 05:01 AM



Users browsing this thread: 16 Guest(s)