Garry's Mod Wiki

Revision Difference

undo.Create#515918

<function name="Create" parent="undo" type="libraryfunc"> <description>Begins a new undo entry</description> <realm>Server</realm> <args> <arg name="name" type="string">Name of the undo message to show to players</arg> </args> </function> ⤶ <example>⤶ <description>This example creates a prop_physics, and adds it to Player's undo list.</description>⤶ <code>⤶ prop = ents.Create("prop_physics")⤶ ⤶ {{Example⤶ | Description = This example creates a prop_physics, and adds it to Player's undo list.| Code = prop = ents.Create("prop_physics")⤶ prop:SetModel("models/props_junk/wood_crate001a.mdl") prop:Spawn() undo.Create("prop") undo.AddEntity(prop)⤶ ```⤶ ⤶ undo.AddEntity(prop)⤶ undo.SetPlayer(Player) undo.Finish()⤶ </code>⤶ ⤶ </example>```⤶ ⤶ undo.Finish()⤶ }}