Not tested, but it compiles okay
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
public plugin_init()
{
register_plugin("Clan Models","0.1","Dizzy")
register_event("ResetHUD", "modelreset", "b")
return PLUGIN_HANDLED
}
public plugin_precache()
{
precache_model("models/clanter/clanter.mdl")
precache_model("models/clanct/clanct.mdl")
return PLUGIN_CONTINUE
}
public modelreset(id)
{
//Get filepath
new filepath[64]
get_configsdir(filepath, 63)
format(filepath, 63, "%s/clanmodels.cfg", filepath)
if(file_exists(filepath))
{
new output[128]
new fHandle = fopen(filepath, "rt")
if(!fHandle)
return PLUGIN_CONTINUE
for(new a = 0; !feof(fHandle); a++)
{
//Get line
fgets(fHandle, output, 511)
//Check if line is invalid
if(output[0] == ';' || !output[0] || output[0] == ' ' || output[0] == 10)
continue;
//Get authid
new authid[35]
get_user_authid(id, authid, 34)
//Containi is used since I'm not in the mood of stripping newlines
if(containi(output, authid) != -1)
{
new CsTeams:userTeam = cs_get_user_team(id)
if (userTeam == CS_TEAM_T)
{
cs_set_user_model(id, "clanter")
}
if(userTeam == CS_TEAM_CT)
{
cs_set_user_model(id, "clanct")
}
}
}
}
return PLUGIN_CONTINUE;
}
One small note: Make sure the folder where de models are in is named the same as the model itself.
EG: models/clanter/clanter.mdl and
NOT models/clanmodels/clanter.mdl
Same with the CT models offcourse
Good luck
__________________