Raised This Month: $219 Target: $400
 54% 

Problem while changing the player model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MihaiGamerXD
Member
Join Date: Aug 2018
Old 01-15-2020 , 03:36   Problem while changing the player model
Reply With Quote #1

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...

Last edited by MihaiGamerXD; 01-15-2020 at 03:39.
MihaiGamerXD is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-15-2020 , 05:13   Re: Problem while changing the player model
Reply With Quote #2

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.
__________________


My Plugins:

Last edited by Napoleon_be; 01-15-2020 at 05:13.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
MihaiGamerXD
Member
Join Date: Aug 2018
Old 01-15-2020 , 06:26   Re: Problem while changing the player model
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
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.
MihaiGamerXD is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-15-2020 , 07:56   Re: Problem while changing the player model
Reply With Quote #4

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).
__________________
HamletEagle is offline
MihaiGamerXD
Member
Join Date: Aug 2018
Old 01-15-2020 , 12:24   Re: Problem while changing the player model
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
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

Last edited by MihaiGamerXD; 01-15-2020 at 12:37.
MihaiGamerXD is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 01-15-2020 , 13:39   Re: Problem while changing the player model
Reply With Quote #6

Quote:
Originally Posted by mihaigamerxd View Post
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
__________________
iceeedr is offline
Send a message via Skype™ to iceeedr
MihaiGamerXD
Member
Join Date: Aug 2018
Old 01-15-2020 , 13:55   Re: Problem while changing the player model
Reply With Quote #7

Quote:
Originally Posted by iceeedr View Post
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.
MihaiGamerXD is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-15-2020 , 14:38   Re: Problem while changing the player model
Reply With Quote #8

Quote:
Originally Posted by MihaiGamerXD View Post
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
__________________


My Plugins:
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 01-15-2020 , 20:15   Re: Problem while changing the player model
Reply With Quote #9

Use Mercylezz's player model api plug-in.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-16-2020 , 04:11   Re: Problem while changing the player model
Reply With Quote #10

Can you tell us which bots are switching back to default models?
__________________

Last edited by HamletEagle; 01-16-2020 at 04:11.
HamletEagle 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 04:43.


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