IsElementLocal: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
Line 18: Line 18:
function destroyAllLocalBlips ( )
function destroyAllLocalBlips ( )
-- get a table containing all blips
-- get a table containing all blips
local allBlips = getElementsByType("blip")
local allBlips = getElementsByType( "blip" )
-- for each one of them,
-- for each blip in this table,
for index, blip in ipairs ( allBlips ) do
for index, blip in ipairs ( allBlips ) do
-- check if it's a blip that only exists locally,
-- check if it's a blip that only exists locally,

Revision as of 15:25, 30 July 2007

This function checks whether a clientside element is local to the client (doesn't exist in the server) or not.

Syntax

bool isElementLocal ( element theElement )

Required Arguments

  • theElement: The element that we want to check.

Returns

Returns true if the passed element is local, false if not or if invalid parameters are passed.

Example

This clientside function destroys all local radar blips.

function destroyAllLocalBlips ( )
	-- get a table containing all blips
	local allBlips = getElementsByType( "blip" )
	-- for each blip in this table,
	for index, blip in ipairs ( allBlips ) do
		-- check if it's a blip that only exists locally,
		if isElementLocal ( blip ) then
			-- and destroy it in that case
			destroyElement ( blip )
		end
	end
end

See Also

Shared