Aperture-Development / MSync-2

Version 2 of MSync - Fully working and extra steak
https://www.Aperture-Development.de
GNU General Public License v3.0
12 stars 1 forks source link

MRsync does not show existing groups ingame #36

Closed Bryantdl7 closed 4 years ago

Bryantdl7 commented 4 years ago

Ingame I am presented with this:

image


cat mrsync.txt 
{
    "nosync": [],
    "syncall": {
        "owner": true,
        "member": true,
        "retired-staff": true,
        "serveradmin": true,
        "grandmaster": true,
        "mod": true
    }

This behavior exists upon disconnecting and reconnecting. When I try and add an existing rank to the ingame window, I get the following error:


[ERROR] addons/msync-2/lua/msync/client_gui/modules/cl_mrsync.lua:74: attempt to index field 'settings' (a nil value)
  1. DoClick - addons/msync-2/lua/msync/client_gui/modules/cl_mrsync.lua:74
   2. unknown - lua/vgui/dlabel.lua:237

As a workaround, one can edit the txt file directly.

ApertureDevelopment commented 4 years ago

Are there any other errors happening at startup, maybe something like "Timer failed" ?

ApertureDevelopment commented 4 years ago

Is that the whole output of your mrsync.txt ?

ApertureDevelopment commented 4 years ago

I was able to re-produce your bug by modifying the mrsync.txt file to look like this:

{
    "nosync": [],
    "syncall": {
        "owner": true,
        "member": true,
        "retired-staff": true,
        "serveradmin": true,
        "grandmaster": true,
        "mod": true
    }

but it actually has to look like this:

{
    "nosync": [],
    "syncall": {
        "owner": true,
        "member": true,
        "retired-staff": true,
        "serveradmin": true,
        "grandmaster": true,
        "mod": true
    }
}

there is a missing } in your file as it looks like, otherwise I am unable to re-produce the bug

Bryantdl7 commented 4 years ago

Here is the only timer thats failing:

Timer Failed! [Simple][@addons/acfmissiles/lua/autorun/server/sv_acf_missiles.lua (line 268)]

Also in other news, when I delete my users.txt and reboot it is still setting me to new, despite the rank being correct on the database when I disconnect. I don't know if that is worth troubleshooting at the moment, as last time I had weird issues it was my fault, but getting it out there.

The final right curly bracket I accidentally did not copy. it is in my file as you said it should be

ApertureDevelopment commented 4 years ago

I am unable to reproduce either bug. Without being able to reproduce the bugs I am also unable to fix them. I can only suggest you to maybe try deleting the addon and settings folder, and install it again using the new v1.0.3 release

Bryantdl7 commented 4 years ago

Is there a specific file which pulls the contents from the setting file I can try running?

The initial startup of the addon manually gives no warnings or messages of concern:

lua_openscript autorun/msync_autorun.lua
Running script autorun/msync_autorun.lua...
[MySQL Ban Sync] Module loaded
[MySQL Rank Sync] Module loaded
[MBSync] Recieved ban data
[MSync] Module querys have been completed successfully
[MSync] Server saved to database
Compressing fragments (1244 -> 1138 bytes)
[DSTM] Bryant: !msync
L 05/12/2020 - 13:57:32: "[DSTM] Bryant<2><STEAM_0:0:26745653><Team>" say "!msync"
ApertureDevelopment commented 4 years ago

You can try to do: on server: lua_run PrintTable(util.JSONToTable(file.Read("msync/mrsync.txt", "DATA"))) lua_run PrintTable(MSync.modules.MRSync.settings) lua_run MSync.modules.MRSync.loadSettings()

on client: lua_run MSync.modules.MRSync.getSettings() lua_run PrintTable(MSync.modules.MRSync.settings)

Bryantdl7 commented 4 years ago

1

L 05/12/2020 - 14:13:06: "[DSTM] Bryant<2><STEAM_0:0:26745653><Team>" say "!msync"
 lua_run PrintTable(util.JSONToTable(file.Read("msync/mrsync.txt", "DATA")))
 lua_run PrintTable(util.JSONToTable(file.Read("msync/mrsync.txt", "DATA")))
> PrintTable(util.JSONToTable(file.Read("msync/mrsync.txt", "DATA")))...
nosync:
                1       =       true
syncall:
                member  =       true
                owner   =       true
                regular =       true
                retired-staff   =       true
                serveradmin     =       true
                superadmin      =       true

2

 lua_run PrintTable(MSync.modules.MRSync.settings)
> PrintTable(MSync.modules.MRSync.settings)...
nosync:
                1       =       true
syncall:
                member  =       true
                owner   =       true
                regular =       true
                retired-staff   =       true
                serveradmin     =       true
                superadmin      =       true

3

lua_run MSync.modules.MRSync.loadSettings()

MSync.modules.MRSync.loadSettings()...

lua_run MSync.modules.MRSync.loadSettings() lua_run MSync.modules.MRSync.loadSettings()

MSync.modules.MRSync.loadSettings()...


client---

1

`]  lua_run MSync.modules.MRSync.getSettings()
`
No output from this one...

2

`lua_run PrintTable(MSync.modules.MRSync.settings)`

One discovery I have made is that rank called simply "1". I never made that. 

Steps I got to, in order to get the mysterious #1 

1. Wipe all configs for this addon
2. Reboot
3. Reconnect to db 
4. Enable rank sync module 
5. Reboot (as module tab is blank) 
6. Remove member rank from excluded (making excluded field completely empty) 
7. add member rank to included 
8. Start adding in other ranks mentioned 
9. Add another rank to the excluded field, such as guest 

This mysterious #1 rank shows up ingame too: 

![image](https://user-images.githubusercontent.com/5564661/81730531-acc8d880-945b-11ea-8a65-754bbb1dc23d.png)

Interestingly, not in the settings: 

{ "nosync": { "member": true }, "syncall": { "superadmin": true } }

Bryantdl7 commented 4 years ago

Upon button mashing the sync server ranks button a few times, deleting number one, and pasting in a known rank, in this case VIP, I get the settings to finally update to this:


{
    "nosync": [
        true
    ],
    "syncall": {
        "owner": true,
        "member": true,
        "retired-staff": true,
        "regular": true,
        "serveradmin": true,
        "superadmin": true
    }
}

Which does not line up with image

Next, I will reboot. Giving me the initial problem:

image

It seems like the issue is that the settings stored locally do not know what to do when no values are present.

ApertureDevelopment commented 4 years ago

Do you have addons installed that modify default GMod behaviour? Like DLib for example.

Bryantdl7 commented 4 years ago

We run ULX, Ulib, and WUMA for our restriction systems.

We do not run DLib.

We have a development team inhouse which make scripts, but nothing which affects systems like this.

I have removed our aWarn and gBans systems just in case this was the issue. This was way earlier than testing this issue.

It really seems like part of your code does not handle the removal of all restricted ranks properly. Perhaps have a dont-touch rank in there, and script the frontend to not see it as a quick fix?

Once things get messed up, even deleting the mrsync file and rebooting makes it come back to this error.

[ERROR] addons/msync-2/lua/msync/client_gui/modules/cl_mrsync.lua:74: attempt to index field 'settings' (a nil value)
  1. DoClick - addons/msync-2/lua/msync/client_gui/modules/cl_mrsync.lua:74
   2. unknown - lua/vgui/dlabel.lua:237

I will try rebooting the server under a different group to see if that helps.

Edit: Nope. Still missing.

ApertureDevelopment commented 4 years ago

Try commenting out line 131 and 133 in the cl_mrsync.lua

Bryantdl7 commented 4 years ago

Commenting those lines worked to get me back to the original state. When removing the member field and replacing with user, on reboot it gets replaced with 1 again.

Removed 1, put in the group rankman, and now the group rankman wont do anything when I click add, it just stays stuck in the textfield.

ApertureDevelopment commented 4 years ago

I found a mistake in the code that I fixed and will commit in a second.

ApertureDevelopment commented 4 years ago

Please try downloading the Bugfix branch and see if that works for you: https://github.com/Aperture-Development/MSync-2/tree/bugfix

Bryantdl7 commented 4 years ago

https://github.com/Aperture-Development/MSync-2/tree/bugfix resolves this issue, however, on the same theme of the UI, you may leave the rank field empty, and click apply. The system will not stop you from providing a nil value.

For example, I can leave the rank field empty, click apply, and there will be an empty rank field in its place in the list, that you can right click, and delete.

ApertureDevelopment commented 4 years ago

You may be able to add nil ranks to the list but

  1. They do not get saved to the config file
  2. This GUI is supposed to be used by professionals that know what they are doing

buuuut I did put in a verification for empty fields which seemed to not work, but I fixed that now.

ApertureDevelopment commented 4 years ago

Please try the newest commit from the same branch

Bryantdl7 commented 4 years ago
2. This GUI is supposed to be used by professionals that know what they are doing

You have not been dealing with the Garry's mod community for long then! 😂

I agree, as I did notice and remove the mistake myself, but I guarantee if there's a thing that can break, someone will break it.

I will test the new bugfix commit and report on my findings.

ApertureDevelopment commented 4 years ago

I know the SUP principle, I tried to idiot-proof my addon, but with a development process of 2 years with a long break in between, some things got overlooked, I thought I tested the addon to the nerve, but without actuall usage scenarios its hard to find such things

Bryantdl7 commented 4 years ago

That’s where people like I come in! You’ve done great with this. We have been meaning to code something to do just this, as we have a lot of ranks which you automatically promote through. Multiply that by six years of player traffic and a text file starts dying hard

Get Outlook for iOShttps://aka.ms/o0ukef


From: Aperture Development notifications@github.com Sent: Tuesday, May 12, 2020 6:10:07 PM To: Aperture-Development/MSync-2 MSync-2@noreply.github.com Cc: Bryant Bryantdl7@gmail.com; Author author@noreply.github.com Subject: Re: [Aperture-Development/MSync-2] MRsync does not show existing groups ingame (#36)

I know the SUP principle, I tried to idiot-proof my addon, but with a development process of 2 years with a long break in between, some things got overlooked, I thought I tested the addon to the nerve, but without actuall usage scenarios its hard to find such things

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Aperture-Development/MSync-2/issues/36#issuecomment-627625427, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABKOR5N2ZA32UQGLBRN3QELRRHCL7ANCNFSM4M67TKUQ.

Bryantdl7 commented 4 years ago

The fix provided makes it so people are unable to enter any text into the box.

All I did first was try hitting add with nothing in there, then trying to add a rank to either field.

Bryantdl7 commented 4 years ago

I will say the prior version is running great. I have it running on both of our servers now without issue. Happy to keep debugging this part on my dev server

ApertureDevelopment commented 4 years ago

I hope you are not talking about MSync 1, that reached EOL

Bryantdl7 commented 4 years ago

MSync 2. The prior bugfix version which fixed my frontend UI issues. As mentioned above the latest bugfix branch made it so I could not add any ranks, so I opted to not add that version.

ApertureDevelopment commented 4 years ago

Try this bugfix, it should fix the SUP check and prevent you from being able to add empty strings or strings that just consist of whitespaces or strings that end with a whitespace

ApertureDevelopment commented 4 years ago

Did you try the bugfix version? I would push it to development now and then start to implement the GroupChanged hook of ULX

Bryantdl7 commented 4 years ago

I am testing this now, I will update in 5 minutes or so with my findings

Bryantdl7 commented 4 years ago

This also leads to saving into the file as well: image

ApertureDevelopment commented 4 years ago

I added a check to prevent the user from adding ranks with a leading whitespace, you can find the latest update version in the MRSync branch: https://github.com/Aperture-Development/MSync-2/tree/MRSync

Bryantdl7 commented 4 years ago

This is now working in the MRSync branch. I retested based on the applicable use-cases above and did not run into issues.

ApertureDevelopment commented 4 years ago

Great! I will close the issue now as it seems to be resolved