// Custom models stuff
static currentmodel[32], tempmodel[32], already_has_model, i, iRand, size
already_has_model = false
if (g_handle_models_on_separate_ent)
{
// Set the right model
if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
iRand = random_num(0, ArraySize(model_admin_human) - 1)
ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}
else
{
iRand = random_num(0, ArraySize(model_human) - 1)
ArrayGetString(model_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_human, iRand))
}
// Set model on player model entity
fm_set_playermodel_ent(id)
// Remove glow on player model entity
fm_set_rendering(g_ent_playermodel[id])
}
else
{
// Get current model for comparing it with the current one
fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
// Set the right model, after checking that we don't already have it
if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
size = ArraySize(model_admin_human)
for (i = 0; i < size; i++)
{
ArrayGetString(model_admin_human, i, tempmodel, charsmax(tempmodel))
if (equal(currentmodel, tempmodel)) already_has_model = true
}
if (!already_has_model)
{
iRand = random_num(0, size - 1)
ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}
}
else
{
size = ArraySize(model_human)
for (i = 0; i < size; i++)
{
ArrayGetString(model_human, i, tempmodel, charsmax(tempmodel))
if (equal(currentmodel, tempmodel)) already_has_model = true
}
if (!already_has_model)
{
iRand = random_num(0, size - 1)
ArrayGetString(model_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_human, iRand))
}
}
// Need to change the model?
if (!already_has_model)
{
// An additional delay is offset at round start
// since SVC_BAD is more likely to be triggered there
if (g_newround)
set_task(5.0 * g_modelchange_delay, "fm_user_model_update", id+TASK_MODEL)
else
fm_user_model_update(id+TASK_MODEL)
}
// Remove glow
fm_set_rendering(id)
}