In the end you got a shitty plugin that will crash the server if the model has a T.mdl file. Use this:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
enum _:ModelsInfo
{
Flag,
CTModel[32],
TModel[32]
}
new const g_eModels[][ModelsInfo] =
{
{ ADMIN_LEVEL_A, "owner_ct", "owner_t" },
{ ADMIN_LEVEL_B, "admin_ct", "admin_t" }
}
new bool:g_bHasCustomSkin[33]
public plugin_init()
{
register_plugin("Multiple Player Models", "1.0", "OciXCrom")
RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
}
public plugin_precache()
{
for(new i; i < sizeof(g_eModels); i++)
{
precache_player_model(g_eModels[i][CTModel])
precache_player_model(g_eModels[i][TModel])
}
}
public client_putinserver(id)
g_bHasCustomSkin[id] = false
public OnPlayerSpawn(id)
{
if(is_user_alive(id))
{
new bool:bMatch
for(new iFlags = get_user_flags(id), i; i < sizeof(g_eModels); i++)
{
if(iFlags & g_eModels[i][Flag])
{
switch(cs_get_user_team(id))
{
case CS_TEAM_CT: set_model(id, g_eModels[i][CTModel])
case CS_TEAM_T: set_model(id, g_eModels[i][TModel])
}
bMatch = true
break
}
}
if(!bMatch && g_bHasCustomSkin[id])
{
g_bHasCustomSkin[id] = false
cs_reset_user_model(id)
}
}
}
set_model(const id, const szModel[])
{
cs_set_user_model(id, szModel)
g_bHasCustomSkin[id] = true
}
precache_player_model(szModel[])
{
new szFile[128]
formatex(szFile, charsmax(szFile), "models/player/%s/%s.mdl", szModel, szModel)
precache_model(szFile)
replace(szFile, charsmax(szFile), ".mdl", "T.mdl")
if(file_exists(szFile))
precache_model(szFile)
}
__________________