TheXYZNetwork / xAdmin

A free and basic administration system for Garry's Mod.
The Unlicense
27 stars 6 forks source link

Ranks don't save after rejoin / restart #27

Closed ghost closed 3 years ago

ghost commented 4 years ago

If I set my rank or a friends rank to admin / superadmin and they rejoin the server or it restarts, our ranks aren't saved. We don't use MySQL.

ghost commented 4 years ago

Bump

Down-s commented 4 years ago

I also have this problem, my ranks seem to also not save to the database even though connection is completely fine. Would be great if someone could find a solution to this.

0wain commented 4 years ago

Do the ranks save to the database? Or does it not even get that far?

Down-s commented 4 years ago

I updated xAdmin, and now it seems to work on the database. But now when I join the server my rank resets. Is there some sort of function that is making the players rank reset to default on spawn?

Down-s commented 4 years ago

xAdmin.Database.GetUsersGroup(ply:SteamID64(), function(data) print(data[1].rank) end) This seems to always print "user" inside PlayerInitialSpawn.

0wain commented 4 years ago

Only on PlayerInitialSpawn? Called post join does it load the correct rank??

kylerisalone commented 4 years ago

Make sure you have mySQLoo installed, I had this issue too a while back

0wain commented 4 years ago

Although a very valid and important thing (Ensuring the latest version of MySQLOO is installed correctly), I'm pretty sure your entire server will error out if it's not.

kylerisalone commented 4 years ago

Seeing as it was the only mysql dependant addon on the server, It wasnt causing any other issues from what I noticed. Although it was a few months back so I may not remember correctly.

masonmanley commented 3 years ago

If you try to use sqlite it does not save ranks - I've been having this issue too.

masonmanley commented 3 years ago

Make sure you have mySQLoo installed, I had this issue too a while back

It works fine if you use mysqloo as opposed to using a file database?

kylerisalone commented 3 years ago

Make sure you have mySQLoo installed, I had this issue too a while back

It works fine if you use mysqloo as opposed to using a file database?

Well if you're using a database I'm pretty sure mysqloo is required, for xAdmin at least.

0wain commented 3 years ago

xAdmin has supported SQLite for a short while now. Your report of the bug being SQLite caused is rather interesting, I'll have a dig and get back to you.

Creekie1337 commented 3 years ago

Try using lua_run to DROP all xadmin related tables and try again. I believe this fixed the issue for someone else that had this issue.

habobababo commented 3 years ago

I'm also facing this problem, even with mysql on a clean server. If i install darkrp with fadmin this problem fixed. If you print every query, you will see that something overrides the ranks with user.

`xadmin setgroup Habo superadmin You have updated Habo's usergroup to: superadmin INSERT INTO svr1_users (userid, "rank") VALUES ('76561198008925721', 'superadmin') ON DUPLICATE KEY UPDATE "rank"='superadmin';

INSERT INTO svr1_users (userid, "rank") VALUES ('76561198008925721', 'superadmin') ON DUPLICATE KEY UPDATE "rank"='superadmin'; L 12/15/2020 - 17:39:17: "Habo<3><>" disconnected (reason "Disconnect by user.") Dropped Habo from server (Disconnect by user.) SELECT FROM svr1_active_bans WHERE userid='76561198008925721'; L 12/15/2020 - 17:39:18: "Habo<4><>" connected, address "88.152.185.251:58851" Client "Habo" connected (88.152.185.251:58851). L 12/15/2020 - 17:39:18: "Habo<4><>" STEAM USERID validated INSERT INTO svr1_users (userid, "rank") VALUES ('76561198008925721', 'user') ON DUPLICATE KEY UPDATE "rank"='user'; SELECT FROM svr1_users WHERE userid='76561198008925721'; L 12/15/2020 - 17:39:23: "Habo<4><>" entered the game `

masonmanley commented 3 years ago

I'm also facing this problem, even with mysql on a clean server. If i install darkrp with fadmin this problem fixed. If you print every query, you will see that something overrides the ranks with user.

Yes, I just did some investigating pulling the sv.db at various times. When a user is set to a group, the group is written correctly to the sqlite db, but once the user leaves the server the group is reset to user.

habobababo commented 3 years ago

I'm also facing this problem, even with mysql on a clean server. If i install darkrp with fadmin this problem fixed. If you print every query, you will see that something overrides the ranks with user.

Yes, I just did some investigating pulling the sv.db at various times. When a user is set to a group, the group is written correctly to the sqlite db, but once the user leaves the server the group is reset to user.

i edited my post and added the console response:

INSERT INTO svr1_users (userid, "rank") VALUES ('76561198008925721', 'user') ON DUPLICATE KEY UPDATE "rank"='user'; SELECT * FROM svr1_users WHERE userid='76561198008925721';

it inserts the user rank before loading the rank

TheRealPixit commented 3 years ago

Anyone find a fix or a way to purge the database when not running on mySQLoo, I tried using mySQLoo to try and fix the issue but there seems to be an even bigger issue with that.

kylerisalone commented 3 years ago

lua_run sql.Query("DROP TABLE svr1_users")

Try running that in console, it should drop the table for users n stuff, then just restart your server

TheRealPixit commented 3 years ago

Even after I started using mySQLoo and not mySQLite this is still a persisting issue. When people leave and rejoin they do keep their ranks, but once the server restarts they are a user. I can also check the database and the users are all still there but the ranks change after a restart.

0wain commented 3 years ago

Even after I started using mySQLoo and not mySQLite this is still a persisting issue. When people leave and rejoin they do keep their ranks, but once the server restarts they are a user. I can also check the database and the users are all still there but the ranks change after a restart.

I assume you're using DarkRP? If so, try disabling FAdmin. I think you can do it within darkrpmodification.

TheRealPixit commented 3 years ago

I assume you're using DarkRP? If so, try disabling FAdmin. I think you can do it within darkrpmodification.

I am using DarkRP, but I have had FAdmin disabled and enabled. What's weird is with it enabled it resets ranks on rejoining, but with it disabled it resets on the server restart. Also sorry for the late response.

Edit: I have also taken a look at the databasing code and didn't see anything wrong, but I could've missed something.

coolgamer6942 commented 3 years ago

so what do i have to do to fix this issue?

0wain commented 3 years ago

so what do i have to do to fix this issue?

Try disabling fAdmin.

coolgamer6942 commented 3 years ago

so what do i have to do to fix this issue?

Try disabling fAdmin.

Alright ill check now

coolgamer6942 commented 3 years ago

It unfortunately did not work.

liondadev commented 3 years ago

This also happens to me, clean installation of DarkRP with fAdmin disabled.

0wain commented 3 years ago

So I finally figured out why this happens. When a player joins the server, gmod internally runs ply:SetUserGroup( "user" ) on join. Depending on how your server loads files, this will sometimes cause xAdmin's implementation of :SetUserGroup to force your rank to user.