Added override for the can open

This commit is contained in:
Cooldude2606
2017-12-31 18:03:16 +00:00
parent eb94851936
commit 812d03bd3b
2 changed files with 12 additions and 3 deletions

View File

@@ -10,6 +10,10 @@ Discord: https://discord.gg/r6dC2uK
local left = {}
left._left = {}
-- used for debugging
function left.override_open(state)
global.over_ride_left_can_open = state
end
--- Used to add a left gui frame
-- @usage Gui.left.add{name='foo',caption='Foo',tooltip='just testing',open_on_join=true,can_open=function,draw=function}
-- @param obj this is what will be made, needs a name and a draw function(root_frame), open_on_join can be used to set the deaful state true/false, can_open is a test to block it from opening but is not needed
@@ -134,7 +138,12 @@ function left._left.toggle(event)
if is_type(_left.can_open,'function') then
local success, err = pcall(_left.can_open,player)
if not success then error(err)
elseif err == true then open = true end
elseif err == true then open = true
elseif global.over_ride_left_can_open then
if is_type(Ranking,'table') and Ranking._presets and Ranking._presets().meta.rank_count > 0 then
if Ranking.get_rank(player):allowed(_left.name) then open = true end
end
end
else
if is_type(Ranking,'table') and Ranking._presets and Ranking._presets().meta.rank_count > 0 then
if Ranking.get_rank(player):allowed(_left.name) then open = true end

View File

@@ -124,7 +124,7 @@ end):add_tab('tab-2','Tab 2','Just a tab',function(frame)
end
end)
-- testing the left gui, open_test_on_all_left_guis is realy long just so it is very unlickly to be used
-- testing the left gui
Gui.left.add{
name='test-left',
caption='Gui Left',
@@ -134,7 +134,7 @@ Gui.left.add{
frame.add{type='label',caption=player.name}
end
end,
can_open=function(player) return player.index == 1 or global.open_test_on_all_left_guis end
can_open=function(player) return player.index == 1 end
}
local text_popup = Gui.inputs.add_text('test-popup-text',true,'Message To Send',function(player,text,element)