That's didn't work as it.
Now i'm rewrite some and get it like it need, but if before - clicking on buttons is working, now - not. How to gedt it work?
local sx, sy = guiGetScreenSize ( )
local eventButton
function centerGUI ( guiElement )
local width, height = guiGetSize ( guiElement, false )
local x, y = ( sx / 2 - width / 2 ), ( sy / 2 - height / 2 )
guiSetPosition ( guiElement, x, y, false )
end
GUIEditor = {
tab = {},
staticimage = {},
tabpanel = {},
edit = {},
button = {},
window = {},
label = {}
}
function showHide()
if guiGetVisible(GUIEditor.window[1]) == true then
guiSetVisible(GUIEditor.window[1],false)
showCursor(false)
elseif guiGetVisible(GUIEditor.window[1]) == false then
guiSetVisible(GUIEditor.window[1],true)
showCursor(true)
end
end
addEventHandler("showHide",getLocalPlayer(),showHide)
function showGUI (event)
GUIEditor.window[1] = guiCreateWindow(423, 331, 523, 367, "", false)
guiSetVisible(GUIEditor.window[1],true)
guiWindowSetSizable(GUIEditor.window[1], false)
showCursor(true)
centerGUI(GUIEditor.window[1])
-- GUIEditor.tabpanel[1] = guiCreateTabPanel(11, 109, 502, 241, false, GUIEditor.window[1])
GUIEditor.button[1] = guiCreateButton(5, 5, 153, 42, "Закрыть", false, GUIEditor.window[1])
local memo = guiCreateMemo(11, 109, 502, 241,event['description'],false,GUIEditor.window[1])
guiMemoSetReadOnly(memo, true)
GUIEditor.button[2] = guiCreateButton(5, 55, 153, 42, "Принять", false, GUIEditor.window[1])
eventButton = event
-- print (event['description'])
end
addEvent("showEventGUI", true)
addEventHandler( "showEventGUI", localPlayer, showGUI )
function buttonClick()
outputChatBox("Click")
if source == GUIEditor.button[1] then
showHide()
elseif (source == GUIEditor.button[2]) then
-- triggerServerEvent("startEvent")
--function startEvent(eventId, player)
triggerServerEvent("startEvent",resourceRoot, localPlayer, eventButton['id']) -- there is event_id?
showHide()
end
end
addEventHandler("onClientGUIClick",GUIEditor.window[1],buttonClick)