SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
84 stars 18 forks source link

Forced change of player skin color #3227

Closed PARTOVIY closed 2 years ago

PARTOVIY commented 2 years ago

How to force change player color?) This would be useful for controlling players on RP servers.

GazziFX commented 2 years ago

Subscribe to Provider.onCheckValidWithExplanation and edit SteamPending.skin

PARTOVIY commented 2 years ago

The skin can only be obtained, I already tried it.

GazziFX commented 2 years ago

Use reflection to set "_skin" field

var field = typeof(SteamPending).GetField("_skin", BindingFlags.Instance | BindingFlags.NonPublic);
field.SetValue(pending, color);
PARTOVIY commented 2 years ago

Subscribe to Provider.onCheckValidWithExplanation and edit SteamPending.skin

Is it possible to subscribe to UnturnedPermission.onJoinRequest and get the same effect?

GazziFX commented 2 years ago

Yes, but it is just a wrapper and it use obsolete underlying event

PARTOVIY commented 2 years ago

Thanks you, very much