HU/getElementsWithinColShape

From Multi Theft Auto: Wiki
Revision as of 11:56, 10 October 2018 by Surge (talk | contribs) (Created page with "{{Shared function hu}} __NOTOC__ Ez function arra szolgál, hogy az összes colshape-ban lévő elemet kilistázza, a megadott típustát. {{Note_hu| * For legacy reasons, a c...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

[[{{{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
  • This function doesn't verify whether elements are in the same dimension and interior, additional checks could be implemented manually if they are needed

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

Returns a table containing all the elements inside the colshape, of the specified type. Returns an empty table if there are no elements inside. Returns false if the colshape is invalid.

Példa

This example retrieves a table of players inside a colshape and prints their name to the chat.

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