So I saw how in zplague is setting modelindex offset , I set in my plugin too, is this correct?
PHP Code:
// Other
#define MAX_CLASSES 4
new const ZOMBIE_CLASSES[MAX_CLASSES][]= {
"zombieap1", // Player Model of hunter
"panic", // Player Model of boomer
"mummy", // Player Model of smoker
"zombieap4" // Player Model of tank
}
new PlayerClass[33];
new Array:g_modelindex_zombie;
// plugin_precache
g_modelindex_zombie = ArrayCreate(1, 1);
new modelpath_human[100];
for(new i = 0; i < MAX_CLASSES; i++)
{
formatex(modelpath_human, sizeof modelpath_human - 1, "models/player/%s/%s.mdl", ZOMBIE_CLASSES[i], ZOMBIE_CLASSES[i])
if( !file_exists( modelpath_human ) )
{
return 0;
}
ArrayPushCell(g_modelindex_zombie, engfunc(EngFunc_PrecacheModel, modelpath_human))
formatex(modelpath_human, sizeof modelpath_human - 1, "models/player/%s/%st.mdl", ZOMBIE_CLASSES[i], ZOMBIE_CLASSES[i])
if ( file_exists( modelpath_human ) )
{
engfunc(EngFunc_PrecacheModel, modelpath_human);
return 1;
}
formatex(modelpath_human, sizeof modelpath_human - 1, "models/player/%s/%sT.mdl", ZOMBIE_CLASSES[i], ZOMBIE_CLASSES[i])
if ( file_exists( modelpath_human ) )
{
engfunc(EngFunc_PrecacheModel, modelpath_human);
return 1;
}
}
// Ham Spawn Post
PlayerClass[id] = random_num(0, 3)
fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_zombie, PlayerClass[id]))
// Stock
// Set the precached model index (updates hitboxes server side)
stock fm_cs_set_user_model_index(id, value)
{
set_pdata_int(id, 491, value, 5)
}
Btw I don't know anything about Arrays... But I learned a bit from zplague.
I'm just confused...
__________________