Garry's Mod Wiki

Entity:NetworkVarElement

  Entity:NetworkVarElement( string type, number slot, string element, string name, table extended = nil )

Description

Similarly to Entity:NetworkVar, creates a network variable on the entity and adds Set/Get functions for it. This method stores it's value as a member value of a vector or an angle. This allows to go beyond the normal variable limit of Entity:NetworkVar for Int and Float types, at the expense of Vector and Angle limit.

This function should only be called in ENTITY:SetupDataTables.

Make sure to not call the SetDT* and your custom set methods on the client realm unless you know exactly what you are doing.

Arguments

1 string type
Supported choices:
  • Vector
  • Angle
2 number slot
The slot for this Vector or Angle, from 0 to 31. See Entity:NetworkVar for more detailed explanation.
3 string element
Which element of a Vector or an Angle to store the value on. This can be p, y, r for Angles, and x, y, z for Vectors
4 string name
The name will affect how you access it. If you call it Foo you would add two new functions on your entity - SetFoo() and GetFoo(). So be careful that what you call it won't collide with any existing functions (don't call it "Pos" for example).
5 table extended = nil
A table of extra information. See Entity:NetworkVar for details.