HU/getElementColShape

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Bizonyos elemeknek vannak hozzátársított colshape-ük, mint például Marker és Pickup. Ezzel a functionnal megkaphatjuk a társított colshapeket.

Szintaxis

colshape getElementColShape ( element theElement )          

OOP Syntax Help! I don't understand this!

Method: element:getColShape(...)
Variable: .colShape


Kötelező paraméterek

  • theElement: Az elem, aminek a colshape-ét szeretné megkapni

Visszatérési érték

Visszaadja az elem colshape-ét, false, ha nem, vagy ha érvénytelen paraméterek lettek megadva.

Példa

Click to collapse [-]
Server

Ez a példa létrehoz egy markert a Toreno házában, és hozzáad egy parancsot, ami ellenőrzi, hogy rajta áll-e.

theMarker = createMarker( -687.9, 937.8, 13.6, "cylinder", 2.0, 255, 0, 0, 80 ) -- create a red cylinder marker inside Toreno's house

function checkOnMarker ( thePlayer )
    local isIn = isPlayerInMarker( thePlayer, theMarker ) -- use the function to check if player is in the marker
    if isIn then
        outputChatBox( "You are on the marker.", thePlayer )
    else
        outputChatBox( "You are not on the marker.", thePlayer )
    end
end
addCommandHandler ( "amionmarker", checkOnMarker )

-- define the isPlayerInMarker function
function isPlayerInMarker( thePlayer, theMarker )
	local theShape = getElementColShape( theMarker ) -- get markers colshape
	if isElementWithinColShape( thePlayer, theShape ) then -- check if the player is in it
		return true
	else -- he isn't on the marker
		return false
	end
end

Lásd még

Fordította