dialogs = {}
function createAttentionDialog ( text )
index = index + 1
if not dialogs[index] then
dialogs[index] = {}
else
return createAttentionDialog ( text )
end
local screenW, screenH = guiGetScreenSize()
-- tabs = #dialogs[index] + 1
dialogs[index].window = guiCreateWindow((screenW - 386) / 2, (screenH - 185) / 2, 386, 185, "Attention!", false)
-- guiWindowSetSizable(dialogs[1].window, false)
dialogs[index].okbutton = guiCreateButton(87, 127, 89, 24, "OK", false, dialogs[index].window)
dialogs[index].lbl = guiCreateLabel(15, 27, 355, 85, text, false, dialogs[index].window)
guiSetFont(dialogs[index].lbl, "clear-normal")
guiLabelSetHorizontalAlign(dialogs[index].lbl, "center", true)
guiLabelSetVerticalAlign(dialogs[index].lbl, "center")
dialogs[index].cancelbutton = guiCreateButton(198, 127, 89, 24, "Cancel", false, dialogs[index].window)
dialogs[index].chk = guiCreateCheckBox(128, 156, 117, 15, "Disable requests", false, false, dialogs[index].window)
guiSetFont( dialogs[index].chk, "default-bold-small")
addEventHandler ( "onClientGUIClick", dialogs[index].okbutton,
function ( )
_destroyElement ( dialogs[index].window )
end
,false
)
end
A friend put me in charge of a part of a script. and i don't know how to make it so for each window it creates, i can press ok to close eacch one. Right now it works but i can only close the most current ones. the rest stay open adn when i press ok on them it says destroyElement ( bad pointer ). my friend patched _destroyElement so dont worry about that