Skip to content
This repository was archived by the owner on Oct 14, 2021. It is now read-only.

Commit 3129fbc

Browse files
author
captain1242
committed
Bugfix
Fixed Typos and Changed code to Accept the OpenID Plugin
1 parent 8678e28 commit 3129fbc

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

lua/wl_bridge/wl_bridge_config.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--[[
22
############################################
33
#####Script made by: Aperture Hosting#######
4-
##Script purpose: WorldLab Community Bridge#
4+
##Script purpose: WoltLab Community Bridge#
55
##Other Info: WARNING! In future the config#
66
#####file will get Replaced with In-Game####
77
#######Configuration throught ULX (XGUI)####
@@ -26,9 +26,9 @@ WLBridge.Config.MySQL = {
2626
Password = ""
2727
}
2828
--#############################
29-
--##WorldLab Database Settings#
29+
--##WoltLab Database Settings#
3030
--#############################
31-
WLBridge.Config.WorldLab = {
31+
WLBridge.Config.WoltLab = {
3232
--Your WL Version
3333
Version = "WSC3.0",
3434
--The Table with the User's and
@@ -39,7 +39,9 @@ WLBridge.Config.WorldLab = {
3939
--The Group Table
4040
GroupTable = "wcf1_user_group",
4141
--The Connection Table from User to Group
42-
UserToGroupTable = "wcf1_user_to_group"
42+
UserToGroupTable = "wcf1_user_to_group",
43+
--If the script should use the steam OpenID plugin
44+
useOpenId = false
4345
}
4446
--###########################
4547
--##Synchonisation Settings##

lua/wl_bridge/wl_bridge_mysql.lua

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,59 @@ WLBridge.Config = WLBridge.Config or {}
33
local WLBridgeSQL = WLBridgeSQL or {}
44

55
function WLBridge.LoadPlayer(ply)
6-
print("Running LoadPlayer")
76
WLBridgeSQL.ply = ply
8-
print(ply:SteamID())
9-
print(WLBridgeSQL.ply:SteamID())
10-
local GetForumQ = WLBridge.DB:query("SELECT * FROM `"..WLBridge.DB:escape(WLBridge.Config.WorldLab.UserTable).."` WHERE `"..WLBridge.DB:escape(WLBridge.Config.WorldLab.UserTableSIDC).."`='"..WLBridge.DB:escape(WLBridgeSQL.ply:SteamID()).."'")
7+
if (WLBridge.Config.WoltLab.useOpenId==true) then
8+
WLBridgeSQL.plySID = WLBridgeSQL.ply:SteamID64()
9+
else
10+
WLBridgeSQL.plySID = WLBridgeSQL.ply:SteamID()
11+
end
12+
local GetForumQ = WLBridge.DB:query("SELECT * FROM `"..WLBridge.DB:escape(WLBridge.Config.WoltLab.UserTable).."` WHERE `"..WLBridge.DB:escape(WLBridge.Config.WoltLab.UserTableSIDC).."`='"..WLBridge.DB:escape(WLBridgeSQL.plySID).."'")
1113
GetForumQ:start()
1214
GetForumQ:wait()
1315
GetForumQ.onSuccess = function() print("HAHA SUCCESS") end
1416
GetForumQ.onError = function(Q,E) print("Q1") print(E) end
1517
if GetForumQ:getData() ~= nil and GetForumQ:getData()[1] ~= nil then
1618
WLBridgeSQL.User = GetForumQ:getData()[1]
1719
WLBridge.LoadPlayerRank()
18-
print("Returned")
1920
end
2021
end
2122

2223
function WLBridge.LoadPlayerRank()
2324
print("Running LoadPlayerRank")
24-
local GetRankIDQ = WLBridge.DB:query("SELECT * FROM `"..WLBridge.DB:escape(WLBridge.Config.WorldLab.UserToGroupTable).."` WHERE `userID`='"..WLBridge.DB:escape(WLBridgeSQL.User.userID).."'")
25+
local GetRankIDQ = WLBridge.DB:query("SELECT * FROM `"..WLBridge.DB:escape(WLBridge.Config.WoltLab.UserToGroupTable).."` WHERE `userID`='"..WLBridge.DB:escape(WLBridgeSQL.User.userID).."'")
2526
GetRankIDQ:start()
2627
GetRankIDQ:wait()
2728
if GetRankIDQ:getData() ~= nil and GetRankIDQ:getData()[1] ~= nil then
2829
WLBridgeSQL.GroupID = GetRankIDQ:getData()
2930
WLBridge.RankPlayer()
30-
print("Returned")
3131
end
3232
end
3333

3434
function WLBridge.RankPlayer()
35-
print("Running RankPlayer")
35+
3636
local WLBool = false
37+
3738
WLBridgeSQL.PlayerGroups = WLBridgeSQL.PlayerGroups or {}
3839
for k,v in pairs(WLBridgeSQL.GroupID) do
39-
local GetPlyGroups = WLBridge.DB:query("SELECT * FROM `"..WLBridge.DB:escape(WLBridge.Config.WorldLab.GroupTable).."` WHERE `groupID`='"..WLBridge.DB:escape(v.groupID).."'")
40+
local GetPlyGroups = WLBridge.DB:query("SELECT * FROM `"..WLBridge.DB:escape(WLBridge.Config.WoltLab.GroupTable).."` WHERE `groupID`='"..WLBridge.DB:escape(v.groupID).."'")
4041
GetPlyGroups:start()
4142
GetPlyGroups:wait()
4243
if GetPlyGroups:getData() ~= nil and GetPlyGroups:getData()[1] ~= nil then
4344
WLBridgeSQL.PlayerGroups[k] = GetPlyGroups:getData()[1].groupName
4445
end
4546
end
46-
PrintTable(WLBridge.Config.GroupToInGameRank)
47+
4748
for k,v in pairs(WLBridgeSQL.PlayerGroups) do
4849
if WLBridge.Config.GroupToInGameRank[v] then
4950
if not(WLBridgeSQL.ply:IsUserGroup( WLBridge.Config.GroupToInGameRank[v] ))then
5051
RunConsoleCommand("ulx","adduserid",WLBridgeSQL.ply:SteamID(),WLBridge.Config.GroupToInGameRank[v])
5152
WLBool = true
53+
elseif(WLBridgeSQL.ply:IsUserGroup( WLBridge.Config.GroupToInGameRank[v] ))then
54+
WLBool = true
5255
end
5356
end
5457
end
55-
if(WLBool==false) and not(WLBridgeSQL.ply:IsUserGroup( "user" )) then
58+
if((WLBool==false) and not(WLBridgeSQL.ply:IsUserGroup( "user" ))) then
5659
RunConsoleCommand("ulx","removeuserid",WLBridgeSQL.ply:SteamID())
5760
end
5861
end

0 commit comments

Comments
 (0)