My issue is that for some reason after pressing the corresponding button to call the function, two windows pop up one on another. One of the is responsive (as in - you can press the buttons and they work), the other one can be moved around but the buttons don't lead anywhere. Any ideas why?
The code is redesigned older code for the OwlGaming roleplay gamemode (from 2015. if I remember correctly).
function showConfirmDelete(id, brand, model, createdby)
local w, h = 400,150
ConfirmDeleteWin = dgsCreateWindow((screenwidth-w)/2,(screenheight-h)/2,w,h,"Transportlīdzekļa dzēšana",false, _, _, _, _, _, _, _, true)
dgsSetAlpha(vehLib, 0.1)
local bty, bth = 0.6, 0.2
labels[8] = dgsCreateLabel(0.0254,0.2072,0.9645,0.1982,"Tu čista gribi dzēst #"..id.."("..brand.." "..model.."), ko veidojis "..createdby.."?",true,ConfirmDeleteWin)
dgsLabelSetHorizontalAlign(labels[8],"center",false)
labels[9] = dgsCreateLabel(0.0254,0.4054,0.9492,0.2162,"Šī rīcība ir neatgriezeniska!",true,ConfirmDeleteWin)
dgsLabelSetHorizontalAlign(labels[9],"center",false)
buttons[10] = dgsCreateButton(0.0254,bty,0.4695,bth,"Atcelt",true,ConfirmDeleteWin, _, _, _, _, _, _, 0x99FF0000)
dgsSetFont(buttons[10],"clear")
addEventHandler("onDgsMouseClick", buttons[10], function()
if source == buttons[10] then
closeConfirmDelete()
end
end)
buttons[11] = dgsCreateButton(0.5051,bty,0.4695,bth,"Apstiprināt",true,ConfirmDeleteWin, _, _, _, _, _, _, 0x9900FF00)
dgsSetFont(buttons[11],"clear")
addEventHandler("onDgsMouseClick", buttons[11], function()
if source == buttons[11] then
triggerServerEvent("vehlib:deleteVehicle", localPlayer, id)
closeConfirmDelete()
playSuccess()
end
end)
end
If required, can provide more parts that could be linked to this bit of code.