Skip to content

Commit e884110

Browse files
authored
fixed a bug
1 parent 864cef5 commit e884110

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

lua/sqlify/sql_banmanagement.lua

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function ULib.addBan( steamid, time, reason, name, admin )
99
-- No SteamID / Time, stop the script
1010
if steamid == nil then return end
1111
if time == nil then return end
12-
print("DBG1: "..steamid)
12+
1313
-- No Name!? Insert a false one
1414
if (name == nil) then
1515
if SQL_NoSteamName == true then
@@ -27,7 +27,7 @@ function ULib.addBan( steamid, time, reason, name, admin )
2727

2828
--Setup Admin Information
2929
local AdminName = "CONSOLE";
30-
local AdminSteam = "0";
30+
local AdminSteam = "CONSOLE";
3131
if admin != nil && admin:IsPlayer() then
3232
AdminName = admin:Nick()
3333
AdminSteam = admin:SteamID()
@@ -36,8 +36,8 @@ function ULib.addBan( steamid, time, reason, name, admin )
3636
--Are they already banned?
3737
local BanStatus = ULX_DB:prepare("SELECT BanID, ban_len FROM ba_bans WHERE steamid = ? LIMIT 1;")
3838
local SteamID64 = util.SteamIDTo64(steamid)
39-
print("DBG2: "..steamid)
40-
print("DBG3: "..SteamID64)
39+
print(steamid)
40+
print(SteamID64)
4141
BanStatus:setString( 1, SteamID64 )
4242
function BanStatus.onSuccess()
4343
local data = BanStatus:getData()
@@ -92,7 +92,7 @@ function SQL_InsertBan(steamid, name, BanLength, AdminName, AdminSteam, reason)
9292
AddBanQuery:setNumber( 9, 0) -- unban_time, will be unset.
9393
AddBanQuery:setString( 10, "") -- unban reason, will be unset.
9494
AddBanQuery:setNumber( 11, SQL_SERVERID ) -- server ID
95-
print("DBG4: "..steamid)
95+
print(steamid)
9696
function AddBanQuery.onSuccess()
9797
print("[ULX SQLify] - Ban Added!");
9898
if name == nil then
@@ -116,7 +116,7 @@ function SQL_InsertBan(steamid, name, BanLength, AdminName, AdminSteam, reason)
116116
AddBanQuery:start()
117117

118118
-- Regardless of outcome Kick player From Server
119-
RunConsoleCommand('kickid',steamid,"You've been banned from the server ");
119+
RunConsoleCommand('kickid',steamid,"You've been banned from the server - Reason: ".. SQL_Escape(reason));
120120
end
121121

122122
function SQL_ModifyBan(name, BanLength, reason, time, AdminName, steamid)
@@ -130,7 +130,6 @@ function SQL_ModifyBan(name, BanLength, reason, time, AdminName, steamid)
130130
UpdateBanQuery:setNumber( 2, BanLength )
131131
UpdateBanQuery:setString( 3, SQL_Escape(reason) )
132132
local SteamID64 = util.SteamIDTo64(steamid)
133-
print("DBG5: "..steamid)
134133
UpdateBanQuery:setString( 4, SteamID64 )
135134
function UpdateBanQuery.onSuccess()
136135
print("[ULX SQLify] - Ban Modified!");
@@ -191,7 +190,6 @@ function ULib.refreshBans()
191190
function BanList:onSuccess( data )
192191
for i = 1, #data do
193192
local LeL = util.SteamIDFrom64(data[i]['steamid'])
194-
195193
if data[i]['name'] != nil then
196194
table.insert( ULib.bans, tonumber(LeL) )ULib.bans[LeL] = { unban = tonumber(data[i]['ban_len']), admin = data[i]['a_name'], reason = data[i]['reason'], name = data[i]['name'], time = tonumber(data[i]['ban_time']), modified_admin = data[i]['a_name'], modified_time = tonumber(data[i]['ban_time']) }
197195
else

lua/sqlify/sql_convert.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
include('sqlify/sql_config.lua')
55
------------------
66
local Bans = 0;
7-
7+
--[[
88
function SQL_ConvertBan(steamid, name, BanLength, Time, AdminName, AdminSteam, Reason, MAdmin, MTime)
99
--Insert Ban
1010
-- local AddBanQuery = ULX_DB:query("INSERT INTO bans VALUES ('','"..steamid.."','"..SQL_Escape(name).."','"..BanLength.."','"..Time.."','"..SQL_Escape(AdminName).."','"..AdminSteam.."','"..SQL_Escape(Reason).."','"..SQL_SERVERID.."','"..MAdmin.."','"..MTime.."');");
@@ -48,3 +48,6 @@ function SQL_Convert()
4848
end
4949
5050
SQL_Convert();
51+
]]
52+
53+
--todo: fix this

lua/sqlify/sql_generic.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ function SQL_ComIDtoSteamID(cid)
2525
local a = steam64 % 2 == 0 and 0 or 1
2626
local b = math.abs(6561197960265728 - steam64 - a) / 2
2727
local sid = "STEAM_0:" .. a .. ":" .. (a == 1 and b -1 or b)
28+
print("sid:"..sid)
2829
return sid
2930
end

lua/sqlify/sql_serverheartbeat.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ function SQL_QueryDatabaseForServer()
3333
-- Query The Database to see if server exists and retrieve the Server's ID
3434
if (#data == 0) then
3535
-- If Database does not have IP and port create a new row and populate it accordingly
36-
print("[ULX GB] - Server not present, creating...");
36+
print("[ULX SQLify] - Server not present, creating...");
3737
SQL_InsertNewServer()
3838
elseif (#data == 1) then
3939
-- There should be only one entry
4040
SQL_SERVERID = tonumber(row['ServerID']);
4141
SQL_UpdateServerName();
42-
print("[ULX GB] - ServerID Set To: ".. SQL_SERVERID);
42+
print("[ULX SQLify] - ServerID Set To: ".. SQL_SERVERID);
4343
else
44-
print("[ULX GB] (UpdateName) - Error: Multiple entries found for IPAddress "..IPAddress.." and Port "..HostPort)
44+
print("[ULX SQLify] (UpdateName) - Error: Multiple entries found for IPAddress "..IPAddress.." and Port "..HostPort)
4545
end
4646
end
47-
HeartbeatQuery.onError = function(db, err) print('[ULX GB] (HeartbeatQuery) - Error: ', err) end
47+
HeartbeatQuery.onError = function(db, err) print('[ULX SQLify] (HeartbeatQuery) - Error: ', err) end
4848
HeartbeatQuery:start()
4949

5050
end
@@ -58,9 +58,9 @@ function SQL_UpdateServerName()
5858
UpdateName:setString( 1, HostName )
5959
UpdateName:setNumber( 2, SQL_SERVERID )
6060
function UpdateName:onSuccess()
61-
print("[ULX GB] - Updated HostName Successfully!");
61+
print("[ULX SQLify] - Updated HostName Successfully!");
6262
end
63-
function UpdateName:onError( err, sql ) print('[ULX GB] (UpdateName) - Error: ', err) end
63+
function UpdateName:onError( err, sql ) print('[ULX SQLify] (UpdateName) - Error: ', err) end
6464
UpdateName:start()
6565

6666
end
@@ -77,11 +77,11 @@ function SQL_InsertNewServer()
7777
NewServer:setString( 2, HostPort )
7878
NewServer:setString( 3, HostName )
7979
function NewServer:onSuccess( data )
80-
print("[ULX GB] - Inserted New Server!");
80+
print("[ULX SQLify] - Inserted New Server!");
8181
SQL_QueryDatabaseForServer()
8282
end
8383
function NewServer:onError(err)
84-
print('[ULX GB] (NewServer) - Error: ', err);
84+
print('[ULX SQLify] (NewServer) - Error: ', err);
8585
SQL_QueryDatabaseForServer()
8686
end
8787

lua/sqlify/sql_utimesync.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- not implemented yet

0 commit comments

Comments
 (0)