No such thing.As i remember otclient contains function player:getStorageValue() you can set for admins specific storage with value 3 and gms value 2 and from otclient remove the buttons and make hotkeys, when clicked if player:getStorageValue(ChosenStor) == 3 then — if player is admin
Here you will add the function responsible to view the windows that you want to restrict for players
g_game.isGM()
So how would you use it if ur not GM it hides those tables, and if ur GM it appears?No such thing.
Useg_game.isGM()
AddSo how would you use it if ur not GM it hides those tables, and if ur GM it appears?
if
in creation, create only if true.so something likeAddif
in creation, create only if true.
function init()
if g_game.isGM() then
return true
end
terminalWindow = g_ui.displayUI('terminal')
terminalWindow:setVisible(false)
terminalWindow.onDoubleClick = popWindow
terminalButton = modules.client_topmenu.addLeftButton('terminalButton', tr('Terminal') .. ' (Ctrl + T)', '/images/topbuttons/terminal', toggle)
terminalButton:setOn(false)
g_keyboard.bindKeyDown('Ctrl+T', toggle)
commandHistory = g_settings.getList('terminal-history')
commandTextEdit = terminalWindow:getChildById('commandTextEdit')
commandTextEdit:setHeight(commandTextEdit.baseHeight)
connect(commandTextEdit, {onTextChange = onCommandChange})
g_keyboard.bindKeyPress('Up', function() navigateCommand(1) end, commandTextEdit)
g_keyboard.bindKeyPress('Down', function() navigateCommand(-1) end, commandTextEdit)
g_keyboard.bindKeyPress('Ctrl+C',
function()
if commandTextEdit:hasSelection() or not terminalSelectText:hasSelection() then return false end
g_window.setClipboardText(terminalSelectText:getSelection())
return true
end, commandTextEdit)
g_keyboard.bindKeyDown('Tab', completeCommand, commandTextEdit)
g_keyboard.bindKeyPress('Shift+Enter', addNewline, commandTextEdit)
g_keyboard.bindKeyDown('Enter', doCommand, commandTextEdit)
g_keyboard.bindKeyDown('Escape', hide, terminalWindow)
terminalBuffer = terminalWindow:getChildById('terminalBuffer')
terminalSelectText = terminalWindow:getChildById('terminalSelectText')
terminalSelectText.onDoubleClick = popWindow
terminalSelectText.onMouseWheel = function(a,b,c) terminalBuffer:onMouseWheel(b,c) end
terminalBuffer.onScrollChange = function(self, value) terminalSelectText:setTextVirtualOffset(value) end
g_logger.setOnLog(onLog)
if not g_app.isRunning() then
g_logger.fireOldMessages()
elseif _G.terminalLines then
for _,line in pairs(_G.terminalLines) do
addLine(line.text, line.color)
end
end
end
actually i never found what does this function checks even in sources, it checks for GMactions and when i tried using it multiple times it was completely useless idk if it works now it was long time ago, also i have 0 background about flags gmactions might be a flag, good if it worksNo such thing.
Useg_game.isGM()
bumpso something like
or im wrong? because i think this is where it shows the terminal icon to click at the top, because of terminalWindow = g_ui.displayUI('terminal') but probably they could walk this around just by pressing ctrl+t so again need to put check on that? So im a little bit confusedLUA:function init() if g_game.isGM() then return true end terminalWindow = g_ui.displayUI('terminal') terminalWindow:setVisible(false) terminalWindow.onDoubleClick = popWindow terminalButton = modules.client_topmenu.addLeftButton('terminalButton', tr('Terminal') .. ' (Ctrl + T)', '/images/topbuttons/terminal', toggle) terminalButton:setOn(false) g_keyboard.bindKeyDown('Ctrl+T', toggle) commandHistory = g_settings.getList('terminal-history') commandTextEdit = terminalWindow:getChildById('commandTextEdit') commandTextEdit:setHeight(commandTextEdit.baseHeight) connect(commandTextEdit, {onTextChange = onCommandChange}) g_keyboard.bindKeyPress('Up', function() navigateCommand(1) end, commandTextEdit) g_keyboard.bindKeyPress('Down', function() navigateCommand(-1) end, commandTextEdit) g_keyboard.bindKeyPress('Ctrl+C', function() if commandTextEdit:hasSelection() or not terminalSelectText:hasSelection() then return false end g_window.setClipboardText(terminalSelectText:getSelection()) return true end, commandTextEdit) g_keyboard.bindKeyDown('Tab', completeCommand, commandTextEdit) g_keyboard.bindKeyPress('Shift+Enter', addNewline, commandTextEdit) g_keyboard.bindKeyDown('Enter', doCommand, commandTextEdit) g_keyboard.bindKeyDown('Escape', hide, terminalWindow) terminalBuffer = terminalWindow:getChildById('terminalBuffer') terminalSelectText = terminalWindow:getChildById('terminalSelectText') terminalSelectText.onDoubleClick = popWindow terminalSelectText.onMouseWheel = function(a,b,c) terminalBuffer:onMouseWheel(b,c) end terminalBuffer.onScrollChange = function(self, value) terminalSelectText:setTextVirtualOffset(value) end g_logger.setOnLog(onLog) if not g_app.isRunning() then g_logger.fireOldMessages() elseif _G.terminalLines then for _,line in pairs(_G.terminalLines) do addLine(line.text, line.color) end end end