|
Author
|
Message
|
|
Member
Join Date: May 2010
Location: Up yours
|

06-04-2010
, 20:38
[STOCK]Set a prop's skin
|
#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
|
|
|
|