Hi, I have a problem with Network Groups.
Below I have attached the code that creates new groups [it definitely works].
And binding the player to a new group, and everything works as it should [groups do not see each other], but after a second everything returns to what the groups see and can interact with each other, but the group ID remains the same.
private void CreateAimGroup(BasePlayer player)
{
var group = new Visibility.Group(Net.sv.visibility, (uint)Net.sv.TakeUID());
aimGroups[player.userID] = group;
SwitchPlayerToAimGroup(player, group);
player.Teleport(aimPosition);
}
private void SwitchPlayerToAimGroup(BasePlayer player, Visibility.Group group)
{
player.limitNetworking = true;
player.net.subscriber.UnsubscribeAll();
player.net.subscriber.Subscribe(group);
player.net.SwitchGroup(group);
ServerMgr.OnEnterVisibility(player.Connection, group);
player.SendNetworkGroupChange();
player.SendNetworkUpdateImmediate();
player.limitNetworking = false;
}[ChatCommand("group")]
private void CmdGroup(BasePlayer player, string command, string[] args)
{
var currentGroup = player.net.group;
if (currentGroup != null)
{
player.ChatMessage($"Urs currrent group: {currentGroup.ID}");
}
else
{
player.ChatMessage("Cant get urs group(((");
}
}