AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem while changing the player model (https://forums.alliedmods.net/showthread.php?t=320913)

MihaiGamerXD 01-15-2020 03:36

Problem while changing the player model
 
I got a serious problem, and I can't fix it. When I try to change the player model, it doesn't work correctly. I tried thousand of ideas, but it does not change the model correctly. What's wrong?
Code:

public plugin_init()
{
        set_task(0.1,"RW_M",0,"",0,"b")
}

public RW_M() {
        new iPlayers[32], iNum, iPlayer, playername[64];
        get_players(iPlayers,iNum,"a")
        for (new i = 0; i < iNum; i++) {
                iPlayer = iPlayers[i]
                if (is_user_alive(iPlayer)) {
                        get_user_name(iPlayer,playername,63)
                        server_print("%s: %i",playername,cs_get_user_team(iPlayer));
                        new mapname[32]
                        get_mapname(mapname,31)
                        if (equal(mapname,"redswar_zm")) {
                                if (cs_get_user_team(iPlayer) == CS_TEAM_CT) {
                                        cs_set_user_model( iPlayer, "redswar_bird" )
                                }
                                else if (cs_get_user_team(iPlayer) == CS_TEAM_T) {
                                        cs_set_user_model( iPlayer, "redswar_zombie" )
                                }
                        }
                        else {
                                if (cs_get_user_team(iPlayer) == CS_TEAM_CT) {
                                        if (cs_get_user_vip(iPlayer)) {
                                                cs_set_user_model( iPlayer, "redswar_vip" )
                                        }
                                        else {
                                                cs_set_user_model( iPlayer, "redswar_bird" )
                                        }
                                }
                                else if (cs_get_user_team(iPlayer) == CS_TEAM_T) {
                                        cs_set_user_model( iPlayer, "redswar_pig" )
                                }
                        }
                }
        }
}

And I also installed Amx Mod X 1.8.3 (cuz 1.8.2 has Respawn issues, which also doesn't work correctly, but with this version works perfectly now), I'm also testing with bots.
I tried updating HLDS, but still doesn't change the model, same when testing in listen server...
Maybe this happens on Steam version? If so, should I try in Non-Steam version? Cuz as I know it worked perfectly in Non-Steam version, I can't remember exactly...

Napoleon_be 01-15-2020 05:13

Re: Problem while changing the player model
 
Why are you setting a task for it in plugin_init anyways? why would you do that if u just want to set models? I would suggest setting the models when player has choosen a team, or has spawned using "Ham_Spawn". Use bools to check if the model is already active or not.

MihaiGamerXD 01-15-2020 06:26

Re: Problem while changing the player model
 
Quote:

Originally Posted by Napoleon_be (Post 2680347)
Why are you setting a task for it in plugin_init anyways? why would you do that if u just want to set models? I would suggest setting the models when player has choosen a team, or has spawned using "Ham_Spawn". Use bools to check if the model is already active or not.

Doing a task, will repeat changing player models, if I change player model, when he respawned, doesn't work at all players.

HamletEagle 01-15-2020 07:56

Re: Problem while changing the player model
 
Do you plan to set models every 0.1 seconds for the entire duration of the game? That's insane and totally unnecessary.

You should search and learn the proper way of dealing with models(hints: FM_SetClientKeyValue, FM_UpdateClientData).

MihaiGamerXD 01-15-2020 12:24

Re: Problem while changing the player model
 
Quote:

Originally Posted by HamletEagle (Post 2680359)
Do you plan to set models every 0.1 seconds for the entire duration of the game? That's insane and totally unnecessary.

You should search and learn the proper way of dealing with models(hints: FM_SetClientKeyValue, FM_UpdateClientData).

i tried, it worked, but not on all bots, some bots changes to default model...
I don't know exactly what is going on? But my good idea, is to try testing in Non-Steam and I'll tell you what happened. Thanks anyway for helping me, but still doesn't work correctly on all bots

iceeedr 01-15-2020 13:39

Re: Problem while changing the player model
 
Quote:

Originally Posted by mihaigamerxd (Post 2680389)
i tried, it worked, but not on all bots, some bots changes to default model...
I don't know exactly what is going on? But my good idea, is to try testing in non-steam and i'll tell you what happened. Thanks anyway for helping me, but still doesn't work correctly on all bots

hahahahahahaha

MihaiGamerXD 01-15-2020 13:55

Re: Problem while changing the player model
 
Quote:

Originally Posted by iceeedr (Post 2680397)
hahahahahahaha

You're laughting for nothing, but it's true what I said that this maybe happened in Steam version. The only thing I remember, is that the models are changed correctly when I had my older plugin called Red's War if you remember, and worked only in non-steam version, and that's why I'll try so. And that's all, I hope you understand. :)

Napoleon_be 01-15-2020 14:38

Re: Problem while changing the player model
 
Quote:

Originally Posted by MihaiGamerXD (Post 2680405)
You're laughting for nothing, but it's true what I said that this maybe happened in Steam version. The only thing I remember, is that the models are changed correctly when I had my older plugin called Red's War if you remember, and worked only in non-steam version, and that's why I'll try so. And that's all, I hope you understand. :)

Are you seriously gonna use the code that u posted above? LOL

georgik57 01-15-2020 20:15

Re: Problem while changing the player model
 
Use Mercylezz's player model api plug-in.

HamletEagle 01-16-2020 04:11

Re: Problem while changing the player model
 
Can you tell us which bots are switching back to default models?


All times are GMT -4. The time now is 15:11.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.