forked from TeamUlysses/ulx
Fixes #41. Added helper function to let us easily enable/disable UTeam on specific gamemodes. UTeam is now disabled for DarkRP gamemode.
This commit is contained in:
parent
2cd8904dc6
commit
6e0ec680fe
@ -81,7 +81,7 @@ function ulx.saveTeams()
|
||||
end
|
||||
|
||||
function ulx.refreshTeams()
|
||||
if not ULib.isSandbox() then
|
||||
if not ulx.uteamEnabled() then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -173,3 +173,7 @@ function ulx.dumpTable( t, indent, done )
|
||||
|
||||
return str
|
||||
end
|
||||
|
||||
function ulx.uteamEnabled()
|
||||
return ULib.isSandbox() and GAMEMODE.Name ~= "DarkRP"
|
||||
end
|
||||
|
@ -121,12 +121,12 @@ groups.cplayer.DoClick = function()
|
||||
end
|
||||
end
|
||||
xlib.makelabel{ x=5, y=240, label="Team:", parent=groups.pnlG1}
|
||||
groups.teams = xlib.makecombobox{ x=5, y=255, w=160, disabled=not ULib.isSandbox(), parent=groups.pnlG1 }
|
||||
groups.teams = xlib.makecombobox{ x=5, y=255, w=160, disabled=not ulx.uteamEnabled(), parent=groups.pnlG1 }
|
||||
groups.teams.OnSelect = function( self, index, value, data )
|
||||
if value == "<None>" then value = "" end
|
||||
RunConsoleCommand( "xgui", "changeGroupTeam", groups.list:GetValue(), value )
|
||||
end
|
||||
groups.teambutton = xlib.makebutton{ x=5, y=275, w=160, label="Manage Teams >>", disabled=not ULib.isSandbox(), parent=groups.pnlG1 }
|
||||
groups.teambutton = xlib.makebutton{ x=5, y=275, w=160, label="Manage Teams >>", disabled=not ulx.uteamEnabled(), parent=groups.pnlG1 }
|
||||
groups.teambutton.DoClick = function( self )
|
||||
if not groups.pnlG3:IsVisible() then
|
||||
self:SetText( "Manage Teams <<" )
|
||||
|
@ -188,7 +188,7 @@ function groups.init()
|
||||
xgui.addCmd( "updateTeamValue", groups.updateTeamValue )
|
||||
|
||||
function groups.refreshTeams()
|
||||
if not ULib.isSandbox() then return end --Do not perform any of the following code if UTeam is disabled.
|
||||
if not ulx.uteamEnabled() then return end --Do not perform any of the following code if UTeam is disabled.
|
||||
|
||||
ulx.teams = table.Copy( xgui.teams )
|
||||
ulx.saveTeams() --Let ULX reprocess the teams (Empty/new teams would be lost here)
|
||||
|
Loading…
Reference in New Issue
Block a user