Ulysses
Ulysses Stuff => Releases => Topic started by: MRDRMUFN on August 13, 2012, 08:36:34 PM
-
I have taken the UtimeM plugin and have modified it work with the 'gm_mysqloo' module. This allows Linux servers to store Utime data on a MySQL database.
Works for both windows and Linux servers.
Requires:
ULib, gm_mysqloo
Released under Creative Commons
[EDIT] uploaded revision 1 "Fixes random disconnects"
-
Thanks!
I love seeing an old release become new and better through the talents of our community.
-
No problem ;D. there might be some debug code still in there you can just remove those print msg's if they get annoying
-
Nice!
-
Very nice, very nice. Will be used on [MK] so thank you.
-
Thanks this is my first personal coding project that i've actually finished :D
I did it because i needed it for my own server.
-
Awesome! Karma for you!
Now if you could do the same for UBan (http://forums.ulyssesmod.net/index.php/topic,921.0.html) that would be even more awesome!
-
heads up! default port for mysql is 3306, in the lua file the port is 3308
just wanted to point it out in case someone gets confused why it doesn't connect to the db :)
-
Looks nice =) Finally i found what i've been looking for.
Almost, could it be possible to track people from different servers like , Current server time and total server time?
-
it works exactly as Utime did. I've only modified the library it relies on. Also you should use the Rev-1 version i uploaded. It fixes a serious bug i had with the first version. Critical bug if you use Auto-promote. Sorry just got around to uploading it.
-
Thank you for your work on this, it was one of the things I was worried about for gmod13.
As Emilhem said, a port of uban would be really useful.
Edit: Did it myself http://forums.ulyssesmod.net/index.php/topic,921.msg26717.html#msg26717
-
Thank you for this. I used to have a version of utime that did this exactly, and you could also change a player's time while IG. Unfortunately due to the Garry's Mod 13 upgrade, it kinda killed the derma panals, which made Utime just record time in a database as this one does.
I hope one day you might do the same with this really amazing version of utime so ply:IsSuperAdmin can change players time IG, or maybe even integrate it with xgui.
Nice work though ;D
-
Currently in the process of trying to get this to work...
-
If you do, post it here :D
-
Here is my rewrite of this addon. It (hopefully) fixes a rare case where the time would get saved after a player joined but before the db responded, causing their time to reset to zero. It also properly handles a database connection loss.
The only difference, functionally, from MRDRMUFN's version is that it does not store the team, you will have to modify the queries if you want it to save that info.
https://dl.dropboxusercontent.com/u/7934790/gmod/utimem.zip
-
I'm getting this error when a player joins.
[ERROR] addons/utimem/lua/autorun/cl_utime.lua:310: attempt to index local 'cpanel' (a nil value)
1. buildCP - addons/utimem/lua/autorun/cl_utime.lua:310
2. resetCvars - addons/utimem/lua/autorun/cl_utime.lua:305
3. fn - addons/utimem/lua/autorun/cl_utime.lua:406
4. unknown - addons/ulib/lua/ulib/shared/hook.lua:183
5. GetAll - [C]:-1
6. fn - addons/ulx/lua/ulx/modules/sh/chat.lua:245
7. Call - addons/ulib/lua/ulib/shared/hook.lua:183
8. fn - addons/ulib/lua/ulib/cl_init.lua:40
9. unknown - addons/ulib/lua/ulib/shared/hook.lua:183
[anulka.w1106|3|STEAM_0:0:61718709] Lua Error:
controlpanel.Get() - Error creating a ControlPanel!
You're calling this function too early! Call it in a hook!
[anulka.w1106|3|STEAM_0:0:61718709] Lua Error:
[ERROR] addons/utimem/lua/autorun/cl_utime.lua:310: attempt to index local 'cpanel' (a nil value)
1. buildCP - addons/utimem/lua/autorun/cl_utime.lua:310
2. resetCvars - addons/utimem/lua/autorun/cl_utime.lua:305
3. fn - addons/utimem/lua/autorun/cl_utime.lua:406
4. unknown - addons/ulib/lua/ulib/shared/hook.lua:183
[anulka.w1106|3|STEAM_0:0:61718709] Lua Error:
controlpanel.Get() - Error creating a ControlPanel!
You're calling this function too early! Call it in a hook!
-
Make sure your using the latest 'fix' by Tweak. It appears several posts after the original release, June 29 I think.
Also make sure you've got the latest svn of Utime from https://github.com/Nayruden/Ulysses/
Seems I remember seeing the cpanel bug you mention fixed months if not years ago.
-
I was using his fix, I will try the latest svn. Are you suggesting that I should mix the latest svn with Tweak's fix?
EDIT: Newest svn gives me the same error, strange thing is I only get it on my Zombie Survival server and not on my sandbox...
-
Yeah you can mix them, if you overwrite just the SVN's sv_utime.lua with mine. I think the cpanel error is from running it on gamemodes without a spawnmenu. I'll see about including the fixed client file with mine.
-
Yeah you can mix them, if you overwrite just the SVN's sv_utime.lua with mine. I think the cpanel error is from running it on gamemodes without a spawnmenu. I'll see about including the fixed client file with mine.
It will mean the world to me if you could fix the UtimeMOO so it works with a gamemode without a spawnmenu :D
EDIT: I assume utime uses pdata, so is there a way to import the pdata to mysql?
-
Not sure what you mean by pdata, the original utime stores data in the SQLite database (sv.db). It's possible to migrate the data from SQLite to MySQL with a script, or maybe there is a way to just dump it to CSV and import it straight to MySQL, I dunno. The table structure is a little different. I did it using Lua but I don't have the script anymore...
Anyway, you can just grab the cl_utime file from the official SVN and overwrite it, that should make it not error when there is no spawnmenu.
-
Not sure what you mean by pdata, the original utime stores data in the SQLite database (sv.db). It's possible to migrate the data from SQLite to MySQL with a script, or maybe there is a way to just dump it to CSV and import it straight to MySQL, I dunno. The table structure is a little different. I did it using Lua but I don't have the script anymore...
Anyway, you can just grab the cl_utime file from the official SVN and overwrite it, that should make it not error when there is no spawnmenu.
Oh my bad, I assumed that all addons used "pdata" I've seen some other ones have it. I will try to import it directly.
-
Not sure what you mean by pdata, the original utime stores data in the SQLite database (sv.db). It's possible to migrate the data from SQLite to MySQL with a script, or maybe there is a way to just dump it to CSV and import it straight to MySQL, I dunno. The table structure is a little different. I did it using Lua but I don't have the script anymore...
Anyway, you can just grab the cl_utime file from the official SVN and overwrite it, that should make it not error when there is no spawnmenu.
I successfully extracted the SQLite data and imported it to my MySQL db and it works on my sandbox and zombie survival server! Thanks :D
-
Scratch that it worked on the zombie survival server. I still get this error and I've updated the cl_utime file....
[antbert|15|STEAM_0:1:70488492] Lua Error:
[ERROR] addons/utimem/lua/autorun/cl_utime.lua:310: attempt to index local 'cpanel' (a nil value)
1. buildCP - addons/utimem/lua/autorun/cl_utime.lua:310
2. resetCvars - addons/utimem/lua/autorun/cl_utime.lua:305
3. fn - addons/utimem/lua/autorun/cl_utime.lua:334
4. unknown - addons/ulib/lua/ulib/shared/hook.lua:183
[antbert|15|STEAM_0:1:70488492] Lua Error:
controlpanel.Get() - Error creating a ControlPanel!
You're calling this function too early! Call it in a hook!
[antbert|15|STEAM_0:1:70488492] Lua Error:
[ERROR] addons/utimem/lua/autorun/cl_utime.lua:310: attempt to index local 'cpanel' (a nil value)
1. buildCP - addons/utimem/lua/autorun/cl_utime.lua:310
2. resetCvars - addons/utimem/lua/autorun/cl_utime.lua:305
3. fn - addons/utimem/lua/autorun/cl_utime.lua:334
4. unknown - addons/ulib/lua/ulib/shared/hook.lua:183
5. TraceLine - [C]:-1
6. unknown - addons/utimem/lua/autorun/cl_utime.lua:143
-
And you're using the cl_utime.lua from the official SVN?
-
And you're using the cl_utime.lua from the official SVN?http://forums.ulyssesmod.net/Themes/default/images/bbc/email.gif
I'm using this svn: "https://github.com/Nayruden/Ulysses/ (https://github.com/Nayruden/Ulysses/)".
-
Hmm, that is weird. And zombie survival does not have a spawnmenu, correct? You might be able to get away with just commenting out that block of code (lines 322-330) just to suppress the error for now...
-
Hmm, that is weird. And zombie survival does not have a spawnmenu, correct? You might be able to get away with just commenting out that block of code (lines 322-330) just to suppress the error for now...
Uhm, not sure what you mean with a spawn menu, but Zombies can change class if they press F3.
Edit: *facepalm* did you mean "Q" where you spawn props/etc?
-
yeah that
-
Okay, well no it does not have a spawn menu.
-
I need help setting up mysqloo for linux, I've done it for pc, but I don't understand what to do for linux and which files to use.
-
I need help setting up mysqloo for linux, I've done it for pc, but I don't understand what to do for linux and which files to use.
See the bottom of this post, which provides different files/links and locations.
http://facepunch.com/showthread.php?t=1220537
(all i know to do to help, but figure thats a start)
-
See the bottom of this post, which provides different files/links and locations.
http://facepunch.com/showthread.php?t=1220537
(all i know to do to help, but figure thats a start)
I've tried all of that, followed tutorials, etc. but it still won't work! :(
-
"Doesn't work" tells us absolutely nothing. Are you getting an error in your console? Have you installed the dll in lua/bin and libmysql alongside the srcds executable? Are you sure your database connection info is correct?
-
"Doesn't work" tells us absolutely nothing. Are you getting an error in your console? Have you installed the dll in lua/bin and libmysql alongside the srcds executable? Are you sure your database connection info is correct?
Don't worry, I decided to backup all my work, and change the OS to Windows, because I've always preferred it over Linux :P
Edit: Now with mysqloo working, this addon shows no connectivity to the database I used.
-
[ERROR] addons/utimemoo/lua/autorun/cl_utime.lua:137: attempt to index global 'utilx' (a nil value)
1. unknown - addons/utimemoo/lua/autorun/cl_utime.lua:137
-
[ERROR] addons/utimemoo/lua/autorun/cl_utime.lua:137: attempt to index global 'utilx' (a nil value)
1. unknown - addons/utimemoo/lua/autorun/cl_utime.lua:137
I think you got an ancient version or something... try the one I posted
-
Uses sqlite instead of mysql so it dosent works, please fix it.
-
I am having an issue where random players get their times reset. They're still in the database just their time resets at 0.
-
I'd be down to try this but I'm curious, can you convert the data from the sv.db that the original utime uses to the mysql version this uses? I'd much rather use mysql.
-
I'd be down to try this but I'm curious, can you convert the data from the sv.db that the original utime uses to the mysql version this uses? I'd much rather use mysql.
That's a lot of work to convert mysqli to mysql in this game. I suppose someone would have to make another addon.
-
Using the version provided by TweaK https://dl.dropboxusercontent.com/u/7934790/gmod/utimem.zip
I still seem to have issues with peoples time being occasionally reset. Anyone else encountering this problem?
-
I'm replying to this topic as my issue is directly related to the modified script released by TweaK.
The aim of using MySQL for Utime is to use it on a website and get some quick info about some players and stuff.
The stock UTime addon does not save the Steam-ID, nor the current name of the player. This addon does that, which is a nice feature that I need.
However, an issue with the names is that they are not being saved in UTF-8, so german umlauts are being destroyed and all other characters that many people use are destroyed, too.
I've already changed the encoding in my MySQL table to utf8_unicode_ci, but the names are still being butchered and I suspect lua to be doing that.
Is there a way to get the script to input UTF-8 encoded characters?
As an example:
Jünger² Gabor
is being saved as
Jünger² Gabor
This is an excerpt of the update-query:
query( "UPDATE utime SET totaltime = " .. math.floor( ply:GetUTimeTotalTime() ) .. ", steamid = '" ..
ply:SteamID() .. "', playername = '" .. db:escape( ply:Nick() ) .. "' WHERE player = " ..
ply:UniqueID() .. ";", function() end )
-------------------------------------
I did it!
The thing that was missing was "SET NAMES 'utf8';" as the first query before any other queries. Also the playername row must be encoded in utf8_unicode_ci to allow UTF-8 encoded entries.
Here is how to install it:
I already have a UTime MySQL table with entries
1. Open your table structure via phpmyadmin
2. Edit the row "playername"
3. Change the collation to "utf8_unicode_ci"
If you do not have phpmyadmin and can only use SQL queries, use this one:
USE <database>;
ALTER TABLE `utime` CHANGE `playername` `playername` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
and replace "<database>" with the name of your database where utime is installed.
This is the first time I install UTime with MySQL
1. You do not have to change anything, the script automatically constructs the playernames table with UTF-8 encoding
You find the modified scripts in an attachment to this post which you can only see when being logged in.
-
I still seem to have issues with peoples time being occasionally reset. Anyone else encountering this problem?
It's not really fixable. It's supposed to be a really RARE issue though, because of utime saving the database information at 67 seconds, it's possible that before the player's time/data is loaded, the server saved when their data is at 0, small chance though.
-
It's not really fixable. It's supposed to be a really RARE issue though, because of utime saving the database information at 67 seconds, it's possible that before the player's time/data is loaded, the server saved when their data is at 0, small chance though.
Looks like it's fixed in the version posted right above you. All he did was add a simple loaded check on the player.
-
Looks like it's fixed in the version posted right above you. All he did was add a simple loaded check on the player.
From what I read he's just fixing certain names, but at the same time I didn't thoroughly check everything he did.
-
IIRC I only did some minor changes on the UTF-8 encoding, nothing else.
But I'm struggling with the occasional resets, too. My server is almost always full (16 Players) and in the last three days about 8 people complained about their time being reset. Is it possible that MySQL + LUA is unreliable?
Another quick browse through the code does not show anything interesting.
I desperately need Utime for MySQL for my !motd and other stats delivered via a webserver and this is slowly driving me nuts.
-
Do you know when the players who get reset joins? Have the server been empty for a long period before they do?
I've had something like that happen where the db connection would reset to "gone away"/ time out the first time it's used. I edited Pointshops (https://github.com/adamdburton/pointshop/blob/master/lua/pointshop/providers/mysql.lua#L83) way to do it with a "wrapper" which takes some sql string, a callback to be called with returned data and a optimal tries argument to limit the number of retries.
I wouldn't mind trying getting my hands dirty since I would have made my own version anyways... Is it okay to use github rather than uploading archives here?
-
I don't see any connection between server usage and the occasional resets. I've used an external MySQL Server (different VHost, same Hostmachine, so latency <1ms) and moved it on the same VHost, but that didn't change a thing (why would it, if the latency difference is about 0.5ms... *scratches head*).
I'm thinking about combining SQLite and MySQL where SQLite is actually used for storing/reading the time, but the time is regularly being pushed to MySQL, too. I only have one server, so that should do it. Although I'm still heavily annoyed by the inconsistency.