Garry's Mod Wiki

Revision Difference

ents.CreateClientProp#514590

<function name="CreateClientProp" parent="ents" type="libraryfunc">⤶ <description>⤶ Creates a clientside only prop. See also <page>Global.ClientsideModel</page>.⤶ ⤶ <bug issue="1387">Clientside entities are not garbage-collected, thus you must store a reference to the object and call <page>CSEnt:Remove</page> manually.</bug>⤶ ⤶ <bug issue="3268">Projected textures do not work on clientside props under specific conditions (see [this explanation](https://github.com/Facepunch/garrysmod-issues/issues/3268#issuecomment-324821962)).</bug>⤶ </description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="model" type="string" default="models/error.mdl">The model for the entity to be created.&#xA;&#xA;&#xA;&#xA;&lt;warning&gt;Model must be precached with &lt;page&gt;util.PrecacheModel&lt;/page&gt; on the server before usage.&lt;/warning&gt;</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="CSEnt">Created entity.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Creates a clientside prop at the player location.</description>⤶ <code>⤶ function GhostBarrel( ply )⤶ local c_Model = ents.CreateClientProp()⤶ c_Model:SetPos( ply:GetPos() )⤶ c_Model:SetModel( "models/props_borealis/bluebarrel001.mdl" )⤶ c_Model:SetParent( ply )⤶ c_Model:Spawn()⤶ end⤶ </code>⤶ ⤶ </example>