Garry's Mod Wiki

Revision Difference

Global.Entity#529356

<function name="Entity" parent="Global" type="libraryfunc"> <description> Returns the entity with the matching <page>Entity:EntIndex</page>. Indices 1 through <page>game.MaxPlayers</page>() are always reserved for players. <note>In examples on this wiki, **Entity( 1 )** is used when a player entity is needed (see ). In singleplayer and listen servers, **Entity( 1 )** will always be the first player. In dedicated servers, however, **Entity( 1 )** won't always be a valid player.</note> Indices `1` through <page>game.MaxPlayers</page>() are always reserved for players. <note>In examples on this wiki, `Entity( 1 )` is used when a player entity is needed (see ). In singleplayer and listen servers, `Entity( 1 )` will always be the first player. In dedicated servers, however, `Entity( 1 )` won't always be a valid player if there is no one currently on the server.</note> </description> <realm>Shared</realm> <args> <arg name="entityIndex" type="number">The entity index.</arg> </args> <rets> <ret name="" type="Entity">The entity if it exists, or NULL if it doesn't.</ret> </rets> </function>