Skip to content

Commit b204ce1

Browse files
Created basic commands
Just added a ULX command to open the Admin GUI UPDATE: EGG_0.0.5
1 parent 399cb3f commit b204ce1

File tree

4 files changed

+40
-8
lines changed

4 files changed

+40
-8
lines changed

msync/client_gui/cl_admin_gui.lua

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,4 @@ function MSync.AdminPanel.InitPanel()
176176
sheet:AddSheet( "Modules", MSync.AdminPanel.InitModules( sheet ), "icon16/application.png" )
177177
sheet:AddSheet( "Module Settings", MSync.AdminPanel.InitModuleSettings( sheet ), "icon16/folder.png" )
178178

179-
end
180-
181-
--[[
182-
Description: Debug function. Remove on command implementation.
183-
Returns: nothing
184-
]]
185-
MSync.AdminPanel.InitPanel()
179+
end

msync/client_gui/cl_net.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,12 @@ net.Receive( "msync.sendMessage", function( len, pl )
5555
else
5656
chat.AddText(Color(255,255,255), "[MSync] "..net.ReadString())
5757
end
58+
end )
59+
60+
--[[
61+
Description: Net Receiver - Gets called when the client requested to open the admin GUI
62+
Returns: nothing
63+
]]
64+
net.Receive( "msync.openAdminGUI", function( len, pl )
65+
MSync.AdminPanel.InitPanel()
5866
end )

msync/server/sv_net.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ function MSync.net.sendMessage(ply, state, string)
3737

3838
end
3939

40+
--[[
41+
Description: Function to open the admin GUI on the client
42+
Arguments:
43+
player [player] - the player that wants to open the admin GUI
44+
Returns: nothing
45+
]]
46+
function MSync.net.openAdminGUI(ply)
47+
net.Start("msync.openAdminGUI")
48+
net.Send(ply)
49+
end
50+
4051
--[[
4152
Description: Net Receiver - Gets called when the client requests a table
4253
Returns: nothing

msync/server/sv_ulx.lua

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
MSync = MSync or {}
22
MSync.ulx = MSync.ulx or {}
33

4+
--[[
5+
Description: Function to create the ULX permissions
6+
Returns: nothing
7+
]]
48
function MSync.ulx.createPermissions()
59
ULib.ucl.registerAccess("msync.getTable", "superadmin", "Allows player to get MSync tables", "MSync")
610
ULib.ucl.registerAccess("msync.sendSettings", "superadmin", "Allows player to send settings to server", "MSync")
@@ -9,6 +13,21 @@ function MSync.ulx.createPermissions()
913
ULib.ucl.registerAccess("msync.loadModule", "superadmin", "Allows the player to load a module", "MSync")
1014
ULib.ucl.registerAccess("msync.reloadModules", "superadmin", "Allows the player to reload all modules", "MSync")
1115
ULib.ucl.registerAccess("msync.toggleModule", "superadmin", "Allows the player to enable/disable modules", "MSync" )
12-
ULib.ucl.registerAccess("msync.openAdminGUI", "superadmin", "Allows the player to see the admin gui", "MSync" )
16+
end
17+
18+
--[[
19+
Description: Function to create the ULX commands
20+
Returns: nothing
21+
]]
22+
function MSync.ulx.createCommands()
23+
24+
function MSync.func.openAdminGUI(calling_ply)
25+
if not calling_ply:query("msync.openAdminGUI") then return end;
26+
27+
MSync.net.openAdminGUI(ply)
28+
end
29+
local OpenAdminGUI = ulx.command( "MSync", "msync.openAdminGUI", MSync.func.openAdminGUI, "!msync" )
30+
OpenAdminGUI:defaultAccess( ULib.ACCESS_SUPERADMIN )
31+
OpenAdminGUI:help( "Opens MSync Settings." )
1332
end
1433
--ucl.registerAccess("msync.", "superadmin", "", "MSync" )

0 commit comments

Comments
 (0)