Skip to content

Commit 906108e

Browse files
Bugfix
- Fixed a few bugs that prevented console commands from working correctly
1 parent b3a40c2 commit 906108e

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

lua/msync/server/modules/sv_mbsync.lua

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ MSync.modules[info.ModuleIdentifier].init = function( transaction )
203203
banUserIdQ:setString(4, util.SteamIDTo64(calling_ply))
204204
banUserIdQ:setString(5, reason)
205205
banUserIdQ:setNumber(6, timestamp)
206-
banUserIdQ:setNumber(7, length)
206+
banUserIdQ:setNumber(7, length*60)
207207
if not allserver then
208208
banUserIdQ:setString(8, MSync.settings.data.serverGroup)
209209
else
@@ -281,7 +281,7 @@ MSync.modules[info.ModuleIdentifier].init = function( transaction )
281281
WHERE p_ID=?
282282
]] )
283283
editBanQ:setString(1, reason)
284-
editBanQ:setString(2, length)
284+
editBanQ:setNumber(2, length*60)
285285
editBanQ:setString(3, calling_ply)
286286
editBanQ:setString(4, util.SteamIDTo64(calling_ply))
287287
if not allserver then
@@ -293,7 +293,7 @@ MSync.modules[info.ModuleIdentifier].init = function( transaction )
293293

294294
editBanQ.onSuccess = function( q, data )
295295
MSync.modules[info.ModuleIdentifier].getActiveBans()
296-
MSync.modules[info.ModuleIdentifier].msg(calling_ply, "Edited ban with id "..banId.." with length "..length.." with reason "..reason)
296+
MSync.modules[info.ModuleIdentifier].msg(calling_ply, "Edited ban with id "..banId.." with data: \nLength: "..ULib.secondsToStringTime(length*60).."\nReason: "..reason)
297297
end
298298

299299
editBanQ.onError = function( q, err, sql )
@@ -745,21 +745,25 @@ MSync.modules[info.ModuleIdentifier].net = function()
745745
]]
746746
util.AddNetworkString("msync."..info.ModuleIdentifier..".sendMessage")
747747
MSync.modules[info.ModuleIdentifier].msg = function(ply, content, msgType)
748-
if type(ply) == "string" and not ply == "STEAM_0:0:0" then
748+
if type(ply) == "string" and not (ply == "STEAM_0:0:0") then
749749
ply = player.GetBySteamID( ply )
750750
end
751751

752-
if not ply or ply == "STEAM_0:0:0" then
753-
print("[MBSync] "..content)
754-
else
755-
if not msgType then msgType = 0 end
756-
-- Basic message
757-
if msgType == 0 then
758-
net.Start("msync."..info.ModuleIdentifier..".sendMessage")
759-
net.WriteFloat(msgType)
760-
net.WriteString(content)
761-
net.Send(ply)
752+
if type(ply) == "Entity" or type(ply) == "Player" then
753+
if not IsValid(ply) then
754+
print("[MBSync] "..content)
755+
else
756+
if not msgType then msgType = 0 end
757+
-- Basic message
758+
if msgType == 0 then
759+
net.Start("msync."..info.ModuleIdentifier..".sendMessage")
760+
net.WriteFloat(msgType)
761+
net.WriteString(content)
762+
net.Send(ply)
763+
end
762764
end
765+
elseif ply == "STEAM_0:0:0" then
766+
print("[MBSync] "..content)
763767
end
764768
end
765769

@@ -1159,7 +1163,7 @@ MSync.modules[info.ModuleIdentifier].ulx = function()
11591163
--[[
11601164
Load the ban date from the activa ben table to a local variable
11611165
]]
1162-
local banData = MSync.modules[info.ModuleIdentifier].banTable[util.SteamIDTo64(target_steamid)]
1166+
local banData = table.Copy(MSync.modules[info.ModuleIdentifier].banTable[util.SteamIDTo64(target_steamid)])
11631167

11641168
--[[
11651169
Translate ban length and Date into readable values
@@ -1173,6 +1177,10 @@ MSync.modules[info.ModuleIdentifier].ulx = function()
11731177

11741178
banData.timestamp = os.date( "%H:%M:%S - %d/%m/%Y", banData.timestamp)
11751179

1180+
if string.len(banData.reason) <= 0 then
1181+
banData.reason = "None Given"
1182+
end
1183+
11761184
--[[
11771185
Message the ban informations to the asking player
11781186
]]

0 commit comments

Comments
 (0)