CityRP Documentation Repository

Entity

Shared Entity Metafunctions.

Functions

SharedEntity:Distance(ent) → numberSource ☍

Check scalar distance to another entity.

Parameters

  • entEntityThe entity to check distance for.

Returns

  1. numberdistance from the other entity.
SharedEntity:DistToSqr(ent) → numberSource ☍

Check squared scalar distance to another entity.

Parameters

  • entEntityThe entity to check distance for.

Returns

  1. numbersquared distance from the other entity.
SharedEntity:GetNetVar(name, default) → anySource ☍

Reads a networked value from this entity. Unregistered names and Global-scoped vars both return default with a logged error -- use cityrp.network.GetGlobal for Global-scoped vars.

Parameters

  • namestringThe registered var name.
  • defaultanyReturned if the value has never been set, or on any of the error paths above.

Returns

  1. any
SharedEntity:LLSpeed() → numberSource ☍

Gets the Photon Speed if photon is installed, otherwise uses the same formulae that photon uses.

Returns

  1. numberin "MPH".
SharedEntity:LLSpeedKMH() → numberSource ☍

kmh readout of LLSpeed.

Returns

  1. numberin "KMH".
SharedEntity:SetColor(ctab)Source ☍

Overwritten SetColor function to prevent d3d signs from being made invisible.

Parameters

  • ctabColorThe colour table to be set.
ServerEntity:SetNetVar(name, value)Source ☍

Sets a networked value on this entity and, if it changed, sends the update. Errors (logged, not thrown) for an unregistered name, a Global-scoped var (use cityrp.network.SetGlobal), or a LocalPlayer-scoped var set on a non-player.

Parameters

  • namestringThe registered var name.
  • valueanyThe new value. nil clears it.

Classes

SharedEntitySource ☍

The entity metatable, with CityRP's own additions to Garry's Mod's Entity.

Fields

SharedEntity.__netvarsSource ☍

Networked values set locally or received over the network, by var name. nil until the first value is stored.