GM:CanEditVariable

From Garry's Mod
Jump to: navigation, search
 GM:CanEditVariable( )

Contents

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

Entity ent

The entity being edited

Arguments

Player ply

The player doing the editing

Arguments

string key

The name of the variable

Arguments

string val

The new value, as a string which will later be converted to its appropriate type

Arguments

table editor

The edit table defined in Entity:NetworkVar

Returns

boolean

Return true to allow editing

Examples

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


Personal tools
Navigation