Poll

Would this be useful for you?

Yes
No

Author Topic: ULX MySQLOO  (Read 70757 times)

0 Members and 4 Guests are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #15 on: May 20, 2013, 11:51:45 AM »
Whoever wrote this script probably didn't put in any redundancy checks for connection checking.

My script has throwback errors if it detects that it lost connection and then it retries the connection, after failing 3 times in a row it reports the failures and then authenticates all users as guests to stop any other errors.

Anything could be causing connection issues. Does your SQL server reside on the same physical server as your gmod server? If not, it could be a timeout issue.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #16 on: May 21, 2013, 11:44:33 AM »
You will find that maintaining a connection (which is persistent for MySQLOO) is nearly impossible for cross-server databases.

Are you ever able to get a connection? Does it just lose it after time? If you never get a solid connection, it might be that your web server has disabled access to mySQL from off-site. I know a web host I used to use didn't allow external connections to the databases.

Offline Will Schuester

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: ULX MySQLOO
« Reply #17 on: May 28, 2013, 09:51:00 PM »
I've been trying to get this to work for the past three days now. Sadly, I'm out of luck...

For your information I have placed libmySQL.dll in the same directory as hl2.exe.
Also, gmsv_mysqloo_win32.dll is in garrysmod/garrysmod/lua/bin/.

From the console I used lua_run require("mysqloo"). After that command I receive zero errors.

The only issue I have is actually getting this script to run.

Here's its error:

Code: [Select]
Couldn't include file 'includes\modules\mysqloo.lua' (File not found) (@addons/ulx/lua/ulx/modules/sh/mysql.lua (line 9))

[ERROR] addons/ulx/lua/ulx/modules/sh/mysql.lua:9: Module not found!
  1. require - [C]:-1
   2. unknown - addons/ulx/lua/ulx/modules/sh/mysql.lua:9
    3. include - [C]:-1
     4. unknown - addons/ulx/lua/ulx/cl_init.lua:17
      5. include - [C]:-1
       6. unknown - addons/ulx/lua/ulib/modules/ulx_init.lua:4
        7. include - [C]:-1
         8. unknown - addons/ulib/lua/ulib/cl_init.lua:23
          9. include - [C]:-1
           10. unknown - addons/ulib/lua/autorun/ulib_init.lua:5


Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #18 on: June 04, 2013, 11:07:10 AM »
I'm getting the exact same error message, and I know that libmySQL.dll and mySQLOO.lua are installed correctly as I need them for other cross-server content I have on my servers.

Offline Sidewaykill

  • Newbie
  • *
  • Posts: 8
  • Karma: 2
Re: ULX MySQLOO
« Reply #19 on: June 07, 2013, 03:19:45 PM »
Yep, I also get that one.

Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #20 on: June 27, 2013, 10:31:38 AM »
Anyone know how to fix this issue yet?

Offline TweaK

  • Jr. Member
  • **
  • Posts: 80
  • Karma: 14
    • Garry's Mod Engineers
Re: ULX MySQLOO
« Reply #21 on: June 28, 2013, 09:52:39 PM »
Well, for one, mysqloo is not a lua file it is the dll that goes in lua/bin/. And when you say you did lua_run require('mysqloo') you did it on rcon or the server console directly, right? Running that in your client' console will not output anything. It doesn't make sense that it would not throw an error from console but say the module is missing when the addon tries to require it.

edit: now that I look at it, it's set up as a shared module when it should be server... so if you rename the "sh" folder to "sv" inside the addon it should work. I think the errors are just because it's trying to load mysqloo clientside.
« Last Edit: June 28, 2013, 09:55:49 PM by TweaK »


Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #22 on: June 29, 2013, 05:13:24 PM »
Well, for one, mysqloo is not a lua file it is the dll that goes in lua/bin/. And when you say you did lua_run require('mysqloo') you did it on rcon or the server console directly, right? Running that in your client' console will not output anything. It doesn't make sense that it would not throw an error from console but say the module is missing when the addon tries to require it.

edit: now that I look at it, it's set up as a shared module when it should be server... so if you rename the "sh" folder to "sv" inside the addon it should work. I think the errors are just because it's trying to load mysqloo clientside.

Changing the folder to sv does not make a difference.

When I run require('mysqloo') I get the error
Code: [Select]
Couldn't include file 'includes\modules\ mysqloo .lua' (File not found) (@lua_run (line 1)) which is the same error I receive upon starting the server. (I forgot to mention that previously.)

I mentioned in a previous post that I had libMySQL.dll and mySQLOO.lua installed correctly as I use them for other cross-server content. What I meant to say was mySQLOO.dll, instead of .lua. So both files are installed in the correct place, libMySQL.dll in the same directory as srcds.exe and MySQLOO.dll (actually called gmsv_mysqloo_win32.dll) inside lua/bin.
« Last Edit: June 29, 2013, 05:27:19 PM by JakeGriffin »

Offline TweaK

  • Jr. Member
  • **
  • Posts: 80
  • Karma: 14
    • Garry's Mod Engineers
Re: ULX MySQLOO
« Reply #23 on: June 30, 2013, 05:05:12 AM »
Try this
Code: [Select]
rcon lua_run require( [[mysqloo]] )rcon tends to mangle up console input when it comes to quotes as you can see it added spaces. If that doesn't throw an error on the server then I have no idea why it's happening, I can look into it more if needed since I don't actually have this addon installed, but I don't see anything else in the code that would cause this to happen...


Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #24 on: June 30, 2013, 11:11:43 AM »
I'm not sure if you're misunderstanding me or not, but I'm not calling mysqloo through RCON, it is the first line of the script. (require('mysqloo')).

It doesn't really matter anyway, I don't need the script right now, I just wanted to prepare for server expansion. If and when I need it, I'll hopefully work it out myself. Thanks for the help thus far :D

Offline TweaK

  • Jr. Member
  • **
  • Posts: 80
  • Karma: 14
    • Garry's Mod Engineers
Re: ULX MySQLOO
« Reply #25 on: June 30, 2013, 12:24:31 PM »
I was talking about the error you got
When I run require('mysqloo') I get the error
Code: [Select]
Couldn't include file 'includes\modules\ mysqloo .lua' (File not found) (@lua_run (line 1))
since it has a space before and after 'mysqloo' (which is obviously not going to exist on disk) I figured it was because you were running that through rcon.


Offline rainbow Dash

  • Newbie
  • *
  • Posts: 35
  • Karma: -2
  • Owner of Friendship is Gaming Servers
    • Friendship is Gaming
Re: ULX MySQLOO
« Reply #26 on: July 09, 2013, 04:56:40 AM »
I think this has been approached wrong.

In my opinion, It would be much better if this didn't read the ranks from the external database, but rather synced the local data file with the remote database whenever a player's rank changes, or a player connects. This way, any connection problems can be overlooked quite easily, and cause minimal disruptions for the server in the event of a failed connection, as the remote database would simply become a backup, only with the added feature of being able to display a players rank in a loadingurl.

How one would go about doing this, is beyond me. I have ideas, I just can't make them.

Your welcome to whomever feels inspired by that.
Uhm, whats a signature?

Offline Organik

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
    • Artifice Gaming Network
Re: ULX MySQLOO
« Reply #27 on: July 30, 2013, 08:46:27 PM »
I get an error in console occasionally when some people join:

Code: [Select]
addons/ulx mysql/lua/ulx/modules/sh/mysql.lua:54: attempt to call field 'adduserids' (a nil value)
I've tried changing it to "adduserid" instead but that just results in something along the lines of "bad argument" if I recall.

Could anyone tell me what's going on here?

EDIT: Here is the function around that line:
Code: [Select]
function LoadRank(ply)
local queryQ = ULXDB:query("SELECT * FROM `ulxmysql` WHERE steam = '" .. ply:SteamID() .. "'")
queryQ.onData = function(Q,D)
queryQ.onSuccess = function(q)
if checkQuery(q) then
print("You are already created!")
ulx.adduserids(nil,ply:SteamID(),D.groups)
end
end
end
queryQ.onError = function(Q,E) print("Q1") print(E) end
queryQ:start()
end
« Last Edit: July 30, 2013, 08:55:19 PM by Organik »

Offline Organik

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
    • Artifice Gaming Network
Re: ULX MySQLOO
« Reply #28 on: August 10, 2013, 07:06:31 PM »
Sorry for the bump, could anyone shed some light on this issue possibly?

Thanks

Offline Marmaduke

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: ULX MySQLOO
« Reply #29 on: August 14, 2013, 09:14:14 AM »
I managed to get it mostly working but I still have one problem.

I got rid of all the errors by wrapping the code in an "if SERVER then" if statement. But I still had issues with the script adding the user to the correct usergroup when they joined (saving the groups works fine, but if the player joins the server with a usergroup that doesn't match the database, their usergroup would not change). I fixed this by changing:

"ulx.adduserids(nil,ply:SteamID(),D.groups)"

to

"ulx.adduserid(nil,ply:SteamID(),D.groups)"

Now the script works as I want it to but there is one issue.

My ulx menu seems to fail to load a lot of data. There are no maps in the maps list. There are no adverts in the adverts list (although adverts still display in chat). In the sandbox subtab of the settings tab, no sliders are appearing. In the group manager menu, group members are not appearing, and permissions are not appearing.

I've done some testing over the past few hours and the problems stated above seem to be from the fact I changed "ulx.adduserids(nil,ply:SteamID(),D.groups)" to "ulx.adduserid(nil,ply:SteamID(),D.groups)". If I change it back, all the information is displayed correctly, however the script doesn't change users usergroups.

Any help is appreciated.

Thanks