All pastes #90948 Raw Edit

Shadowed

public lua v1 · immutable
#90948 ·published 2006-07-18 04:20 UTC
rendered paste body
function SSPVP_GetFriendlyCarrier()	local playerPositions = {};	if( GetNumRaidMembers() > 0 ) then		for i=1, MAX_RAID_MEMBERS do			local posX, posY = GetPlayerMapPosition( "raid" .. i );			if( posX ~= 0 and posY ~= nil ) then				table.insert( playerPositions, { posX, posY, UnitName( "raid" .. i ) } );			end		end	else		for i=1, MAX_PARTY_MEMBERS do			local posX, posY = GetPlayerMapPosition( "party" .. i );			if( posX ~= 0 and posY ~= 0 ) then				table.insert( playerPositions, { posX, posY, UnitName( "party" .. i ) } );			end		end	end	-- Add everyones position to a list	for i=1, GetNumBattlefieldPositions() do		local posX, posX, playerName = GetBattlefieldPosition( i );		if( posX ~= 0 and posY ~= 0 ) then			table.insert( playerPositions, { posX, posY, playerName } );		end	end	-- Now check the flag positions for one that matches the users in our list	for i=1, GetNumBattlefieldFlagPositions() do		local flagX, flagY = GetBattlefieldFlagPosition( i );		if( flagX ~= 0 and flagY ~= 0 ) then			for id, row in playerPositions do				if( row[1] == flagX and row[2] == flagY ) then					return row[3];				end			end		end	end		return "";end