try this...plugin download at botom.
Code:
// Thanks Suicid3 for helping me make this plugin
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define MAX_STUFF 64
/* / How it works
g_szInfo[i][0] = AuthID
g_szInfo[i][1] = Model
/ */
new g_szInfo[MAX_STUFF][2][65]
new g_iCount = 0
public plugin_init()
{
register_plugin("playermodel", "0.2", "boadmin")
register_event("ResetHUD", "resetModel", "b")
ReadFile()
}
public ReadFile()
{
new szFile[66]
get_configsdir( szFile , 65 )
format(szFile , 65 , "%s/models.ini",szFile)
if(!file_exists(szFile))
{
log_amx("[ChickenSuit] File ^"%s^" does not exist.",szFile)
return PLUGIN_HANDLED
}
new szLine[01] , line = 0, len = 0
while(read_file(szFile, line++ , szLine , 100 , len) && (g_iCount < MAX_STUFF) )
{
if(szLine[0] == ';' || !len) continue
strbreak(szLine, g_szInfo[g_iCount][0] , 63 , g_szInfo[g_iCount][1] , 63)
g_iCount++
}
return PLUGIN_CONTINUE
}
//Your code revised
public plugin_precache() {
for(new i = 0; i < g_iCount; i++)
{
precache_model(g_szInfo[i][1]) //I think this should work.
//If it doesnt work try adding "g_szInfo[i][1] = " before precache_model
}
}
public resetModel(id, level, cid) {
new authid[50]
get_user_authid(id,authid,49)
for(new i = 0; i < g_iCount; i++)
{
if(equali(authid,g_szInfo[i][0])) {
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T) {
cs_set_user_model(id, g_szInfo[i][1])
}
else if(userTeam == CS_TEAM_CT) {
cs_set_user_model(id, g_szInfo[i][1])
}
else {
cs_reset_user_model(id)
}
}
}
return PLUGIN_CONTINUE
}
changed:
Code:
for(new i = 0; i <g_iCount; i++)
to
Code:
for(new i = 0; i < g_iCount; i++)
and i dont know if this was the problem...im not sure at all...but
Code:
new szLine[101] , line = 0, len = 0
to
Code:
new szLine[01] , line = 0, len = 0