HU/getElementsWithinColShape

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.

Ez function arra szolgál, hogy az összes colshape-ban lévő elemet kilistázza, a megadott típustól.

[[{{{image}}}|link=|]] Megjegyzés:
  • For legacy reasons, a colshape created on the client does not collide with elements already existing at that location until they first move
  • Ez a function nem elleőrzni, hogy az elemek azonos dimenzióban és interiorban vannak-e, a további ellenőrzések manuálisan is végrehajthatóak szükség esetén

Szintaxis

table getElementsWithinColShape ( colshape theShape [, string elemType = nil ] ) 

OOP Syntax Help! I don't understand this!

Method: colshape:getElementsWithin(...)
Variable: .elementsWithin


Kötelező paraméterek

  • theShape: A colshape, ahonnan az elemet szeretné megkapni.

Tetszőleges paraméterek

  • elemType: Az elem típusa, amit listázni szeretne. Ez bármilyen elemtípus lehet, a gyakoriakat lentebb találja:
    • "player": A szerverhez csatlakoztatott játékos
    • "ped": Egy ped
    • "vehicle": Egy jármű
    • "object": Egy object
    • "pickup": Egy pickup
    • "marker": Egy marker

Visszatérési érték

Visszaad egy táblát, mely tartalmazza az összes colshape-ban lévő elemet, a megadott típustól. Visszaad egy üres táblát, ha nincs a colshape-ban elem. false, ha a colshape érvénytelen.

Példa

Ez a példa visszaad egy táblát a colshape-ban lévő játékosokról, és kiírja a nevüket a chatba.

local newColShape = createColSphere( 1, 2, 3, 4 )                          -- create our new colshape
local players = getElementsWithinColShape( newColShape, "player" )         -- get all the players inside the sphere
for _, thePlayer in ipairs( players ) do                                   -- use a generic for loop to step through each player
    outputChatBox( getPlayerName( thePlayer ) .. " is in our new sphere" ) -- print their name to the chat
end

Changelog

Version Description
1.5.5-3.12286 Added elementsWithin OOP variable

Lásd még

Fordította