Ulysses Stuff > Ulysses Release Archives
UTimeM - UTime for MySQL
Megiddo:
--- Quote from: RynO-SauruS on June 30, 2010, 10:50:08 AM ---I've fixed this error, but on the regular version of UTime. Is the cl_utime.lua file in this the same as the one in the original? If so I can attach the fixed file.
--- End quote ---
I think so
RynO-SauruS:
OK I've attached a slightly modified file that fixes the error that someone920 mentioned,
and also I've found a place where I fixed another error I was getting a long time ago.
And to Megiddo, the part I changed to fix the error that someone920 mentioned is this:
(Starting at line 31 and ending at line 38)
--- Code: ---function initialize( ent )
if ent == LocalPlayer() then -- Player has been initialized
gpanel = vgui.Create( "UTimeMain" )
gpanel:SetSize( gpanel.Wide, gpanel.Small )
hook.Remove( "OnEntityCreated", "UtimeInitialize" )
end
end
hook.Add( "OnEntityCreated", "UtimeInitialize", initialize )
--- End code ---
I changed it to this:
(Starting at line 31 and ending at line 36)
--- Code: ---function initialize()
gpanel = vgui.Create( "UTimeMain" )
gpanel:SetSize( gpanel.Wide, gpanel.Small )
hook.Remove( "InitPostEntity", "UtimeInitialize" )
end
hook.Add( "InitPostEntity", "UtimeInitialize", initialize )
--- End code ---
Let me know if this is flawed in some way.
saintwubbles:
Thanks RynO-SauruS, that works for me.
Edit: My small modifications to the mySQL queries in sv_utime.lua adding firstvisit and IP logging.
line 60
--- Code: ---result = xquery( "CREATE TABLE utime (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,player INTEGER UNSIGNED NOT NULL,ip VARCHAR(30) NOT NULL,totaltime INTEGER UNSIGNED NOT NULL,lastvisit INTEGER UNSIGNED NOT NULL,firstvisit INTEGER UNSIGNED NOT NULL,steamid VARCHAR(45) NOT NULL,playername VARCHAR(100) NOT NULL,team VARCHAR(45),PRIMARY KEY (id))" );
--- End code ---
line 86
--- Code: ---xquery( "UPDATE utime SET ip = '" .. ply:IPAddress() .. "', lastvisit = " .. os.time() .. " WHERE player = " .. uid .. ";" )
--- End code ---
line 101
--- Code: ---local result, succ, err = mysql.query(db, "INSERT into utime ( ip, player, totaltime, lastvisit, steamid, playername, team, firstvisit ) VALUES ( '" .. ply:IPAddress() .. "', " .. uid .. ", 0, " .. os.time() .. ", '" .. sid .. "', '" .. mysql.escape(db, nam) .. "', '" .. mysql.escape(db, tem) .. "', " .. os.time() .. ");")
--- End code ---
I hope this would be useful for someone.
Robin:
For everyone who got problems with it, means when it lags while the server is sending a query,
Replace all
-- Disconnect from server.
local succ, error = mysql.disconnect(db)
if(not succ) then
print("[UTime] Error disconnecting from server!")
end
with
-- Disconnect from server.
mysql.disconnect(db)
Becouse some servers don't send confirmations for a closed mysql connection back.
Thats why the Server freezes until that functions times out.
ACProdigy:
Wow, its been a long time since I've been here. It looks like things have changed since the last release, things broke, and the community was able and willing to patch the code as time went on. (Good job and thanks).
I'll be updating this plugin with some updates for compatibility, bugfixes, slightly refactored code, and user-defined options!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version