Entity.GetModel
From GMod Wiki
Function | |
Syntax | Entity:GetModel( ) |
Description: | |
Returns the full path of the model | |
Returns: | String |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.GetModel]Entity.GetModel [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Remove the entity if it's a magnum! |
---|---|
Used on | |
Code | if (ent:GetModel() == "models/weapons/w_357") then ent:Remove() end |
Output | N/A |
Additional Notes
- The base file for model files is always "models/" thus this will always be returned by this function when called.
- As of GMod Update 71, the client now returns uncapitalized file paths. It is unknown if the server returns them capitalized or not.
- When used on brush based entities, this will return "*n" where n is the BSP index of the brush. You can supposedly use this with Entity:SetModel to spawn brush entities that have the same shape as an existing brush.