Raised This Month: $ Target: $400
 0% 

[STOCK]Set a prop's skin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
iloveportalz0r
Member
Join Date: May 2010
Location: Up yours
Old 06-04-2010 , 20:38   [STOCK]Set a prop's skin
Reply With Quote #1

I was messing with SetEntityRenderFx and SetEntityRenderColor for my build server on HL2DM and noticed that there was no SetEntitySkin function in SourceMod, so here's one for people who don't know how to make one themselves. Just copy and paste this into addons/sourcemod/scripting/include/entity_prop_stocks.inc

/**
* Sets an entity's skin.
*
* @param entity Entity index.
* @param skin Skin value.
* @noreturn
* @error Invalid entity index, or lack of mod compliance.
*/
stock SetEntitySkin(entity, Skin:skin)
{
static bool:gotconfig = false;
static String:prop[32];

if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nSkin", prop, sizeof(prop));
CloseHandle(gc);

if (!exists)
{
strcopy(prop, sizeof(prop), "m_nSkin");
}

gotconfig = true;
}

SetEntProp(entity, Prop_Send, prop, skin, 1);
}
__________________
I sure was dumb in 2010
iloveportalz0r is offline
 


Thread Tools
Display Modes

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 18:16.


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