Garry's Mod Wiki

GM:CanEditVariable

boolean GM:CanEditVariable( Entity ent, Player ply, string key, string val, table editor )

Description

Called when a variable is edited on an Entity (called by Edit Properties... menu), to determine if the edit should be permitted.

See Editable entities for more details about the system.

Arguments

1 Entity ent
The entity being edited
2 Player ply
The player doing the editing
3 string key
The name of the variable
4 string val
The new value, as a string which will later be converted to its appropriate type
5 table editor
The edit table defined in Entity:NetworkVar

Returns

1 boolean
Return true to allow editing

Example

From base/gamemode/variable_edit.lua

Makes "Edit Properties..." right click property admin only

function GM:CanEditVariable( ent, ply, key, val, editor ) return ply:IsAdmin() end

Page Links


Special Pages


Wikis

?

Render Time: 54ms

Session 0
DB GetPage 8
Generate Html 21
SaveChanges 17
Render Body 0
Render Sidebar 6