Hey all. I'm working on a new plugin. This plugin as the topic states is going to change models for admins in DoD. I have been doing some searching and located a cs_set_user_model. And then went into the code and found out how it works. But, no dice. I have tried register_forward(FM_SetModel) and register_event(ResetHUD) and then within each of these checked the model to be models/player.mdl and forced it to be a certain model. Now when I attempt to join and look at myself or other admins It stays the same. No model changes. So I'm posting the basic test code. Can someone give a shout if they see where the problem is.
Thanks, and Cheers!
Code:
register_event("ResetHUD", "handle_model", "b")
public handle_model(id)
{
if(!is_user_connected(id) || !get_cvar_num("dod_am_enabled"))
return PLUGIN_CONTINUE
// Get Model
new mdl[128]
entity_get_string(id, EV_SZ_model, mdl, 127)
new team = entity_get_int(id, EV_INT_team)
if(contain(mdl, "player.mdl") && team > 0)
{
entity_set_string(id, EV_SZ_model, models[team - 1])
}
new temp[128]
entity_get_string(id, EV_SZ_model, temp, 127)
log_amx("entid: %d model: %s", id, temp)
return PLUGIN_CONTINUE
}
Code:
register_forward(FM_SetModel, "handle_model")
public handle_model(id, const mdl[])
{
if(!is_valid_ent(id) || !get_cvar_num("dod_am_enabled"))
return FMRES_IGNORED
new temp[128]
new team = entity_get_int(id, EV_INT_team)
if(contain(mdl, "models/player.mdl") && team > 0)
{
entity_set_string(id, EV_SZ_model, models[team - 1])
entity_get_string(id, EV_SZ_model, temp, 127)
log_amx("entid: %d model: %s", id, temp)
return FMRES_SUPERCEDE
}
entity_get_string(id, EV_SZ_model, temp, 127)
log_amx("entid: %d model: %s", id, temp)
return FMRES_IGNORED
}
__________________