Hello everyone!
While developing a plugin for my Half-Life Teamplay server, I encountered an issue with temporarily changing a player's model. Attempts to use natives like hl_set_user_model, set_user_model, or
Code:
engfunc(EngFunc_SetClientKeyValue, player, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", modelname)
resulted in an error message stating that the required team doesn't exist, and the model was not changed.
I also tried the following alternative approach (simplified for clarity):
Code:
new monster_model
public plugin_init(){
register_forward(FM_AddToFullPack, "fwd_AddToFullPack", 1)
}
public plugin_precache(){
monster_model = precache_model(MONSTER_MODEL_PATH)
}
public fwd_AddToFullPack(es_handle, e, id, host, flags, player)
{
if(id && player && is_user_alive(id) && isMonster[id] == 1){
set_es(es_handle, ES_ModelIndex, monster_model)
client_print(id,print_center,"FULLPACK WORKS");
}
return FMRES_IGNORED;
}
The condition is met - the message "FULLPACK WORKS" is displayed - but the model does not change.
As a temporary workaround, I'm using a solution involving spawning an entity at the player’s position, as described here:
https://forums.alliedmods.net/showthread.php?t=69386
However, this method occasionally causes animation synchronization issues.
I don’t want to create a new team — the player should stay in the one he’s already in. Is there any reliable way to temporarily change a player's model in Half-Life Teamplay , or will I have to rely on workarounds/hacks/crutches?