AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   m_iCompTeammateColor (https://forums.alliedmods.net/showthread.php?t=325187)

ChocOrange 06-11-2020 10:16

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

Franc1sco 06-11-2020 13:55

Re: m_iCompTeammateColor
 
1 Attachment(s)
Try something like this. Command is sm_setcompcolor

ChocOrange 06-11-2020 14:39

Re: m_iCompTeammateColor
 
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.

Balimbanana 06-11-2020 22:21

Re: m_iCompTeammateColor
 
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.

ChocOrange 06-14-2020 17:48

Re: m_iCompTeammateColor
 
Quote:

Originally Posted by Balimbanana (Post 2705215)
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.


All times are GMT -4. The time now is 23:39.

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