We use server mod for admins and client part of this mod on admin players and server
RegisterNetSyncVariableBool (and may be RegisterNetSyncVariableInt) on server side cause cuts and bleeding wihout blood loss for players who not have client part of our admin mod
Also Restraining stops working correctly - unrestraining menu is not activated, not blocked inventory opens and locked restrain item can be removed from the hands and drop on ground or put to inventory
Description
Details
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 7
- Operating System Version
- Windows Server 2008 R2
- Category
- General
modded class PlayerBase extends ManBase
{
private bool m_isAdmin = false;
void PlayerBase()
{
RegisterNetSyncVariableBool("m_isAdmin");
}
override void OnVariablesSynchronized()
{
super.OnVariablesSynchronized(); setAdminPlayer(m_isAdmin);
}
void setAdminPlayer(bool state)
{
if (!IsAlive()) return; m_isAdmin = state; SetFlags(EntityFlags.SYNCHRONIZATION_DIRTY, true); SetSynchDirty();
}
}
That code is enough to cause these bugs
Event Timeline
This is a constructor and cannot be override.
Attempting to call super.PlayerBase() cause an error
void Init() has to be called in class constructor in order to initialize and register other synced variables. This is likely the reason for the broken bleeding and other issues besides.
Safest way to achieve this would be:
void PlayerBase()
{
Init(); RegisterNetSyncVariableBool("m_isAdmin");
}
This would ensure the new variable is registered after the original ones are, and avoid possible mismatch in variable indexing. Alternatively, you can just modify the void Init() function and add the synced variable at the end of the list there. Either approach should work
Dear Geez
//
void PlayerBase()
{
Init(); RegisterNetSyncVariableBool("m_isAdmin");
}
//
As a result, we have 2 calls init()
Becouse Constructor in native class and modded class will be combined
Try it yourself
In expansion we have multiple of registernetsync and never experienced this issue.
This sounds more a mod that you are using breaking it.
Did you tried only your mod ?
And prefer to override Init instead inside contructor, and call super. More friendly for any other mods
NiioZz
If i use init() result the same
If i register and sync network variables on server and not register this variables on clients, clients bleeding
Why you would register variable on server but on client, for sure this will make clients bleeding or anything related, a net sync variable should be client side and server side. If you are doing it only server side this will make a shift in bitstream and fucked up every other system using netsyncvar on the client.
Just for a reply to this report, it's something due to how you handle net sync var, not how the game has been made, you should ask this in dayz modding discord before here.
nonsense...
why blеeding? why not death immediately?
why it is impossible to filter on client side and process only registered variables? is it difficult for programmers?
It's not nonsense, you have a bitstream between client and server, if you send more bit from the server to the client ( by adding only a registernetsync at server side) you will have a shift inside your bitstream, and why you bleeding ? because bleeding is just only 1 bit, so if you have a shift of one, there is a bit of 1 shifting to the right for example, and so make you bleeding.
NetSync variable should be added client side and server side ONLY. You can't have only client side or only server side.
You can't process only registered variable, because registered variable is send to a bitstream, so you are processing only in the order you have registered variable, so you are sure server and client get exactly the same info.
@Geez Sorry to ping you, but you can close this ticket, it's not a problem inside the game, but just a problem how the guy used it. If this would be the case every mod would already have been reported this bug. Because everyone using RegisterNetSync. I'm in Expansion team, and never had this problem. Problem only occurs if mod actually not registerNetSync var client side AND server side.