diff --git a/lua/msync/server/modules/sv_mrsync.lua b/lua/msync/server/modules/sv_mrsync.lua index 820456f..6ca90da 100644 --- a/lua/msync/server/modules/sv_mrsync.lua +++ b/lua/msync/server/modules/sv_mrsync.lua @@ -6,7 +6,7 @@ MSync.modules.MRSync = MSync.modules.MRSync or {} * @package MySQL Rank Sync * @author Aperture Development * @license root_dir/LICENCE - * @version 2.0.0 + * @version 2.0.1 ]] --[[ @@ -16,7 +16,7 @@ MSync.modules.MRSync.info = { Name = "MySQL Rank Sync", ModuleIdentifier = "MRSync", Description = "Synchronise your ranks across your servers", - Version = "2.0.0" + Version = "2.0.1" } --[[ @@ -75,7 +75,9 @@ function MSync.modules.MRSync.init( transaction ) SELECT p_user_id FROM tbl_users WHERE steamid=? AND steamid64=? ) AND (server_group=( SELECT p_group_id FROM tbl_server_grp WHERE group_name=? - ) OR server_group='allservers'); + ) OR server_group=( + SELECT p_group_id FROM tbl_server_grp WHERE group_name='allservers' + )); ]] ) loadUserQ:setString(1, ply:SteamID()) loadUserQ:setString(2, ply:SteamID64()) @@ -84,7 +86,7 @@ function MSync.modules.MRSync.init( transaction ) function loadUserQ.onData( q, data ) if data.rank == ply:GetUserGroup() then return end; - ply:SetUserGroup(data[1].rank) + ply:SetUserGroup(data.rank) end loadUserQ:start() diff --git a/lua/msync/server/sv_mysql.lua b/lua/msync/server/sv_mysql.lua index 11aa107..0e86935 100644 --- a/lua/msync/server/sv_mysql.lua +++ b/lua/msync/server/sv_mysql.lua @@ -35,6 +35,11 @@ function MSync.mysql.initialize() ); ]] )) + initDatabase:addQuery(MSync.DBServer:query( [[ + INSERT INTO `tbl_server_grp` (group_name) VALUES ('allservers') + ON DUPLICATE KEY UPDATE group_name=VALUES(group_name); + ]] )) + initDatabase:addQuery(MSync.DBServer:query( [[ CREATE TABLE IF NOT EXISTS `tbl_msync_servers` ( `p_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,