Raised This Month: $ Target: $400
 0% 

Player model change for Half-Life Teamplay


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Glaster
Junior Member
Join Date: Jan 2020
Location: Irkutsk, Russia
Old 06-20-2025 , 04:59   Player model change for Half-Life Teamplay
Reply With Quote #1

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?

Last edited by Glaster; 06-20-2025 at 05:05.
Glaster is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 06-20-2025 , 16:56   Re: Player model change for Half-Life Teamplay
Reply With Quote #2

Try using rtxa's HL Player Models API
__________________
gabuch2 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:07.


Powered by vBulletin®
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Theme made by Freecode