Revision Difference
ents.FindInBox#528459
<function name="FindInBox" parent="ents" type="libraryfunc">
<description>
Returns all entities within the specified box.
<note>Clientside entities will not be returned by this function.</note>
<warning>There is a limit of 512 entities for the output!</warning>
</description>
<realm>Shared</realm>
<args>
<arg name="boxMins" type="Vector">The box minimum coordinates.</arg>
<arg name="boxMaxs" type="Vector">The box maximum coordinates.</arg>
</args>
<rets>
<ret name="" type="table">A table of all found entities.</ret>
</rets>
</function>
<example>
<description>Returns a table of players in a box using ents.FindInBox</description>
<code>
function ents.FindPlayersInBox( vCorner1, vCorner2 )
local tEntities = ents.FindInBox( vCorner1, vCorner2 )
local tPlayers = {}
local iPlayers = 0
for i = 1, #tEntities do
if ( tEntities[ i ]:IsPlayer() ) then
iPlayers = iPlayers + 1
tPlayers[ iPlayers ] = tEntities[ i ]
end
end
return tPlayers, iPlayers
end
</code>
<outputfixedwidth>Fixed width</outputfixedwidth>⤶
</example>