Commit b204ce10 authored by Maximilian Grüttemeier's avatar Maximilian Grüttemeier
Browse files

Created basic commands

Just added a ULX command to open the Admin GUI

UPDATE: EGG_0.0.5
parent 399cb3fb
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -177,9 +177,3 @@ function MSync.AdminPanel.InitPanel()
    sheet:AddSheet( "Module Settings", MSync.AdminPanel.InitModuleSettings( sheet ), "icon16/folder.png" )

end
 No newline at end of file

--[[
    Description: Debug function. Remove on command implementation.
    Returns: nothing
]]
MSync.AdminPanel.InitPanel()
 No newline at end of file
+8 −0
Original line number Diff line number Diff line
@@ -56,3 +56,11 @@ net.Receive( "msync.sendMessage", function( len, pl )
        chat.AddText(Color(255,255,255), "[MSync] "..net.ReadString())
    end
end )

--[[
    Description:  Net Receiver - Gets called when the client requested to open the admin GUI
    Returns: nothing
]]
net.Receive( "msync.openAdminGUI", function( len, pl )
    MSync.AdminPanel.InitPanel()
end )
 No newline at end of file
+11 −0
Original line number Diff line number Diff line
@@ -37,6 +37,17 @@ function MSync.net.sendMessage(ply, state, string)

end

--[[
    Description: Function to open the admin GUI on the client
    Arguments:
        player [player] - the player that wants to open the admin GUI
    Returns: nothing
]]   
function MSync.net.openAdminGUI(ply)
    net.Start("msync.openAdminGUI")
    net.Send(ply)
end

--[[
    Description: Net Receiver - Gets called when the client requests a table
    Returns: nothing
+20 −1
Original line number Diff line number Diff line
MSync = MSync or {}
MSync.ulx = MSync.ulx or {}

--[[
    Description: Function to create the ULX permissions
    Returns: nothing
]] 
function MSync.ulx.createPermissions()
    ULib.ucl.registerAccess("msync.getTable", "superadmin", "Allows player to get MSync tables", "MSync")
    ULib.ucl.registerAccess("msync.sendSettings", "superadmin", "Allows player to send settings to server", "MSync")
@@ -9,6 +13,21 @@ function MSync.ulx.createPermissions()
    ULib.ucl.registerAccess("msync.loadModule", "superadmin", "Allows the player to load a module", "MSync")
    ULib.ucl.registerAccess("msync.reloadModules", "superadmin", "Allows the player to reload all modules", "MSync")
    ULib.ucl.registerAccess("msync.toggleModule", "superadmin", "Allows the player to enable/disable modules", "MSync"	)
    ULib.ucl.registerAccess("msync.openAdminGUI", "superadmin", "Allows the player to see the admin gui", "MSync"	)
end

--[[
    Description: Function to create the ULX commands
    Returns: nothing
]] 
function MSync.ulx.createCommands()

    function MSync.func.openAdminGUI(calling_ply)
        if not calling_ply:query("msync.openAdminGUI") then return end;

        MSync.net.openAdminGUI(ply)
    end
    local OpenAdminGUI = ulx.command( "MSync", "msync.openAdminGUI", MSync.func.openAdminGUI, "!msync" )
    OpenAdminGUI:defaultAccess( ULib.ACCESS_SUPERADMIN )
    OpenAdminGUI:help( "Opens MSync Settings." )
end
--ucl.registerAccess("msync.", "superadmin", "", "MSync"	)