HU/getElementsWithinColShape: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(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...")
 
No edit summary
Line 1: Line 1:
{{Shared function hu}}
{{Shared function hu}}
__NOTOC__
__NOTOC__
Ez function arra szolgál, hogy az összes colshape-ban lévő elemet kilistázza, a megadott típustát.
Ez function arra szolgál, hogy az összes colshape-ban lévő elemet kilistázza, a megadott típustól.
{{Note_hu|
{{Note_hu|
* For legacy reasons, a colshape created on the client does not collide with elements already existing at that location until they first move
* 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
* 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==  
==Szintaxis==  
Line 27: Line 28:


===Visszatérési érték===
===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.
Visszaad egy [[table|táblát]], mely tartalmazza az összes colshape-ban lévő elemet, a megadott típustól. Visszaad egy üres [[table|táblát]], ha nincs a colshape-ban elem. ''false'', ha a colshape érvénytelen.


==Példa==  
==Példa==  
This example retrieves a [[table]] of players inside a colshape and prints their name to the chat.
Ez a példa visszaad egy [[table|táblát]] a colshapeban lévő játékosokról, és kiírja a nevüket a chatba..
 
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local newColShape = createColSphere( 1, 2, 3, 4 )                          -- create our new colshape
local newColShape = createColSphere( 1, 2, 3, 4 )                          -- create our new colshape

Revision as of 12:03, 10 October 2018

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 colshapeban 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