Entity/SetPersistent

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(explicitly clarify the case of an empty sbox_persist identifier)
 
Line 1: Line 1:
 
{{Func
 
{{Func
|Description=Sets whether or not the given entity is persistent. A persistent entity will be saved on server shutdown and loaded back when the server starts up. Additionally, by default persistent entities cannot be grabbed with the physgun and tools cannot be used on them.
+
|Description={{SandboxDerived}}
 +
 
 +
Sets whether or not the given entity is persistent. A persistent entity will be saved on server shutdown and loaded back when the server starts up. Additionally, by default persistent entities cannot be grabbed with the physgun and tools cannot be used on them.
  
 
In sandbox, this can be set on an entity by opening the context menu, right clicking the entity, and choosing "Make Persistent".
 
In sandbox, this can be set on an entity by opening the context menu, right clicking the entity, and choosing "Make Persistent".
  
 
{{Note|Persistence can only be enabled with the sbox_persist convar, which works as an identifier for the current set of persistent entities. An empty identifier (which is the default value) disables this feature.}}
 
{{Note|Persistence can only be enabled with the sbox_persist convar, which works as an identifier for the current set of persistent entities. An empty identifier (which is the default value) disables this feature.}}
 
{{Note|This feature only works in Sandbox and Sandbox-derived gamemodes.}}
 
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=Yes
 
|IsClass=Yes

Latest revision as of 14:03, 7 June 2019

 Entity:SetPersistent( )

Description

This function or feature is only available in the Sandbox gamemode and its derivatives.

Sets whether or not the given entity is persistent. A persistent entity will be saved on server shutdown and loaded back when the server starts up. Additionally, by default persistent entities cannot be grabbed with the physgun and tools cannot be used on them.

In sandbox, this can be set on an entity by opening the context menu, right clicking the entity, and choosing "Make Persistent".

NOTE

Persistence can only be enabled with the sbox_persist convar, which works as an identifier for the current set of persistent entities. An empty identifier (which is the default value) disables this feature.

Arguments

boolean persist

Whether or not the entity should be persistent.
Personal tools
Navigation