mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Added override for the can open
This commit is contained in:
@@ -10,6 +10,10 @@ Discord: https://discord.gg/r6dC2uK
|
|||||||
local left = {}
|
local left = {}
|
||||||
left._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
|
--- 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}
|
-- @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
|
-- @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
|
if is_type(_left.can_open,'function') then
|
||||||
local success, err = pcall(_left.can_open,player)
|
local success, err = pcall(_left.can_open,player)
|
||||||
if not success then error(err)
|
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
|
else
|
||||||
if is_type(Ranking,'table') and Ranking._presets and Ranking._presets().meta.rank_count > 0 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
|
if Ranking.get_rank(player):allowed(_left.name) then open = true end
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ end):add_tab('tab-2','Tab 2','Just a tab',function(frame)
|
|||||||
end
|
end
|
||||||
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{
|
Gui.left.add{
|
||||||
name='test-left',
|
name='test-left',
|
||||||
caption='Gui Left',
|
caption='Gui Left',
|
||||||
@@ -134,7 +134,7 @@ Gui.left.add{
|
|||||||
frame.add{type='label',caption=player.name}
|
frame.add{type='label',caption=player.name}
|
||||||
end
|
end
|
||||||
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)
|
local text_popup = Gui.inputs.add_text('test-popup-text',true,'Message To Send',function(player,text,element)
|
||||||
|
|||||||
Reference in New Issue
Block a user