undo/SetCustomUndoText

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{Func |Name=SetCustomUndoText |Parent=undo |Description=Sets a custom undo text for the current undo block |Realm=Server |IsClass=No }} {{Arg |type=string |name=custo...")
 
(make variable local in example)
 
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=SetCustomUndoText
 
|Parent=undo
 
 
|Description=Sets a custom undo text for the current undo block
 
|Description=Sets a custom undo text for the current undo block
 
|Realm=Server
 
|Realm=Server
Line 12: Line 10:
 
}}
 
}}
 
{{Example
 
{{Example
| Description = This example creates a prop_physics, adds it to the players undo list, and sets a custom undo text
+
|Description=This example creates a prop_physics, adds it to the players undo list, and sets a custom undo text
| Code = prop = ents.Create( "prop_physics" )
+
|Code=local prop = ents.Create( "prop_physics" )
 
prop:SetModel( "models/props_junk/wood_crate001a.mdl" )
 
prop:SetModel( "models/props_junk/wood_crate001a.mdl" )
 
prop:Spawn()
 
prop:Spawn()

Latest revision as of 14:34, 17 March 2017

 undo.SetCustomUndoText( )

Contents

Description

Sets a custom undo text for the current undo block

Arguments

string customText

The text to display when the undo block is undone

Examples

Example

This example creates a prop_physics, adds it to the players undo list, and sets a custom undo text

local prop = ents.Create( "prop_physics" )
prop:SetModel( "models/props_junk/wood_crate001a.mdl" )
prop:Spawn()
undo.Create( "prop" )
 undo.AddEntity( prop )
 undo.SetPlayer( Player )
 undo.SetCustomUndoText("Undone a crate prop")
undo.Finish()


Personal tools
Navigation