Poll

Would this be useful for you?

Yes
No

Author Topic: ULX MySQLOO  (Read 68021 times)

0 Members and 1 Guest are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #60 on: January 17, 2014, 05:28:15 AM »
Sorry, 2 things.

1. It should be noted that this script doesn't set up the database table for you. You'll need to take a look at the code and create the table yourself using the fields that the script expects.
2. I didn't actually use the connection info from the settings up top apparently. Take a look down a few functions into the code and modify the connection info there. I don't remember why I didn't just use the variables. I think I might have been having some issues with it.

Offline Hive01

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: ULX MySQLOO
« Reply #61 on: January 17, 2014, 11:10:01 PM »
Hey guys i got this script working.

HOWEVER.

The fact that every time a player joins it rewrites users.txt causes a huge lag when the servers got a fair few players on it...

e.g. a player joins, it checks users.txt and rewrites the player to user if the player doesnt exist..


The end result is EVERY player that joins gets their rank written to users.txt and this causes lag while the server reads/writes the file...

Any workaround for this?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #62 on: January 18, 2014, 04:04:55 AM »
Which script are you using?

What I did to fix that problem... and this is NOT RECOMMENDED unless you know what you are doing...


Inside of the ULib.ucl.addUser function I modified it to NOT write to the text file.
If you don't feel comfortable doing that, you could also modify whichever MySQL script you are using not to use the addUser function on a player unless they aren't a user. Only setting their group if they are above guest.

When you run addUser (Even if they don't have a group) it creates an entry inside of the users.txt file. When this file gets big enough, the server will hitch when players join the server.
« Last Edit: January 18, 2014, 04:09:02 AM by MrPresident »

Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #63 on: January 22, 2014, 08:09:10 AM »
Mr President,

thanks for your script again, but one thing - could you possibly tell me which way to create the table entries? I know how to, I mean the structure for each field. Mine are as follows, but I don't know if it is correct.



Thanks.

Also, same as last script. It says MySQLOO cannot be found even though it is definitely installed - I use it for other things. Where exactly should I have put the file?
« Last Edit: January 22, 2014, 08:12:11 AM by JakeGriffin »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #64 on: January 22, 2014, 08:28:13 AM »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #65 on: January 22, 2014, 08:31:24 AM »
As for the installation..

Make sure you have:

libmySQL.dll --Garrysmod root. Same location as srcds.exe
gmsv_mysqloo_win32.dll -- in garrysmod/lua/bin

The script I gave you, just make it an addon, or place it in your garrysmod/lua/autorun/server folder.




edit:
If you aren't sure if it's loaded correctly. Try this.

From your server console with the server running type:
require("MySQLOO")

If nothing returns then it's good. If it's not loaded, you'll get [ERROR] lua_run:1: Module not found!
« Last Edit: January 22, 2014, 08:33:33 AM by MrPresident »

Offline Hive01

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: ULX MySQLOO
« Reply #66 on: January 22, 2014, 08:07:24 PM »
Which script are you using?

What I did to fix that problem... and this is NOT RECOMMENDED unless you know what you are doing...


Inside of the ULib.ucl.addUser function I modified it to NOT write to the text file.
If you don't feel comfortable doing that, you could also modify whichever MySQL script you are using not to use the addUser function on a player unless they aren't a user. Only setting their group if they are above guest.

When you run addUser (Even if they don't have a group) it creates an entry inside of the users.txt file. When this file gets big enough, the server will hitch when players join the server.

I am using MKservers latest script he posted in this thread, would you mind sharing how you got ulib to not write to users.txt? and why is this not recommended?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #67 on: January 22, 2014, 08:26:31 PM »
It's not recommended because it's never recommended to modify base ULIB/ULX files. It won't hurt anything. Just remember to undo this if you ever decide to stop using MySQL authentication.


In addons\ULIB\lua\ulib\server\ucl.lua find:
Code: [Select]
function ucl.saveUsers()
for _, userInfo in pairs( ucl.users ) do
table.sort( userInfo.allow )
table.sort( userInfo.deny )
end

ULib.fileWrite( ULib.UCL_USERS, ULib.makeKeyValues( ucl.users ) )
end


replace with:
Code: [Select]
function ucl.saveUsers()
for _, userInfo in pairs( ucl.users ) do
table.sort( userInfo.allow )
table.sort( userInfo.deny )
end

--ULib.fileWrite( ULib.UCL_USERS, ULib.makeKeyValues( ucl.users ) )
end

Then just delete your users.txt file. Your game will now stop using it entirely.

Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #68 on: January 23, 2014, 04:44:46 AM »
Thanks again Mr President, you've been a great help :)

One thing, is it normal that your script stops the ability to edit rank permissions through XGUI?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #69 on: January 23, 2014, 04:59:29 AM »
It shouldn't. My script doesn't do anything to groups.

Offline Chase

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: ULX MySQLOO
« Reply #70 on: February 03, 2014, 05:00:30 AM »
It shouldn't. My script doesn't do anything to groups.

Unfortunately I have the same problem here. :(

Offline Android

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: ULX MySQLOO
« Reply #71 on: October 09, 2014, 02:29:20 AM »
Data line error.
System is Windows Server 2008.

Offline happyman0073

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: ULX MySQLOO
« Reply #72 on: October 16, 2014, 11:10:27 PM »
is it possiblet that this isn't completely compatible with URS or did I do something wrong? URS itslef seems to be working but it doesn't show the restrictions in the menu...
« Last Edit: October 16, 2014, 11:15:35 PM by happyman0073 »

Offline seabeds

  • Newbie
  • *
  • Posts: 35
  • Karma: 0
    • Seaside TTT
Re: ULX MySQLOO
« Reply #73 on: January 29, 2016, 09:44:12 PM »
Obviously this is quite old, but since i am not able to test it out i'm asking, would this still work on the current version of ULX?