Raised This Month: $51 Target: $400
 12% 

Get Model on an Entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
urMom
Junior Member
Join Date: Aug 2007
Old 12-13-2009 , 17:21   Get Model on an Entity
Reply With Quote #1

I am trying to retrieve the model being used on an entity.

In particular, I am filtering for prop_physics entities using FindEntityByClassname, but cannot find a method to retrieve the model for the entities returned.

Is there a function which will return a string for the model? I'm looking for that so that I can apply some rendermode and renderfx options to them, but for particular props which I can identify by the model used.

I see functions to set a model and precache a model, but none to get the model. If the cached models are indexed, is there a second function I may need to return the "models/<path>/<something>.mdl" for a given ent?

Last edited by urMom; 12-13-2009 at 17:27. Reason: Forgot to mention which game.
urMom is offline
urMom
Junior Member
Join Date: Aug 2007
Old 12-13-2009 , 17:27   Re: Get Model on an Entity
Reply With Quote #2

Edit: HL2DM.
urMom is offline
Wazz
SourceMod Donor
Join Date: Mar 2009
Old 12-13-2009 , 17:42   Re: Get Model on an Entity
Reply With Quote #3

You can use a SDKCall with a CBaseEntity offset to retrieve it, I can't remember the exact name of it but a bit of searching and you'll find it.
Wazz is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 12-13-2009 , 18:15   Re: Get Model on an Entity
Reply With Quote #4

Why that complicated, it's a datamap value:

Code:
decl String:m_ModelName[PLATFORM_MAX_PATH];
GetEntPropString(entity, Prop_Data, "m_ModelName", m_ModelName, sizeof(m_ModelName));
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
FoxMulder
Senior Member
Join Date: Jan 2009
Location: Orlando, FL
Old 12-13-2009 , 18:16   Re: Get Model on an Entity
Reply With Quote #5

PHP Code:
new String:modelname[128];
GetEntPropString(entityProp_Data"m_ModelName"modelname128);
if (
StrEqual(modelname"some_model.mdl"))
 
PrintToChatAll("Pika Pika"); 
__________________
FoxMulder is offline
Wazz
SourceMod Donor
Join Date: Mar 2009
Old 12-13-2009 , 18:16   Re: Get Model on an Entity
Reply With Quote #6

Must of missed that. I stumbled across the offset while looking for something else, I never used it.
Wazz is offline
urMom
Junior Member
Join Date: Aug 2007
Old 12-16-2009 , 15:24   Re: Get Model on an Entity
Reply With Quote #7

Thank you! I was wading though SDK calls seemingly forever. The info worked painlessly. Thanks!
urMom is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode