kokoseda Posted April 27, 2020 Share Posted April 27, 2020 Hello I want to make my gui script colorful like my Gui Freeroam menu.. I have used this code to make my freeroam colorful like this genelGuiTablo = {} --guiCreateWindow wtablo = {} --guiCreateButton btablo = {} --guiCreateGridList Ltablo = {} --guiCreateMemo mtablo = {} --guiCreateEdit etablo = {} function resimOlustur(isim) if fileExists(isim.."png") then return isim.."png" end local texture = dxCreateTexture(1,1) local pixels = dxGetTexturePixels(texture) local r,g,b,a = 155,155,155,155 dxSetPixelColor(pixels,0,0,r,g,b,a) dxSetTexturePixels(texture, pixels) local pxl = dxConvertPixels(dxGetTexturePixels(texture),"png") local nImg = fileCreate(isim..".png") fileWrite(nImg,pxl) fileClose(nImg) return isim..".png" end function renkVer(resim,hex) guiSetProperty(resim,"ImageColours","tl:FF"..hex.." tr:FF"..hex.." bl:FF"..hex.." br:FF"..hex) end _guiCreateWindow = guiCreateWindow function guiCreateWindow(x,y,g,u,yazi,relative,parent,renk1,renk2,renk3,renk4,kapatkutu) wsayi = #wtablo +1 if not renk1 or string.len(renk1) > 6 then renk1 = "ED7717" -- window renk üst taraf // window top color end if not renk2 or string.len(renk2) > 6 then renk2 = "ED7717" -- window renk alt taraf // window bottom color end if not renk3 or string.len(renk3) > 6 then renk3 = "131314" -- baslik renk // window header back color end if not renk4 or string.len(renk4) > 6 then renk4 = "1883D7" -- window kenar çizgi // window outline color end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu relative = false end if not wtablo[wsayi] then wtablo[wsayi] = {} end --arkaResim wtablo[wsayi].resim = guiCreateStaticImage(x,y,g,u,resimOlustur("test"),relative,parent) renkVer(wtablo[wsayi].resim,renk1) guiSetProperty(wtablo[wsayi].resim,"ImageColours","tl:FF"..renk1.." tr:FF"..renk1.." bl:FF"..renk2.." br:FF"..renk2.."") --baslıkArka wtablo[wsayi].basarka = guiCreateStaticImage(0,0,g,20, resimOlustur("test"), false, wtablo[wsayi].resim) renkVer(wtablo[wsayi].basarka,renk3) --kenarlar wtablo[wsayi].kenarlar = { ordaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, wtablo[wsayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, wtablo[wsayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, wtablo[wsayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, wtablo[wsayi].resim) } for i,v in pairs(wtablo[wsayi].kenarlar) do renkVer(v,renk4) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end --baslıkLabel wtablo[wsayi].label = guiCreateLabel((g/2)-((string.len(yazi)*8)/2),0,(string.len(yazi)*8),20, yazi, false, wtablo[wsayi].basarka) guiSetFont(wtablo[wsayi].label, "default-bold-small") guiLabelSetHorizontalAlign(wtablo[wsayi].label, "center") guiLabelSetVerticalAlign(wtablo[wsayi].label, "center") return wtablo[wsayi].resim end _guiCreateButton = guiCreateButton function guiCreateButton(x,y,g,u,yazi,relative,parent,renk1,renk2) bsayi = #btablo +1 if not btablo[bsayi] then btablo[bsayi] = {} end if not renk1 or string.len(renk1) > 6 then --renk = math.random(999999) renk1 = "ff0000" -- genel buton rengi // button back color end if not renk2 or string.len(renk2) > 6 then renk2 = "FFFFFF" -- buton kenar rengi // button outline color end --arkaResim if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu relative = false end btablo[bsayi].resim = guiCreateStaticImage(x,y,g,u,resimOlustur("test"),relative,parent) renkVer(btablo[bsayi].resim,renk1) --kenarlar btablo[bsayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), relative, btablo[bsayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), relative, btablo[bsayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), relative, btablo[bsayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), relative, btablo[bsayi].resim) } for i,v in pairs(btablo[bsayi].kenarlar) do renkVer(v,renk2) guiSetAlpha(v, 0.4) end --label btablo[bsayi].label = guiCreateLabel(0,0,g,u,yazi,relative,btablo[bsayi].resim) guiLabelSetHorizontalAlign(btablo[bsayi].label, "center") guiLabelSetVerticalAlign(btablo[bsayi].label, "center") guiSetFont(btablo[bsayi].label, "default-bold-small") genelGuiTablo[btablo[bsayi].label] = btablo[bsayi].kenarlar return btablo[bsayi].label end _guiCreateGridList = guiCreateGridList function guiCreateGridList(x,y,g,u,relative,parent,kenarrenk) Ssayi = #Ltablo +1 if not kenarrenk or string.len(kenarrenk) > 6 then kenarrenk = "1883D7" -- gridlist kenar renk // gridlist outline color end if not Ltablo[Ssayi] then Ltablo[Ssayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu end local relative = false Ltablo[Ssayi].resim = guiCreateLabel(x,y,g,u, "", relative, parent) Ltablo[Ssayi].liste = _guiCreateGridList(-8,-8,g+10, u+10,false, Ltablo[Ssayi].resim) Ltablo[Ssayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, Ltablo[Ssayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, Ltablo[Ssayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, Ltablo[Ssayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, Ltablo[Ssayi].resim)} genelGuiTablo[Ltablo[Ssayi].liste] = Ltablo[Ssayi].kenarlar for i,v in pairs(Ltablo[Ssayi].kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return Ltablo[Ssayi].liste end _guiCreateEdit = guiCreateEdit function guiCreateEdit(x,y,g,u,yazi,relative,parent,kenarrenk) esayi = #etablo +1 if not kenarrenk or string.len(kenarrenk) > 6 then kenarrenk = "1883D7" -- edit kenar renk // edit outline color end if not etablo[esayi] then etablo[esayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu end local relative = false etablo[esayi].resim = guiCreateLabel(x,y,g,u, "", relative, parent) etablo[esayi].edit = _guiCreateEdit(-7,-5,g+15, u+8,yazi,false, etablo[esayi].resim) etablo[esayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, etablo[esayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, etablo[esayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, etablo[esayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, etablo[esayi].resim) } genelGuiTablo[etablo[esayi].edit] = etablo[esayi].kenarlar for i,v in pairs(etablo[esayi].kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return etablo[esayi].edit end _guiCreateMemo = guiCreateMemo function guiCreateMemo(x,y,g,u,yazi,relative,parent,kenarrenk) msayi = #mtablo +1 if not kenarrenk or string.len(kenarrenk) > 6 then kenarrenk = "1883D7" -- memo kenar renk // memo outline color end if not mtablo[msayi] then mtablo[msayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu end local relative = false mtablo[msayi].resim = guiCreateLabel(x,y,g,u, "", relative, parent) mtablo[msayi].memo = _guiCreateMemo(-5,-10,g+15, u+10, yazi,false, mtablo[msayi].resim) mtablo[msayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, mtablo[msayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, mtablo[msayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, mtablo[msayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, mtablo[msayi].resim)} genelGuiTablo[mtablo[msayi].memo] = mtablo[msayi].kenarlar for i,v in pairs(mtablo[msayi].kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return mtablo[msayi].memo end --edit,gridlst,buton,memo mouse addEventHandler("onClientMouseEnter", resourceRoot, function() for i,v in pairs(genelGuiTablo) do if source == i then for i,v in pairs(v) do guiSetAlpha(v, 1) end end end end) addEventHandler("onClientMouseLeave", resourceRoot, function() for i,v in pairs(genelGuiTablo) do if source == i then for i,v in pairs(v) do guiSetAlpha(v, 0.4) end end end end) function butonmu(label) for i,v in pairs(btablo) do if v.label == label then return i end end return false end function penceremi(resim) for i,v in pairs(wtablo) do if v.resim == resim then return i end end return false end function editmi(edit) for i,v in pairs(etablo) do if v.edit == edit then return i end end return false end function gridlistmi(liste) for i,v in pairs(Ltablo) do if v.liste == liste then return i end end return false end function memomu(memo) for i,v in pairs(mtablo) do if v.memo == memo then return i end end return false end function basliklabelmi(label) for i,v in pairs(wtablo) do if v.label == label then return i end end return false end function baslikmi(element) for i,v in pairs(wtablo) do if v.basarka == element or wtablo[basliklabelmi(element)] and v.label == element then return i end end return false end --basinca olan ufalma // anim when click basili = {} addEventHandler("onClientGUIMouseDown", resourceRoot, function() if butonmu(source) then if basili[source] then return end basili[source] = true local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x+2,y+2, false) guiSetSize(source, g-4,u-4, false) end end) addEventHandler("onClientGUIMouseUp", resourceRoot, function() if butonmu(source) then if not basili[source] then for i,v in pairs(basili) do if v == true then source = i break end end end if not basili[source] then return end basili[source] = nil local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x-2,y-2, false) guiSetSize(source, g+4,u+4, false) else for i,v in pairs(basili) do if v == true then source = i break end end if butonmu(source) then basili[source] = nil local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x-2,y-2, false) guiSetSize(source, g+4,u+4, false) end end end) function basiliBirak() for i,v in pairs(basili) do if v == true then source = i break end end if butonmu(source) then basili[source] = nil local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x-2,y-2, false) guiSetSize(source, g+4,u+4, false) end end addEventHandler("onClientClick", root, function(button, durum, _, _, _, _, _, tiklanan) if durum == "up" then if tiklanan then local element = getElementType(tiklanan) if not string.find(element, "gui-") then basiliBirak() end else basiliBirak() end end end) --panel taşıma // window drag and move addEventHandler( "onClientGUIMouseDown", resourceRoot,function ( btn, x, y ) if btn == "left" and baslikmi(source) then local source = wtablo[baslikmi(source)].resim clickedElement = source local elementPos = { guiGetPosition( source, false ) } offsetPos = { x - elementPos[ 1 ], y - elementPos[ 2 ] }; end end) addEventHandler( "onClientGUIMouseUp", resourceRoot,function ( btn, x, y ) if btn == "left" and baslikmi(source) then clickedElement = nil end end) addEventHandler( "onClientCursorMove", getRootElement( ),function ( _, _, x, y ) if clickedElement then guiSetPosition( clickedElement, x - offsetPos[ 1 ], y - offsetPos[ 2 ], false ) end end) --diğer funclar // other funcs _guiGetPosition = guiGetPosition function guiGetPosition(element,relative) if butonmu(element) then local sira = butonmu(element) local x,y = _guiGetPosition(btablo[sira].resim, relative) return x,y else local x,y = _guiGetPosition(element, relative) return x,y end end _guiSetPosition = guiSetPosition function guiSetPosition(element,x,y,relative) if butonmu(element) then local sira = butonmu(element) _guiSetPosition(btablo[sira].resim, x,y, relative) else _guiSetPosition(element,x,y,relative) end end _guiGetSize = guiGetSize function guiGetSize(element,relative) if butonmu(element) then local sira = butonmu(element) local g,u = _guiGetSize(btablo[sira].resim, relative) return g,u else local g,u = _guiGetSize(element, relative) return g,u end end _guiSetSize = guiSetSize function guiSetSize(element,g,u,relative) if butonmu(element) then local sira = butonmu(element) _guiSetSize(btablo[sira].resim, g,u, false) _guiSetSize(btablo[sira].label, g,u, false) --sağ kenar çizgi _guiSetPosition(btablo[sira].kenarlar.sag, g-1, 0, false) _guiSetSize(btablo[sira].kenarlar.sag, 1,u, false) --alt kenar çizgi _guiSetPosition(btablo[sira].kenarlar.ortaAlt, 0, u-1, false) _guiSetSize(btablo[sira].kenarlar.ortaAlt, g,1, false) elseif penceremi(element) then local sira = penceremi(element) _guiSetSize(wtablo[sira].resim, g,u, false) --sağ kenar çizgi _guiSetPosition(wtablo[sira].kenarlar.sag, g-1, 0, false) _guiSetSize(wtablo[sira].kenarlar.sag, 1,u, false) --alt kenar çizgi _guiSetPosition(wtablo[sira].kenarlar.ortaAlt, 0, u-1, false) _guiSetSize(wtablo[sira].kenarlar.ortaAlt, g,1, false) --baslik _guiSetSize(wtablo[sira].basarka, g,20, false) --kapat _guiSetPosition(wtablo[sira].kapatArka, g-25,1, false) --label local yazi = guiGetText(wtablo[sira].label) _guiSetPosition(wtablo[sira].label, (g/2)-((string.len(yazi)*8)/2),0, false) _guiSetSize(wtablo[sira].label,(string.len(yazi)*8),20, false) guiLabelSetHorizontalAlign(wtablo[sira].label, "center") guiLabelSetVerticalAlign(wtablo[sira].label, "center") end end _guiSetText = guiSetText function guiSetText(element, yazi) if penceremi(element) then local sira = penceremi(element) local g,u = guiGetSize(wtablo[sira].resim,false) guiSetPosition(wtablo[sira].label,(g/2)-((string.len(yazi)*8)/2),0, false) guiSetSize(wtablo[sira].label, (string.len(yazi)*8),20, false) guiLabelSetHorizontalAlign(wtablo[sira].label, "center") guiLabelSetVerticalAlign(wtablo[sira].label, "center") _guiSetText(wtablo[sira].label, yazi) else _guiSetText(element, yazi) end end _guiGetText = guiGetText function guiGetText(element) if penceremi(element) then local sira = penceremi(element) local yazi = _guiGetText(wtablo[sira].label) return yazi else local yazi = _guiGetText(element) return yazi end end _guiSetEnabled = guiSetEnabled function guiSetEnabled(element, bool) if butonmu(element) then if bool == false then guiSetAlpha(btablo[butonmu(element)].resim,0.5) _guiSetEnabled(element, bool) else guiSetAlpha(btablo[butonmu(element)].resim,1) _guiSetEnabled(element, bool) end else _guiSetEnabled(element, bool) end end _guiSetVisible = guiSetVisible function guiSetVisible(element, bool) if butonmu(element) then local sira = butonmu(element) _guiSetVisible(btablo[sira].resim, bool) else _guiSetVisible(element, bool) end end _destroyElement = destroyElement function destroyElement(element) if butonmu(element) then local sira = butonmu(element) _destroyElement(btablo[sira].resim) btablo[sira] = nil elseif editmi(element) then local sira = editmi(element) _destroyElement(etablo[sira].resim) etablo[sira] = nil elseif gridlistmi(element) then local sira = gridlistmi(element) _destroyElement(Ltablo[sira].resim) Ltablo[sira] = nil elseif memomu(element) then local sira = memomu(element) _destroyElement(mtablo[sira].resim) mtablo[sira] = nil else _destroyElement(element) end end _guiWindowSetSizable = guiWindowSetSizable function guiWindowSetSizable(element, bool) if getElementType(element) ~= "gui-window" then return false else _guiWindowSetSizable(element, bool) end end Now how to make this script colorful like the FR Gui ?? Link to comment
Discord Moderators Zango Posted April 28, 2020 Discord Moderators Share Posted April 28, 2020 You need to do the same you did on the freeroam GUI You need to put the code you posted into the resource of your other GUI, and it should work automatically. Link to comment
kokoseda Posted April 29, 2020 Author Share Posted April 29, 2020 17 hours ago, Zango said: You need to do the same you did on the freeroam GUI You need to put the code you posted into the resource of your other GUI, and it should work automatically. I did nothing change. Link to comment
Tekken Posted April 30, 2020 Share Posted April 30, 2020 I think it has something to do with guiSetProperty Link to comment
kokoseda Posted April 30, 2020 Author Share Posted April 30, 2020 Where is the professionals? Link to comment
Discord Moderators Zango Posted April 30, 2020 Discord Moderators Share Posted April 30, 2020 Your colorful GUI is created by the code you posted. It replaces the MTA functions. For example in guiCreateWindow it creates an image as background instead of an actual window. Same for the buttons. And then it stores the original MTA function in _guiCreateWindow. You just need to take that code and put it into the other GUI. Post the code for the arabic GUI and I'll do it for you. Link to comment
kokoseda Posted April 30, 2020 Author Share Posted April 30, 2020 GUIEditor = { button = {}, window = {}, label = {} } local screenW, screenH = guiGetScreenSize() GUIEditor.window[1] = guiCreateWindow((screenW - 468) / 2, (screenH - 348) / 2, 468, 348, "التحكم بالسيارة", false) guiWindowSetSizable(GUIEditor.window[1], false) FarolOff = guiCreateButton(257, 63, 83, 35, "إيقاف", false, GUIEditor.window[1]) MotorOff = guiCreateButton(257, 141, 83, 35, "إيقاف", false, GUIEditor.window[1]) FarolOn = guiCreateButton(360, 63, 83, 35, "تشغيل", false, GUIEditor.window[1]) MotorOn = guiCreateButton(360, 141, 83, 35, "تشغيل", false, GUIEditor.window[1]) Capoo = guiCreateScrollBar(22, 57, 194, 19, true, false, GUIEditor.window[1]) PortaEsquedra1f = guiCreateScrollBar(22, 102, 194, 19, true, false, GUIEditor.window[1]) PortaDireita1 = guiCreateScrollBar(22, 152, 194, 19, true, false, GUIEditor.window[1]) PortaEsquedra2 = guiCreateScrollBar(22, 201, 194, 19, true, false, GUIEditor.window[1]) PortaDireita2 = guiCreateScrollBar(22, 252, 194, 19, true, false, GUIEditor.window[1]) PortaMalas = guiCreateScrollBar(22, 305, 194, 19, true, false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(79, 34, 85, 19, "الكبوت", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[1], "center") GUIEditor.label[2] = guiCreateLabel(79, 83, 85, 19, "الباب - يسار", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[2], "center") GUIEditor.label[3] = guiCreateLabel(79, 131, 85, 19, "الباب - يمين", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[3], "center") GUIEditor.label[4] = guiCreateLabel(74, 181, 95, 20, "الباب - خلف يسار", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[4], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[4], "center") GUIEditor.label[5] = guiCreateLabel(79, 286, 85, 19, "الشنطة", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[5], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[5], "center") GUIEditor.label[6] = guiCreateLabel(74, 230, 95, 20, "الباب - خلف يمين", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[6], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[6], "center") GUIEditor.button[1] = guiCreateButton(267, 210, 172, 38, "فك الصدام الامامي", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(267, 267, 172, 38, "فك الصدام الخلفي", false, GUIEditor.window[1]) GUIEditor.label[7] = guiCreateLabel(308, 34, 85, 19, "النور", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[7], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[7], "center") GUIEditor.label[8] = guiCreateLabel(308, 112, 85, 19, "المحرك", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[8], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[8], "center") Link to comment
Discord Moderators Zango Posted April 30, 2020 Discord Moderators Share Posted April 30, 2020 -- ***************** -- Beginning of colorful GUI functions -- ***************** genelGuiTablo = {} --guiCreateWindow wtablo = {} --guiCreateButton btablo = {} --guiCreateGridList Ltablo = {} --guiCreateMemo mtablo = {} --guiCreateEdit etablo = {} function resimOlustur(isim) if fileExists(isim.."png") then return isim.."png" end local texture = dxCreateTexture(1,1) local pixels = dxGetTexturePixels(texture) local r,g,b,a = 155,155,155,155 dxSetPixelColor(pixels,0,0,r,g,b,a) dxSetTexturePixels(texture, pixels) local pxl = dxConvertPixels(dxGetTexturePixels(texture),"png") local nImg = fileCreate(isim..".png") fileWrite(nImg,pxl) fileClose(nImg) return isim..".png" end function renkVer(resim,hex) guiSetProperty(resim,"ImageColours","tl:FF"..hex.." tr:FF"..hex.." bl:FF"..hex.." br:FF"..hex) end _guiCreateWindow = guiCreateWindow function guiCreateWindow(x,y,g,u,yazi,relative,parent,renk1,renk2,renk3,renk4,kapatkutu) wsayi = #wtablo +1 if not renk1 or string.len(renk1) > 6 then renk1 = "ED7717" -- window renk üst taraf // window top color end if not renk2 or string.len(renk2) > 6 then renk2 = "ED7717" -- window renk alt taraf // window bottom color end if not renk3 or string.len(renk3) > 6 then renk3 = "131314" -- baslik renk // window header back color end if not renk4 or string.len(renk4) > 6 then renk4 = "1883D7" -- window kenar çizgi // window outline color end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu relative = false end if not wtablo[wsayi] then wtablo[wsayi] = {} end --arkaResim wtablo[wsayi].resim = guiCreateStaticImage(x,y,g,u,resimOlustur("test"),relative,parent) renkVer(wtablo[wsayi].resim,renk1) guiSetProperty(wtablo[wsayi].resim,"ImageColours","tl:FF"..renk1.." tr:FF"..renk1.." bl:FF"..renk2.." br:FF"..renk2.."") --baslıkArka wtablo[wsayi].basarka = guiCreateStaticImage(0,0,g,20, resimOlustur("test"), false, wtablo[wsayi].resim) renkVer(wtablo[wsayi].basarka,renk3) --kenarlar wtablo[wsayi].kenarlar = { ordaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, wtablo[wsayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, wtablo[wsayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, wtablo[wsayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, wtablo[wsayi].resim) } for i,v in pairs(wtablo[wsayi].kenarlar) do renkVer(v,renk4) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end --baslıkLabel wtablo[wsayi].label = guiCreateLabel((g/2)-((string.len(yazi)*8)/2),0,(string.len(yazi)*8),20, yazi, false, wtablo[wsayi].basarka) guiSetFont(wtablo[wsayi].label, "default-bold-small") guiLabelSetHorizontalAlign(wtablo[wsayi].label, "center") guiLabelSetVerticalAlign(wtablo[wsayi].label, "center") return wtablo[wsayi].resim end _guiCreateButton = guiCreateButton function guiCreateButton(x,y,g,u,yazi,relative,parent,renk1,renk2) bsayi = #btablo +1 if not btablo[bsayi] then btablo[bsayi] = {} end if not renk1 or string.len(renk1) > 6 then --renk = math.random(999999) renk1 = "ff0000" -- genel buton rengi // button back color end if not renk2 or string.len(renk2) > 6 then renk2 = "FFFFFF" -- buton kenar rengi // button outline color end --arkaResim if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu relative = false end btablo[bsayi].resim = guiCreateStaticImage(x,y,g,u,resimOlustur("test"),relative,parent) renkVer(btablo[bsayi].resim,renk1) --kenarlar btablo[bsayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), relative, btablo[bsayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), relative, btablo[bsayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), relative, btablo[bsayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), relative, btablo[bsayi].resim) } for i,v in pairs(btablo[bsayi].kenarlar) do renkVer(v,renk2) guiSetAlpha(v, 0.4) end --label btablo[bsayi].label = guiCreateLabel(0,0,g,u,yazi,relative,btablo[bsayi].resim) guiLabelSetHorizontalAlign(btablo[bsayi].label, "center") guiLabelSetVerticalAlign(btablo[bsayi].label, "center") guiSetFont(btablo[bsayi].label, "default-bold-small") genelGuiTablo[btablo[bsayi].label] = btablo[bsayi].kenarlar return btablo[bsayi].label end _guiCreateGridList = guiCreateGridList function guiCreateGridList(x,y,g,u,relative,parent,kenarrenk) Ssayi = #Ltablo +1 if not kenarrenk or string.len(kenarrenk) > 6 then kenarrenk = "1883D7" -- gridlist kenar renk // gridlist outline color end if not Ltablo[Ssayi] then Ltablo[Ssayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu end local relative = false Ltablo[Ssayi].resim = guiCreateLabel(x,y,g,u, "", relative, parent) Ltablo[Ssayi].liste = _guiCreateGridList(-8,-8,g+10, u+10,false, Ltablo[Ssayi].resim) Ltablo[Ssayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, Ltablo[Ssayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, Ltablo[Ssayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, Ltablo[Ssayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, Ltablo[Ssayi].resim)} genelGuiTablo[Ltablo[Ssayi].liste] = Ltablo[Ssayi].kenarlar for i,v in pairs(Ltablo[Ssayi].kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return Ltablo[Ssayi].liste end _guiCreateEdit = guiCreateEdit function guiCreateEdit(x,y,g,u,yazi,relative,parent,kenarrenk) esayi = #etablo +1 if not kenarrenk or string.len(kenarrenk) > 6 then kenarrenk = "1883D7" -- edit kenar renk // edit outline color end if not etablo[esayi] then etablo[esayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu end local relative = false etablo[esayi].resim = guiCreateLabel(x,y,g,u, "", relative, parent) etablo[esayi].edit = _guiCreateEdit(-7,-5,g+15, u+8,yazi,false, etablo[esayi].resim) etablo[esayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, etablo[esayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, etablo[esayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, etablo[esayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, etablo[esayi].resim) } genelGuiTablo[etablo[esayi].edit] = etablo[esayi].kenarlar for i,v in pairs(etablo[esayi].kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return etablo[esayi].edit end _guiCreateMemo = guiCreateMemo function guiCreateMemo(x,y,g,u,yazi,relative,parent,kenarrenk) msayi = #mtablo +1 if not kenarrenk or string.len(kenarrenk) > 6 then kenarrenk = "1883D7" -- memo kenar renk // memo outline color end if not mtablo[msayi] then mtablo[msayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu end local relative = false mtablo[msayi].resim = guiCreateLabel(x,y,g,u, "", relative, parent) mtablo[msayi].memo = _guiCreateMemo(-5,-10,g+15, u+10, yazi,false, mtablo[msayi].resim) mtablo[msayi].kenarlar = { ortaUst = guiCreateStaticImage(0,0,g,1,resimOlustur("test"), false, mtablo[msayi].resim), ortaAlt = guiCreateStaticImage(0,u-1,g,1,resimOlustur("test"), false, mtablo[msayi].resim), sol = guiCreateStaticImage(0,0,1,u,resimOlustur("test"), false, mtablo[msayi].resim), sag = guiCreateStaticImage(g-1,0,1,u,resimOlustur("test"), false, mtablo[msayi].resim)} genelGuiTablo[mtablo[msayi].memo] = mtablo[msayi].kenarlar for i,v in pairs(mtablo[msayi].kenarlar) do renkVer(v,kenarrenk) guiSetProperty(v, "AlwaysOnTop", "True") guiSetAlpha(v, 0.4) end return mtablo[msayi].memo end --edit,gridlst,buton,memo mouse addEventHandler("onClientMouseEnter", resourceRoot, function() for i,v in pairs(genelGuiTablo) do if source == i then for i,v in pairs(v) do guiSetAlpha(v, 1) end end end end) addEventHandler("onClientMouseLeave", resourceRoot, function() for i,v in pairs(genelGuiTablo) do if source == i then for i,v in pairs(v) do guiSetAlpha(v, 0.4) end end end end) function butonmu(label) for i,v in pairs(btablo) do if v.label == label then return i end end return false end function penceremi(resim) for i,v in pairs(wtablo) do if v.resim == resim then return i end end return false end function editmi(edit) for i,v in pairs(etablo) do if v.edit == edit then return i end end return false end function gridlistmi(liste) for i,v in pairs(Ltablo) do if v.liste == liste then return i end end return false end function memomu(memo) for i,v in pairs(mtablo) do if v.memo == memo then return i end end return false end function basliklabelmi(label) for i,v in pairs(wtablo) do if v.label == label then return i end end return false end function baslikmi(element) for i,v in pairs(wtablo) do if v.basarka == element or wtablo[basliklabelmi(element)] and v.label == element then return i end end return false end --basinca olan ufalma // anim when click basili = {} addEventHandler("onClientGUIMouseDown", resourceRoot, function() if butonmu(source) then if basili[source] then return end basili[source] = true local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x+2,y+2, false) guiSetSize(source, g-4,u-4, false) end end) addEventHandler("onClientGUIMouseUp", resourceRoot, function() if butonmu(source) then if not basili[source] then for i,v in pairs(basili) do if v == true then source = i break end end end if not basili[source] then return end basili[source] = nil local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x-2,y-2, false) guiSetSize(source, g+4,u+4, false) else for i,v in pairs(basili) do if v == true then source = i break end end if butonmu(source) then basili[source] = nil local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x-2,y-2, false) guiSetSize(source, g+4,u+4, false) end end end) function basiliBirak() for i,v in pairs(basili) do if v == true then source = i break end end if butonmu(source) then basili[source] = nil local g,u = guiGetSize(source, false) local x,y = guiGetPosition(source, false) guiSetPosition(source, x-2,y-2, false) guiSetSize(source, g+4,u+4, false) end end addEventHandler("onClientClick", root, function(button, durum, _, _, _, _, _, tiklanan) if durum == "up" then if tiklanan then local element = getElementType(tiklanan) if not string.find(element, "gui-") then basiliBirak() end else basiliBirak() end end end) --panel taşıma // window drag and move addEventHandler( "onClientGUIMouseDown", resourceRoot,function ( btn, x, y ) if btn == "left" and baslikmi(source) then local source = wtablo[baslikmi(source)].resim clickedElement = source local elementPos = { guiGetPosition( source, false ) } offsetPos = { x - elementPos[ 1 ], y - elementPos[ 2 ] }; end end) addEventHandler( "onClientGUIMouseUp", resourceRoot,function ( btn, x, y ) if btn == "left" and baslikmi(source) then clickedElement = nil end end) addEventHandler( "onClientCursorMove", getRootElement( ),function ( _, _, x, y ) if clickedElement then guiSetPosition( clickedElement, x - offsetPos[ 1 ], y - offsetPos[ 2 ], false ) end end) --diğer funclar // other funcs _guiGetPosition = guiGetPosition function guiGetPosition(element,relative) if butonmu(element) then local sira = butonmu(element) local x,y = _guiGetPosition(btablo[sira].resim, relative) return x,y else local x,y = _guiGetPosition(element, relative) return x,y end end _guiSetPosition = guiSetPosition function guiSetPosition(element,x,y,relative) if butonmu(element) then local sira = butonmu(element) _guiSetPosition(btablo[sira].resim, x,y, relative) else _guiSetPosition(element,x,y,relative) end end _guiGetSize = guiGetSize function guiGetSize(element,relative) if butonmu(element) then local sira = butonmu(element) local g,u = _guiGetSize(btablo[sira].resim, relative) return g,u else local g,u = _guiGetSize(element, relative) return g,u end end _guiSetSize = guiSetSize function guiSetSize(element,g,u,relative) if butonmu(element) then local sira = butonmu(element) _guiSetSize(btablo[sira].resim, g,u, false) _guiSetSize(btablo[sira].label, g,u, false) --sağ kenar çizgi _guiSetPosition(btablo[sira].kenarlar.sag, g-1, 0, false) _guiSetSize(btablo[sira].kenarlar.sag, 1,u, false) --alt kenar çizgi _guiSetPosition(btablo[sira].kenarlar.ortaAlt, 0, u-1, false) _guiSetSize(btablo[sira].kenarlar.ortaAlt, g,1, false) elseif penceremi(element) then local sira = penceremi(element) _guiSetSize(wtablo[sira].resim, g,u, false) --sağ kenar çizgi _guiSetPosition(wtablo[sira].kenarlar.sag, g-1, 0, false) _guiSetSize(wtablo[sira].kenarlar.sag, 1,u, false) --alt kenar çizgi _guiSetPosition(wtablo[sira].kenarlar.ortaAlt, 0, u-1, false) _guiSetSize(wtablo[sira].kenarlar.ortaAlt, g,1, false) --baslik _guiSetSize(wtablo[sira].basarka, g,20, false) --kapat _guiSetPosition(wtablo[sira].kapatArka, g-25,1, false) --label local yazi = guiGetText(wtablo[sira].label) _guiSetPosition(wtablo[sira].label, (g/2)-((string.len(yazi)*8)/2),0, false) _guiSetSize(wtablo[sira].label,(string.len(yazi)*8),20, false) guiLabelSetHorizontalAlign(wtablo[sira].label, "center") guiLabelSetVerticalAlign(wtablo[sira].label, "center") end end _guiSetText = guiSetText function guiSetText(element, yazi) if penceremi(element) then local sira = penceremi(element) local g,u = guiGetSize(wtablo[sira].resim,false) guiSetPosition(wtablo[sira].label,(g/2)-((string.len(yazi)*8)/2),0, false) guiSetSize(wtablo[sira].label, (string.len(yazi)*8),20, false) guiLabelSetHorizontalAlign(wtablo[sira].label, "center") guiLabelSetVerticalAlign(wtablo[sira].label, "center") _guiSetText(wtablo[sira].label, yazi) else _guiSetText(element, yazi) end end _guiGetText = guiGetText function guiGetText(element) if penceremi(element) then local sira = penceremi(element) local yazi = _guiGetText(wtablo[sira].label) return yazi else local yazi = _guiGetText(element) return yazi end end _guiSetEnabled = guiSetEnabled function guiSetEnabled(element, bool) if butonmu(element) then if bool == false then guiSetAlpha(btablo[butonmu(element)].resim,0.5) _guiSetEnabled(element, bool) else guiSetAlpha(btablo[butonmu(element)].resim,1) _guiSetEnabled(element, bool) end else _guiSetEnabled(element, bool) end end _guiSetVisible = guiSetVisible function guiSetVisible(element, bool) if butonmu(element) then local sira = butonmu(element) _guiSetVisible(btablo[sira].resim, bool) else _guiSetVisible(element, bool) end end _destroyElement = destroyElement function destroyElement(element) if butonmu(element) then local sira = butonmu(element) _destroyElement(btablo[sira].resim) btablo[sira] = nil elseif editmi(element) then local sira = editmi(element) _destroyElement(etablo[sira].resim) etablo[sira] = nil elseif gridlistmi(element) then local sira = gridlistmi(element) _destroyElement(Ltablo[sira].resim) Ltablo[sira] = nil elseif memomu(element) then local sira = memomu(element) _destroyElement(mtablo[sira].resim) mtablo[sira] = nil else _destroyElement(element) end end _guiWindowSetSizable = guiWindowSetSizable function guiWindowSetSizable(element, bool) if getElementType(element) ~= "gui-window" then return false else _guiWindowSetSizable(element, bool) end end -- ***************** -- End of colorful GUI functions -- ***************** -- ***************** -- Beginning of arabic GUI -- ***************** GUIEditor = { button = {}, window = {}, label = {} } local screenW, screenH = guiGetScreenSize() GUIEditor.window[1] = guiCreateWindow((screenW - 468) / 2, (screenH - 348) / 2, 468, 348, "التحكم بالسيارة", false) guiWindowSetSizable(GUIEditor.window[1], false) FarolOff = guiCreateButton(257, 63, 83, 35, "إيقاف", false, GUIEditor.window[1]) MotorOff = guiCreateButton(257, 141, 83, 35, "إيقاف", false, GUIEditor.window[1]) FarolOn = guiCreateButton(360, 63, 83, 35, "تشغيل", false, GUIEditor.window[1]) MotorOn = guiCreateButton(360, 141, 83, 35, "تشغيل", false, GUIEditor.window[1]) Capoo = guiCreateScrollBar(22, 57, 194, 19, true, false, GUIEditor.window[1]) PortaEsquedra1f = guiCreateScrollBar(22, 102, 194, 19, true, false, GUIEditor.window[1]) PortaDireita1 = guiCreateScrollBar(22, 152, 194, 19, true, false, GUIEditor.window[1]) PortaEsquedra2 = guiCreateScrollBar(22, 201, 194, 19, true, false, GUIEditor.window[1]) PortaDireita2 = guiCreateScrollBar(22, 252, 194, 19, true, false, GUIEditor.window[1]) PortaMalas = guiCreateScrollBar(22, 305, 194, 19, true, false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(79, 34, 85, 19, "الكبوت", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[1], "center") GUIEditor.label[2] = guiCreateLabel(79, 83, 85, 19, "الباب - يسار", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[2], "center") GUIEditor.label[3] = guiCreateLabel(79, 131, 85, 19, "الباب - يمين", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[3], "center") GUIEditor.label[4] = guiCreateLabel(74, 181, 95, 20, "الباب - خلف يسار", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[4], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[4], "center") GUIEditor.label[5] = guiCreateLabel(79, 286, 85, 19, "الشنطة", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[5], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[5], "center") GUIEditor.label[6] = guiCreateLabel(74, 230, 95, 20, "الباب - خلف يمين", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[6], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[6], "center") GUIEditor.button[1] = guiCreateButton(267, 210, 172, 38, "فك الصدام الامامي", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(267, 267, 172, 38, "فك الصدام الخلفي", false, GUIEditor.window[1]) GUIEditor.label[7] = guiCreateLabel(308, 34, 85, 19, "النور", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[7], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[7], "center") GUIEditor.label[8] = guiCreateLabel(308, 112, 85, 19, "المحرك", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[8], "center", false) guiLabelSetVerticalAlign(GUIEditor.label[8], "center") -- ***************** -- End of arabic GUI -- ***************** As I mentioned, I just put the first code you posted together with your GUI code Link to comment
#\_oskar_/# Posted April 30, 2020 Share Posted April 30, 2020 create a new file and add it in meta.xml <script src="colorful.Lua" type="client" /> -- here is your codes file colorful <script src="gui.Lua" type="client" /> -- here file your gui Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now