Raised This Month: $ Target: $400
 0% 

[TFC] Check if model has skins


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-02-2017 , 05:35   Re: [TFC] Check if model has skins
Reply With Quote #3

Quote:
Originally Posted by SpannerSpammer View Post
There's a reason for that: I don't think anyone has ever needed
to or done anything like that before. It's easy to do in C++:
Code:
int GetNumSkins( edict_t *pEntity )
{
	void *pmodel = GET_MODEL_PTR( pEntity );
	studiohdr_t *pstudiohdr;
	pstudiohdr = (studiohdr_t *)pmodel;
	if (!pstudiohdr) return 0;
	int iRet = pstudiohdr->numskinref;
	if( iRet < 0 ) iRet = 0;

	return iRet;
}
It's not so easy to do in PAWN. You would have to open the MDL file in binary mode
then fseek to the part of the file that contains the model data (i.e. an offset
value from the beginning of the file since the model data is stored after bone,
animation and sequence data). Then you could either fseek directly to skin data if
you know the offset value OR you could read the entire model studiohdr_t data
structure into an enumerated "struct" and extract the skin info from there.

See this thread for reference:
https://forums.alliedmods.net/showthread.php?t=178658
Well, this si required for my tfc server. FM has a menu plugin that for models that if a model has more skins, it shows the skins tab.
DarthMan is offline
 



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 20:58.


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