Raised This Month: $2 Target: $400
 0% 

m_iCompTeammateColor


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ChocOrange
Member
Join Date: Feb 2009
Old 06-11-2020 , 10:16   m_iCompTeammateColor
Reply With Quote #1

Can someone please explain why.

I use the command "sm_dump_netprops" and can see the values listed that I've used below.



SetEntProp(client, Prop_Send, "m_iCompTeammateColor", 2);

gives: Exception reported: Property "m_iCompTeammateColor" not found

Whereas I can use:

SetEntProp(client, Prop_Send, "m_iCoachingTeam", 3);
And it's fine.

What should I be using for the "m_iCompTeammateColor" and how do I differentiate how to use the values?

Many thanks.
ChocOrange is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 06-11-2020 , 13:55   Re: m_iCompTeammateColor
Reply With Quote #2

Try something like this. Command is sm_setcompcolor
Attached Files
File Type: sp Get Plugin or Get Source (test_colors.sp - 26 views - 1.4 KB)
__________________
Veteran SourceMod Coder -> Activity channel
Taking some paid jobs and selling some private stuff.
Contact: Steam, Telegram or discord ( Franc1sco#7876 ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 06-11-2020 at 14:07.
Franc1sco is offline
Send a message via MSN to Franc1sco
ChocOrange
Member
Join Date: Feb 2009
Old 06-11-2020 , 14:39   Re: m_iCompTeammateColor
Reply With Quote #3

Thanks Franc1sco, but I've already seen https://github.com/b3none/compcolour.../compcolour.sp that does it the same way as yours.

Unfortunately that removes colours when people join the server and they have to set them again.


I'm more interested in what is wrong with:
SetEntProp(client, Prop_Send, "m_iCompTeammateColor", 2);

So I can understand for the future.
ChocOrange is offline
Balimbanana
Member
Join Date: Jan 2017
Old 06-11-2020 , 22:21   Re: m_iCompTeammateColor
Reply With Quote #4

It looks like it is part of the Player Resource, so setting it on the client most likely wouldn't work.
From the compcolour plugin:
Code:
...
int offset = FindSendPropInfo("CCSPlayerResource", "m_iCompTeammateColor");
...
SetEntDataArray(entity, offset, player_colours, MAXPLAYERS + 1, _, true);
The other reason it might be giving a property not found is because it might be a Prop_Data. Although modifying properties that are managed by the player resource entity usually either has no actual effect, or is reset on next frame.

Last edited by Balimbanana; 06-11-2020 at 22:59.
Balimbanana is offline
ChocOrange
Member
Join Date: Feb 2009
Old 06-14-2020 , 17:48   Re: m_iCompTeammateColor
Reply With Quote #5

Quote:
Originally Posted by Balimbanana View Post
It looks like it is part of the Player Resource, so setting it on the client most likely wouldn't work.
From the compcolour plugin:
Code:
...
int offset = FindSendPropInfo("CCSPlayerResource", "m_iCompTeammateColor");
...
SetEntDataArray(entity, offset, player_colours, MAXPLAYERS + 1, _, true);
The other reason it might be giving a property not found is because it might be a Prop_Data. Although modifying properties that are managed by the player resource entity usually either has no actual effect, or is reset on next frame.
Thanks Balimbanana that gave me enough of a clue to sort it.

In both the examples, SetEntDataArray(entity, offset, player_colours, MAXPLAYERS + 1, _, true);
doesn't need to be continuously set. Once will suffice.
ChocOrange 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 12:14.


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