ULX

Poll

Would this be useful for you?

Yes
No

Author Topic: ULX MySQLOO  (Read 70779 times)

0 Members and 1 Guest are viewing this topic.

Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #45 on: October 20, 2013, 12:56:04 PM »
Have you done any further work on this MK? I would very much appreciate a version that I know will work 100% and preferably add old users to the database as well as new ones.

Thanks.

Offline okiedoke

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: ULX MySQLOO
« Reply #46 on: November 06, 2013, 06:18:00 AM »
I would love to try this too but would like assurances from the community that it works as intended.
My 11 servers have collectively around 900 users if you include my 'Regular' and 'RegularPlus' ranks. I am happy to manually add them in using phpMyAdmin for the smallest server first to check it works but don't want to do ALL of them if it doesn't :P

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: ULX MySQLOO
« Reply #47 on: November 11, 2013, 04:11:23 AM »
Yeah... seems to be broke still. I'll see what I can do to see if I can fix it. He appears to not have time of care anymore. So let's see what we can do.

Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Cobra

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: ULX MySQLOO
« Reply #48 on: November 12, 2013, 01:47:01 AM »
Yeah... seems to be broke still. I'll see what I can do to see if I can fix it. He appears to not have time of care anymore. So let's see what we can do.

img

That would be great. I really need this for my second server.

Offline Chase

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: ULX MySQLOO
« Reply #49 on: December 27, 2013, 01:54:53 PM »
Yeah... seems to be broke still. I'll see what I can do to see if I can fix it. He appears to not have time of care anymore. So let's see what we can do.

Sorry for bumping, but do you have any updates on this so far? I would love to use this on my server but I don't have any knowledge to fix this.
« Last Edit: December 27, 2013, 02:16:29 PM by JamminR »

Offline Doc

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: ULX MySQLOO
« Reply #50 on: January 10, 2014, 08:52:10 PM »
i have a error :/


Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #51 on: January 11, 2014, 01:16:11 AM »
Did you install the MySQLOO Module? It seems you're missing something.

Offline Doc

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: ULX MySQLOO
« Reply #52 on: January 11, 2014, 04:31:25 AM »
Did you install the MySQLOO Module? It seems you're missing something.

Then lower the dll and place as stated in the post ....
Although I have many dll tmysql mysql and I mention ....

That affects?
=========
For another mysql down (for some reason there is more than one with the same name ..)
and this error is only ...
« Last Edit: January 11, 2014, 05:48:33 AM by Doc »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #53 on: January 11, 2014, 06:17:58 PM »
You're missing something.

Some script is trying to call functions that simply don't exist.

They could be missing, or the script that contains those functions may not have loaded due to an error somewhere in the script.

Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #54 on: January 16, 2014, 04:50:21 PM »
It's an error in the script, as far as I know. I have MySQLOO installed correctly as I use it for other functions, yet this script tells me it is missing.

I would be eternally grateful if you could fix this, or even better, post your own version! Feeling generous?  ;)

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #55 on: January 16, 2014, 06:29:43 PM »
Mine is posted as replies in a few threads. Look around. :)

Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #56 on: January 17, 2014, 05:01:45 AM »
The only thing I can find is you mentioning you have code and an attachment from 2008 xD

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #57 on: January 17, 2014, 05:12:18 AM »
Here

I'm not going to bother explaining it. I hope you can make heads or tails of it. This is tailored for my server. You could modify it easily enough for yours.

It only handles user groups and bans.

I added the required functions to make this just work. Add it to an autorun file in your lua/autorun/server folder. Go in and change the console commands and messages to your liking, as well as the settings at the top.

There are some things in there that will need to be removed as they are gamemode specific for my Stranded server. Also SGS_SendMessage is just a fancy way of doing print(). You'll need to remove those or modify them too as that function isn't included in this script.

Code: [Select]
require("mysqloo")
G4PSQL = {}
 
local DATABASE_HOST = "127.0.0.1"
local DATABASE_PORT = 3306
local DATABASE_NAME = "g4padmin"
local DATABASE_USERNAME = "root"
local DATABASE_PASSWORD = ""
local DATABSE_TABLE = "userauth"

function G4PSQL_Init()

G4PSQL_ConnectToDatabase()
timer.Simple(60, G4PSQL_Init )

end
hook.Add( "Initialize", "G4PSQL_Init", G4PSQL_Init )

function G4PSQL_Format( str )
if not str then return "NULL" end
return string.format( "%q", str )
end

function Escape( str )
if not G4PSQL.db then
Msg( "Not connected to DB.\n" )
return
end

if not str then return end

local esc = G4PSQL.db:escape( str )
if not esc then
return nil
end
return esc
end


function G4PSQL_ConnectToDatabase()
G4PSQL.db = mysqloo.connect( "127.0.0.1", "root", "", "g4padmin", 3306 )
G4PSQL.db:connect()
end

function G4PSQL_PlayerAuthDB( ply )

if G4PSQL.db == nil then
G4PSQL_ConnectToDatabase()
end

if G4PSQL.db:status() == 0 then
local sid = ply:SteamID()
print("Checking for: " .. Escape( sid ) )
local q1 = G4PSQL.db:query("SELECT * FROM " ..DATABSE_TABLE.. " WHERE steamid = "..G4PSQL_Format( Escape( sid ) ).."")
function q1:onSuccess( data )
if data[1] then
--PrintTable(data)
ply.steamid = data[1]["steamid"]
ply.name = data[1]["pname"]
ply.group = data[1]["pgroup"]
ply.banned = data[1]["banned"]
ply.lastplayed = data[1]["lastplayed"]
--ServerLog("/////PLAYER DATA FOUND/////" .. "\n")
--ServerLog("Name: " .. ply.name .. "\n")
--ServerLog("SteamID: " .. ply.steamid .. "\n")
--ServerLog("Group: " .. ply.group .. "\n")
--ServerLog("Last Played: " .. ply.lastplayed .. "\n")
--ServerLog("Banned?: " .. ply.banned .. "\n")
--ServerLog("///////////////////////////" .. "\n")

if ply.name != ply:Nick() then
--ServerLog( "Updating name for player: " ..ply:Nick() .. "\n" )
local q2 = G4PSQL.db:query("UPDATE " ..DATABSE_TABLE.. " SET pname="..G4PSQL_Format( Escape( ply:Nick() ) ) .. " WHERE steamid=" ..G4PSQL_Format( Escape( sid ) ) )
function q2:onSuccess( data2 )
--ServerLog( "Name updated sucessfully!\n" )
end
function q2:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q2:start()
end

--ServerLog( "AUTHING PLAYER: " ..ply:Nick().. " in group (" ..ply.group..")." .. "\n" )
ULib.ucl.addUser( ply:SteamID(), _, _, ply.group )
local q4 = G4PSQL.db:query("UPDATE " ..DATABSE_TABLE.. " SET lastplayed="..G4PSQL_Format( Escape( tostring(os.date("%y/%m/%d")) ) ) .. " WHERE steamid=" ..G4PSQL_Format( Escape( sid ) ) )
function q4:onSuccess( data4 )
--ServerLog( "User Data (lastplayed) updated sucessfully!\n" )
end
function q4:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q4:start()

if string.upper(ply.banned) == "TRUE" then
ULib.kick( ply, "BANNED! Visit our website at [url=http://www.g4p.org]www.g4p.org[/url] to dispute this ban." )
end
ULib.tsay(ply, "Welcome back " ..ply:Nick().. ", you have been authenticated as: " ..ply.group..".", true)
ply:Spawn()
else
--print("No Entry Found")
--ServerLog("No Results Found ... Creating Entry\n")
local q3 = G4PSQL.db:query( "INSERT INTO " ..DATABSE_TABLE.. " ( steamid, pname, pgroup, lastplayed, banned ) VALUES( " ..G4PSQL_Format( Escape( sid ) ) .. ", " ..G4PSQL_Format( Escape( ply:Nick() ) ) .. ", " ..G4PSQL_Format( Escape( "user" ) ) .. ", " ..G4PSQL_Format( Escape( tostring(os.date("%y/%m/%d")) ) ) .. ", " ..G4PSQL_Format( Escape( "FALSE" ) ).. " )" )
function q3:onSuccess( data3 )
--ServerLog( "Entry added sucessfully!\n" )
end
function q3:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q3:start()
ply:Spawn()
end
end
q1:start()
else
G4PSQL_RetryAuth( ply )
return
end
end
hook.Add( "PlayerAuthed", "G4PSQL_PlayerAuthDB", G4PSQL_PlayerAuthDB )

function G4PSQL_RetryAuth( ply )
if not ply.retries then ply.retries = 3 end

if ply.retries > 0 then
ply.retries = ply.retries - 1
--ServerLog("DATABASE NOT CONNECTED - RETRYING (" .. tostring(ply.retries) .. " retries left)" .. "\n")
G4PSQL_ConnectToDatabase()
timer.Simple(2, function() G4PSQL_PlayerAuthDB( ply ) end)
else
ServerLog( "FALLBACK AUTHENTICATION... DATABASE CAN NOT BE CONNECTED TO\n" )
--ServerLog( "AUTHING PLAYER: " ..ply:Nick().. " in group (user)." .. "\n" )
ULib.ucl.addUser( ply:SteamID(), _, _, "user" )
ply:Spawn()
end
end

function G4PSQL_ChangeGroup( ply, cmd, args )
local sid = args[1]
local group = tostring(string.lower(args[2]))
local mut = nil
if #args == 3 then
mut = tostring(string.lower(args[3]))
end


if !IsValid( ply ) or ply:IsUserGroup("superadmin") then


if #args < 2 or #args > 3 then
SGS_SendMessage(ply, "Wrong number of arguements!")
return
end

if (string.sub(sid, 1, 5) == "STEAM") then
sid = sid
qtype = 1
else
if IsValid(ULib.getUser(sid)) then
sid = ULib.getUser(sid)
qtype = 2
if not sid then
SGS_SendMessage(ply, "User not found!")
return
end
else
SGS_SendMessage(ply, "User not found!")
return
end
end

local gcheck = false
for k, v in pairs(ULib.ucl.groups) do
if group == k then
SGS_SendMessage(ply, "Checking " ..group.. " against " .. k)
gcheck = true
break
end
end
if gcheck == false then
SGS_SendMessage(ply, "Group doesn't exist!")
return
end

if G4PSQL.db:status() == 0 then
if qtype == 1 then
local q1 = G4PSQL.db:query("SELECT * FROM " ..DATABSE_TABLE.. " WHERE steamid = "..G4PSQL_Format( Escape( sid ) ).."")
function q1:onSuccess( data )
if data[1] then
SGS_SendMessage(ply, "Updating group for steamID: (" ..sid .. ")")
local q2 = G4PSQL.db:query("UPDATE " ..DATABSE_TABLE.. " SET pgroup="..G4PSQL_Format( Escape( group ) ) .. " WHERE steamid=" ..G4PSQL_Format( Escape( sid ) ) )
function q2:onSuccess( data2 )
SGS_SendMessage(ply, "Player (" .. sid .. ") Group Changed!")
end
function q2:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q2:start()
else
SGS_SendMessage(ply, "No Entry Found")
SGS_SendMessage(ply, "No Results Found ... Creating Entry")
local q3 = G4PSQL.db:query( "INSERT INTO " ..DATABSE_TABLE.. " ( steamid, pname, pgroup, lastplayed, banned ) VALUES( " ..G4PSQL_Format( Escape( sid ) ) .. ", " ..G4PSQL_Format( Escape( "ADMIN ENTERED" ) ) .. ", " .. G4PSQL_Format( Escape( group ) ) .. ", " ..G4PSQL_Format( Escape( tostring("NEVER") ) ) .. ", " ..G4PSQL_Format( Escape( "FALSE" ) ).. " )" )
function q3:onSuccess( data3 )
SGS_SendMessage(ply, "Entry added sucessfully!")
end
function q3:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q3:start()
end

if mut and mut == "yes" then

local muttime = SGS_DateStep()
local q4 = G4PSQL.db:query("UPDATE " ..DATABSE_TABLE.. " SET mutexpire="..G4PSQL_Format( Escape( muttime ) ) .. " WHERE steamid=" ..G4PSQL_Format( Escape( sid ) ) )
function q4:onSuccess( data2 )
SGS_SendMessage(ply, "Player (" .. sid .. ") MUT Expiration Data Added!")
end
function q4:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q4:start()

end
end
q1:start()
else
local q1 = G4PSQL.db:query("SELECT * FROM " ..DATABSE_TABLE.. " WHERE steamid = "..G4PSQL_Format( Escape( sid:SteamID() ) ).."")
function q1:onSuccess( data )
if data[1] then
SGS_SendMessage(ply, "Updating group for player: " ..sid:Nick())
local q2 = G4PSQL.db:query("UPDATE " ..DATABSE_TABLE.. " SET pgroup="..G4PSQL_Format( Escape( group ) ) .. " WHERE steamid=" ..G4PSQL_Format( Escape( sid:SteamID() ) ) )
function q2:onSuccess( data2 )
SGS_SendMessage(ply, "Player Group Changed!")
ULib.ucl.addUser( sid:SteamID(), _, _, group )
end
function q2:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q2:start()
else
SGS_SendMessage(ply, "No Entry Found")
SGS_SendMessage(ply, "No Results Found ... Creating Entry")
local q3 = G4PSQL.db:query( "INSERT INTO " ..DATABSE_TABLE.. " ( steamid, pname, pgroup, lastplayed, banned ) VALUES( " ..G4PSQL_Format( Escape( sid:SteamID() ) ) .. ", " ..G4PSQL_Format( Escape( "ADMIN ENTERED" ) ) .. ", " .. G4PSQL_Format( Escape( group ) ) .. ", " ..G4PSQL_Format( Escape( tostring("NEVER") ) ) .. ", " ..G4PSQL_Format( Escape( "FALSE" ) ).. " )" )
function q3:onSuccess( data3 )
SGS_SendMessage(ply, "Entry added sucessfully!")
end
function q3:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q3:start()
end
end
q1:start()
end
else
SGS_SendMessage(ply, "DATABASE NOT CONNECTED PLEASE TRY AGAIN!")
G4PSQL_ConnectToDatabase()
end
else
SGS_SendMessage(ply, "This command is reserved for administrators only!")
end
end
concommand.Add( "g4p_setgroup", G4PSQL_ChangeGroup)

function G4PSQL_Ban( ply, cmd, args )
local sid = args[1]
local reason = args[2]
local badmin = "NONE"
local baid = "NONE"

if !IsValid( ply ) or ply:IsAdmin() then
if IsValid(ply) then
badmin = ply:Nick()
bacolor = team.GetColor(ply:Team())
baid = ply:SteamID()
else
badmin = "(Console)"
bacolor = Color(80,80,80,255)
baid = "(Console)"
end

if #args != 2 then
SGS_SendMessage(ply, "Wrong number of arguements! Be sure to include the name/steamID and a reason. Also be sure the reason is in QUOTES.")
return
end

if (string.sub(sid, 1, 5) == "STEAM") then
sid = sid
qtype = 1
else
if IsValid(ULib.getUser(sid)) then
sid = ULib.getUser(sid)
qtype = 2
if not sid then
SGS_SendMessage(ply, "User not found!")
return
end
else
SGS_SendMessage(ply, "User not found!")
return
end
end

if G4PSQL.db:status() == 0 then
if qtype == 2 then
local q1 = G4PSQL.db:query("SELECT * FROM " ..DATABSE_TABLE.. " WHERE steamid = "..G4PSQL_Format( Escape( sid:SteamID() ) ).."")
function q1:onSuccess( data )
if data[1] then
SGS_SendMessage(ply, "Banning player: " ..sid:Nick())
local q2 = G4PSQL.db:query("UPDATE " ..DATABSE_TABLE.. " SET banned=" .. G4PSQL_Format( Escape( "TRUE" ) ) .. ", badmin=" .. G4PSQL_Format( Escape( baid ) ) .. ", breason=" .. G4PSQL_Format( Escape( reason ) ) .. " WHERE steamid=" ..G4PSQL_Format( Escape( sid:SteamID() ) ) )
function q2:onSuccess( data2 )
SGS_SendMessage(ply, "Player Banned for " ..reason.."!")
ULib.tsayColor(_, 1, Color(0,0,0,255), "(", Color(255,0,0,255), sid:Nick(), Color(0,0,0,255), ") ", Color(255,255,255,255), "was globally banned by ", bacolor, badmin, Color(255,255,255,255), " for ", Color(0,0,0,255), reason, Color(255,255,255,255), ".")
ULib.kick( sid, "BANNED! Visit our website at [url=http://www.g4p.org]www.g4p.org[/url] to dispute this ban."  )
end
function q2:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q2:start()
else
SGS_SendMessage(ply, "No Entry Found")
SGS_SendMessage(ply, "No Results Found ... Creating Entry")
local q3 = G4PSQL.db:query( "INSERT INTO " ..DATABSE_TABLE.. " ( steamid, pname, pgroup, lastplayed, banned, badmin, breason ) VALUES( " ..G4PSQL_Format( Escape( sid:SteamID() ) ) .. ", " ..G4PSQL_Format( Escape( "ADMIN ENTERED" ) ) .. ", " .. G4PSQL_Format( Escape( "user" ) ) .. ", " ..G4PSQL_Format( Escape( tostring("NEVER") ) ) .. ", " ..G4PSQL_Format( Escape( "TRUE" ) ).. ", " ..G4PSQL_Format( Escape( "NONE" ) ).. ", " ..G4PSQL_Format( Escape( reason ) ).." )" )
function q3:onSuccess( data3 )
SGS_SendMessage(ply, "Player Banned for " ..reason.."!")
ULib.tsayColor(_, 1, Color(0,0,0,255), "(", Color(255,0,0,255), sid:Nick(), Color(0,0,0,255), ") ", Color(255,255,255,255), "was globally banned by ", bacolor, badmin, Color(255,255,255,255), " for ", Color(0,0,0,255), reason, Color(255,255,255,255), ".")
ULib.kick( sid:SteamID(), "BANNED! Visit our website at [url=http://www.g4p.org]www.g4p.org[/url] to dispute this ban."  )
end
function q3:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q3:start()
end
end
q1:start()
else
local q1 = G4PSQL.db:query("SELECT * FROM " ..DATABSE_TABLE.. " WHERE steamid = "..G4PSQL_Format( Escape( sid ) ).."")
function q1:onSuccess( data )
if data[1] then
SGS_SendMessage(ply, "Banning SteamID: " ..sid)
local q2 = G4PSQL.db:query("UPDATE " ..DATABSE_TABLE.. " SET banned=" .. G4PSQL_Format( Escape( "TRUE" ) ) .. ", badmin=" .. G4PSQL_Format( Escape( baid ) ) .. ", breason=" .. G4PSQL_Format( Escape( reason ) ) .. " WHERE steamid=" ..G4PSQL_Format( Escape( sid ) ) )
function q2:onSuccess( data2 )
SGS_SendMessage(ply, "SteamID (" .. sid .. ") Banned for " ..reason.."!")
ULib.tsayColor(_, 1, Color(0,0,0,255), "(", Color(255,0,0,255), sid, Color(0,0,0,255), ") ", Color(255,255,255,255), "was globally banned by ", bacolor, badmin, Color(255,255,255,255), " for ", Color(0,0,0,255), reason, Color(255,255,255,255), ".")
end
function q2:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q2:start()
else
SGS_SendMessage(ply, "No Entry Found")
SGS_SendMessage(ply, "No Results Found ... Creating Entry")
local q3 = G4PSQL.db:query( "INSERT INTO " ..DATABSE_TABLE.. " ( steamid, pname, pgroup, lastplayed, banned, badmin, breason ) VALUES( " ..G4PSQL_Format( Escape( sid ) ) .. ", " ..G4PSQL_Format( Escape( "ADMIN ENTERED" ) ) .. ", " .. G4PSQL_Format( Escape( "user" ) ) .. ", " ..G4PSQL_Format( Escape( tostring("NEVER") ) ) .. ", " ..G4PSQL_Format( Escape( "TRUE" ) ).. ", " ..G4PSQL_Format( Escape( "NONE" ) ).. ", " ..G4PSQL_Format( Escape( reason ) ).. " )" )
function q3:onSuccess( data3 )
SGS_SendMessage(ply, "SteamID (" .. sid .. ") Banned for " ..reason.."!")
ULib.tsayColor(_, 1, Color(0,0,0,255), "(", Color(255,0,0,255), sid, Color(0,0,0,255), ") ", Color(255,255,255,255), "was globally banned by ", bacolor, badmin, Color(255,255,255,255), " for ", Color(0,0,0,255), reason, Color(255,255,255,255), ".")
end
function q3:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q3:start()
end
end
q1:start()
end
else
SGS_SendMessage(ply, "DATABASE NOT CONNECTED PLEASE TRY AGAIN!")
G4PSQL_ConnectToDatabase()
end
else
SGS_SendMessage(ply, "This command is reserved for administrators only!")
end
end
concommand.Add( "g4p_ban", G4PSQL_Ban)


function G4PSQL_UnBan( ply, cmd, args )
local sid = args[1]
banmin = "NONE"
bacolor = Color(255,255,255,255)

if !IsValid( ply ) or ply:IsAdmin() then
if IsValid(ply) then
badmin = ply:Nick()
bacolor = team.GetColor(ply:Team())
else
badmin = "(Console)"
bacolor = Color(80,80,80,255)
end

if #args != 1 then
SGS_SendMessage(ply, "Wrong number of arguements!")
end

if G4PSQL.db:status() == 0 then
local q1 = G4PSQL.db:query("SELECT * FROM " ..DATABSE_TABLE.. " WHERE steamid = "..G4PSQL_Format( Escape( sid ) ).."")
function q1:onSuccess( data )
if data[1] then
if data[1]["banned"] == "TRUE" then
SGS_SendMessage(ply, "UnBanning SteamID: (" ..sid .. ")")
local q2 = G4PSQL.db:query("UPDATE " ..DATABSE_TABLE.. " SET banned="..G4PSQL_Format( Escape( "FALSE" ) ) .. " WHERE steamid=" ..G4PSQL_Format( Escape( sid ) ) )
function q2:onSuccess( data2 )
ULib.tsayColor(_, 1, Color(0,0,0,255), "(", Color(255,0,0,255), sid, Color(0,0,0,255), ") ", Color(255,255,255,255), "was unbanned by ", bacolor, badmin, Color(255,255,255,255), ".")
SGS_SendMessage(ply, "SteamID (" .. sid .. ") Unbanned!")
end
function q2:onError( Q, E )
ServerLog( "ERROR!!! " .. Q .. "\n" )
ServerLog( "ERROR!!! " .. E .. "\n" )
end
q2:start()
else
SGS_SendMessage(ply, "Player Found... but player isn't currently banned...")
end
else
SGS_SendMessage(ply, "No Entry Found")
SGS_SendMessage(ply, "Couldn't find SteamID: " .. sid)
end
end
q1:start()
else
SGS_SendMessage(ply, "DATABASE NOT CONNECTED PLEASE TRY AGAIN!")
G4PSQL_ConnectToDatabase()
end
else
SGS_SendMessage(ply, "This command is reserved for administrators only!")
end
end
concommand.Add( "g4p_unban", G4PSQL_UnBan)


function SGS_SendMessage(ply, message)

if IsValid(ply) then
ply:PrintMessage(HUD_PRINTCONSOLE, message)
else
ServerLog(message .. "\n")
end

end

function SGS_DateStep()

local d = os.date("%d")
local m = tonumber(os.date("%m"))
local y = tonumber(os.date("%Y"))

if m == 12 then
m = 1
y = y + 1
else
m = m + 1
end

if m < 10 then
m = tostring(m)
m = "0" .. m
end

local newdtg = tostring(m) .. "/" .. tostring(d) .. "/" .. tostring(y)

return newdtg

end
« Last Edit: January 17, 2014, 05:21:19 AM by MrPresident »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ULX MySQLOO
« Reply #58 on: January 17, 2014, 05:15:47 AM »
I changed it so now it should work without any code modification. All you need is to change things to your liking such as console commands and messages displayed as well as some of the settings at the top.
« Last Edit: January 17, 2014, 05:22:09 AM by MrPresident »

Offline JakeGriffin

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: ULX MySQLOO
« Reply #59 on: January 17, 2014, 05:23:12 AM »
Thanks a bunch!