0 Üye ve 1 Ziyaretçi konuyu incelemekte.
genelGuiTablo = {}--guiCreateWindowwtablo = {}--guiCreateButtonbtablo = {}ltablo = {}function resimOlustur(isim,a) if fileExists(isim.."png") then return isim.."png" end local texture = dxCreateTexture(1,1) local pixels = dxGetTexturePixels(texture) local r,g,b,a = 255,255,255,a or 255 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" endfunction renkVer(resim,hex) guiSetProperty(resim,"ImageColours","tl:FF000000"..hex.." tr:FF"..hex.." bl:FF"..hex.." br:FF"..hex)end--font1 = guiCreateFont("dosyalar/font_adi.ttf",font_buyukluk)-- label --function label_olustur(x,y,g,u,yazi,relative,parent,hor,ver,buyukluk) lsayi = #ltablo +1 if not ltablo[lsayi] then ltablo[lsayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu relative = false end yazi_tipi = guiCreateFont("font/yazi_tipi.ttf",buyukluk) ltablo[lsayi].labell = guiCreateLabel(x,y,g,u,yazi,relative,parent,hor,ver) guiSetFont(ltablo[lsayi].labell,yazi_tipi) guiLabelSetHorizontalAlign(ltablo[lsayi].labell,(hor or "left")) guiLabelSetVerticalAlign(ltablo[lsayi].labell,(ver or "top")) return ltablo[lsayi].labell end _guiCreateWindow = guiCreateWindowfunction guiCreateWindow(x,y,g,u,yazi,relative,parent,renk1,renk2,renk3,renk4) wsayi = #wtablo +1 if not renk1 or string.len(renk1) > 6 then renk1 = "1E1E1F" -- window renk üst taraf // window top color end if not renk2 or string.len(renk2) > 6 then renk2 = "1E1E1F" -- 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 = label_olustur((g/2)-((string.len(yazi)*8)/2),0,(string.len(yazi)*8),20, yazi, false, wtablo[wsayi].basarka,"center","center",8) --kapatArka --wtablo[wsayi].kapatArka = guiCreateStaticImage(g-25,1,25,20,resimOlustur("test"),false,wtablo[wsayi].basarka) renkVer(wtablo[wsayi].kapatArka,"E81123") guiSetAlpha(wtablo[wsayi].kapatArka, 0.5) kapatLabel wtablo[wsayi].kapat = guiCreateLabel(0,-2,25,20, "X", false, wtablo[wsayi].kapatArka) guiSetFont(wtablo[wsayi].kapat, "default-bold-small") guiLabelSetHorizontalAlign(wtablo[wsayi].kapat, "center") guiLabelSetVerticalAlign(wtablo[wsayi].kapat, "center") return wtablo[wsayi].resimend_guiCreateButton = guiCreateButtonfunction 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 = "131314" -- genel buton rengi end if not renk2 or string.len(renk2) > 6 then renk2 = "FFFFFF" -- buton kenar rengi 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 = label_olustur(0,0,g,u,yazi,relative,btablo[bsayi].resim,"center","center",8) genelGuiTablo[btablo[bsayi].label] = btablo[bsayi].kenarlar return btablo[bsayi].label end--edit,gridlst,buton,memo mouseaddEventHandler("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 endend)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 endend)--pencere mouseaddEventHandler("onClientMouseEnter", resourceRoot, function() for i,v in pairs(wtablo) do if source == v.kapat then guiSetAlpha(v.kapatArka, 1) break end endend)addEventHandler("onClientMouseLeave", resourceRoot, function() for i,v in pairs(wtablo) do if source == v.kapat then guiSetAlpha(v.kapatArka, 0.5) break end endend)addEventHandler("onClientGUIClick", resourceRoot, function() for i,v in pairs(wtablo) do if source == v.kapat then guiSetVisible(v.resim, false) showCursor(false) end end end)function butonmu(label) for i,v in pairs(btablo) do if v.label == label then return i end end return false endfunction penceremi(resim) for i,v in pairs(wtablo) do if v.resim == resim then return i end end return false endfunction basliklabelmi(label) for i,v in pairs(wtablo) do if v.label == label then return i end end return false endfunction 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 ufalmabasili = {}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) endend)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 endend)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 endaddEventHandler("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şımaaddEventHandler( "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 ] }; endend)addEventHandler( "onClientGUIMouseUp", resourceRoot,function ( btn, x, y ) if btn == "left" and baslikmi(source) then clickedElement = nil endend)addEventHandler( "onClientCursorMove", getRootElement( ),function ( _, _, x, y ) if clickedElement then guiSetPosition( clickedElement, x - offsetPos[ 1 ], y - offsetPos[ 2 ], false ) endend)--diğer funclar_guiGetPosition = guiGetPositionfunction 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 endend_guiSetPosition = guiSetPositionfunction 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) endend_guiGetSize = guiGetSizefunction 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 endend_guiSetSize = guiSetSizefunction 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 = guiSetTextfunction 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) endend_guiGetText = guiGetTextfunction 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 endend_guiSetEnabled = guiSetEnabledfunction 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 = guiSetVisiblefunction guiSetVisible(element, bool) if butonmu(element) then local sira = butonmu(element) _guiSetVisible(btablo[sira].resim, bool) else _guiSetVisible(element, bool) end end_destroyElement = destroyElementfunction destroyElement(element) if butonmu(element) then local sira = butonmu(element) _destroyElement(btablo[sira].resim) btablo[sira] = nil else _destroyElement(element) end end _guiWindowSetSizable = guiWindowSetSizablefunction guiWindowSetSizable(element, bool) if getElementType(element) ~= "gui-window" then return false else _guiWindowSetSizable(element, bool) end end
buton = guiCreateButton(x,y,g,u,"buton",false,panel,"CC0000")
genelGuiTablo = {}--guiCreateWindowwtablo = {}--guiCreateButtonbtablo = {}ltablo = {}function resimOlustur(isim,a) if fileExists(isim.."png") then return isim.."png" end local texture = dxCreateTexture(1,1) local pixels = dxGetTexturePixels(texture) local r,g,b,a = 255,255,255,a or 255 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" endfunction renkVer(resim,hex) guiSetProperty(resim,"ImageColours","tl:FF000000"..hex.." tr:FF"..hex.." bl:FF"..hex.." br:FF"..hex)end--font1 = guiCreateFont("dosyalar/font_adi.ttf",font_buyukluk)-- label --function label_olustur(x,y,g,u,yazi,relative,parent,hor,ver,buyukluk) lsayi = #ltablo +1 if not ltablo[lsayi] then ltablo[lsayi] = {} end if relative then px,pu = guiGetSize(parent,false) x,y,g,u = x*px,y*pu,g*px,u*pu relative = false end yazi_tipi = guiCreateFont("font/yazi_tipi.ttf",buyukluk) ltablo[lsayi].labell = guiCreateLabel(x,y,g,u,yazi,relative,parent,hor,ver) guiSetFont(ltablo[lsayi].labell,yazi_tipi) guiLabelSetHorizontalAlign(ltablo[lsayi].labell,(hor or "left")) guiLabelSetVerticalAlign(ltablo[lsayi].labell,(ver or "top")) return ltablo[lsayi].labell end _guiCreateWindow = guiCreateWindowfunction guiCreateWindow(x,y,g,u,yazi,relative,parent,renk1,renk2,renk3,renk4) wsayi = #wtablo +1 if not renk1 or string.len(renk1) > 6 then renk1 = "1E1E1F" -- window renk üst taraf // window top color end if not renk2 or string.len(renk2) > 6 then renk2 = "1E1E1F" -- 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 = label_olustur((g/2)-((string.len(yazi)*8)/2),0,(string.len(yazi)*8),20, yazi, false, wtablo[wsayi].basarka,"center","center",8) --kapatArka --wtablo[wsayi].kapatArka = guiCreateStaticImage(g-25,1,25,20,resimOlustur("test"),false,wtablo[wsayi].basarka) renkVer(wtablo[wsayi].kapatArka,"E81123") guiSetAlpha(wtablo[wsayi].kapatArka, 0.5) kapatLabel wtablo[wsayi].kapat = guiCreateLabel(0,-2,25,20, "X", false, wtablo[wsayi].kapatArka) guiSetFont(wtablo[wsayi].kapat, "default-bold-small") guiLabelSetHorizontalAlign(wtablo[wsayi].kapat, "center") guiLabelSetVerticalAlign(wtablo[wsayi].kapat, "center") return wtablo[wsayi].resimend_guiCreateButton = guiCreateButtonfunction 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 = "131314" -- genel buton rengi end if not renk2 or string.len(renk2) > 6 then renk2 = "FFFFFF" -- buton kenar rengi 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 = label_olustur(0,0,g,u,yazi,relative,btablo[bsayi].resim,"center","center",8) genelGuiTablo[btablo[bsayi].label] = btablo[bsayi].kenarlar return btablo[bsayi].label end--edit,gridlst,buton,memo mouseaddEventHandler("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 endend)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 endend)--pencere mouseaddEventHandler("onClientMouseEnter", resourceRoot, function() for i,v in pairs(wtablo) do if source == v.kapat then guiSetAlpha(v.kapatArka, 1) break end endend)addEventHandler("onClientMouseLeave", resourceRoot, function() for i,v in pairs(wtablo) do if source == v.kapat then guiSetAlpha(v.kapatArka, 0.5) break end endend)addEventHandler("onClientGUIClick", resourceRoot, function() for i,v in pairs(wtablo) do if source == v.kapat then guiSetVisible(v.resim, false) showCursor(false) end end end)function butonmu(label) for i,v in pairs(btablo) do if v.label == label then return i end end return false endfunction penceremi(resim) for i,v in pairs(wtablo) do if v.resim == resim then return i end end return false endfunction basliklabelmi(label) for i,v in pairs(wtablo) do if v.label == label then return i end end return false endfunction 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 ufalmabasili = {}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) endend)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 endend)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 endaddEventHandler("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şımaaddEventHandler( "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 ] }; endend)addEventHandler( "onClientGUIMouseUp", resourceRoot,function ( btn, x, y ) if btn == "left" and baslikmi(source) then clickedElement = nil endend)addEventHandler( "onClientCursorMove", getRootElement( ),function ( _, _, x, y ) if clickedElement then guiSetPosition( clickedElement, x - offsetPos[ 1 ], y - offsetPos[ 2 ], false ) endend)--diğer funclar_guiGetPosition = guiGetPositionfunction 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 endend_guiSetPosition = guiSetPositionfunction 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) endend_guiGetSize = guiGetSizefunction 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 endend_guiSetSize = guiSetSizefunction 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 = guiSetTextfunction 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) endend_guiGetText = guiGetTextfunction 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 endend_guiSetEnabled = guiSetEnabledfunction 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 = guiSetVisiblefunction guiSetVisible(element, bool) if butonmu(element) then local sira = butonmu(element) _guiSetVisible(btablo[sira].resim, bool) else _guiSetVisible(element, bool) end end_destroyElement = destroyElementfunction destroyElement(element) if butonmu(element) then local sira = butonmu(element) _destroyElement(btablo[sira].resim) btablo[sira] = nil else _destroyElement(element) end end _guiWindowSetSizable = guiWindowSetSizablefunction guiWindowSetSizable(element, bool) if getElementType(element) ~= "gui-window" then return false else _guiWindowSetSizable(element, bool) end endfunction guiButtonSetColor(button,renk1) if butonmu(button) then local sira = butonmu(button) for i,v in pairs(btablo[sira].renk1) do renkVer(v,renk) guiSetAlpha(v, 0.5) end endend
guiButtonSetColor(getControl(wndMain, "karakterler"),"ffcc00")
function _buildWindow(wnd, baseWnd, parentWnd) local wndClass = wnd[1] if wndClass == 'br' then return end local relX, relY, relWidth, relHeight if parentWnd then if wnd.x and wnd.y then relX = wnd.x/parentWnd.width relY = wnd.y/parentWnd.height end relWidth = wnd.width / parentWnd.width relHeight = wnd.height / parentWnd.height end local elem if wndClass == 'wnd' then local screenWidth, screenHeight = guiGetScreenSize() if not wnd.x then wnd.x = screenWidth/2 - wnd.width/2 else local i, f = math.modf(wnd.x) if f ~= 0 then wnd.x = screenWidth * wnd.x end if wnd.x < 0 then wnd.x = screenWidth - math.abs(wnd.x) - wnd.width end end if not wnd.y then wnd.y = screenHeight/2 - wnd.height/2 else local i, f = math.modf(wnd.y) if f ~= 0 then wnd.y = screenHeight * wnd.y end if wnd.y < 0 then wnd.y = screenHeight - math.abs(wnd.y) - wnd.height end end elem = guiCreateWindow(wnd.x, wnd.y, wnd.width, wnd.height, wnd.text, false) guiWindowSetSizable(elem, false) guiBringToFront(elem) g_openedWindows[wnd] = true elseif wndClass == 'chk' then elem = guiCreateCheckBox(relX, relY, relWidth, relHeight, wnd.text or wnd.id or '', false, true, parentWnd.element) elseif wndClass == 'tbp' then elem = guiCreateTabPanel(relX, relY, relWidth, relHeight, true, parentWnd.element) elseif wndClass == 'tab' then elem = guiCreateTab(text, parentWnd.element) elseif wndClass == 'lst' then elem = guiCreateGridList(relX, relY, relWidth, relHeight, true, parentWnd.element) if wnd.columns then guiGridListSetSortingEnabled(elem, false) for i, column in ipairs(wnd.columns) do guiGridListAddColumn(elem, column.text or column.attr or '', column.width or 0.9) end end elseif wndClass == 'img' then elem = guiCreateStaticImage(relX, relY, relWidth, relHeight, wnd.src or '', true, parentWnd.element) else elem = _G['guiCreate' .. classInfo[wndClass].className](relX, relY, relWidth, relHeight, wnd.text or wnd.id or '', true, parentWnd.element) if wnd.align and wndClass == 'lbl' then guiLabelSetHorizontalAlign(elem, wnd.align, true) end end wnd.element = elem if wnd.controls then for id, controlwnd in pairs(wnd.controls) do _buildWindow(controlwnd, baseWnd or wnd, wnd) end end if wnd.tabs then for id, tab in pairs(wnd.tabs) do _buildWindow(tab, baseWnd, wnd) end end if wnd.rows then if wnd.rows.xml then -- get rows from xml bindGridListToTable(wnd, not gridListHasCache(wnd) and xmlToTable(wnd.rows.xml, wnd.rows.attrs) or false, wnd.expandlastlevel or wnd.expandlastlevel == nil) else -- rows hardcoded in window definition bindGridListToTable(wnd, not gridListHasCache(wnd) and wnd.rows or false, false) end end local clickhandler = nil if wnd.onclick then if wndClass == 'img' then clickhandler = function(btn, state, x, y) local imgX, imgY = getControlScreenPos(wnd) wnd.onclick((x - imgX)/wnd.width, (y - imgY)/wnd.height, btn) end else clickhandler = function() wnd.onclick() end end elseif wnd.window then clickhandler = function() toggleWindow(wnd.window) end elseif wnd.inputbox then clickhandler = function() wndInput = { 'wnd', width = 170, height = 60, controls = { {'txt', id='input', text='', width=60}, {'btn', id='ok', onclick=function() wnd.inputbox.callback(getControlText(wndInput, 'input')) closeWindow(wndInput) end}, {'btn', id='cancel', closeswindow=true} } } for propname, propval in pairs(wnd.inputbox) do wndInput[propname] = propval end createWindow(wndInput) guiBringToFront(getControl(wndInput, 'input')) end elseif wnd.closeswindow then clickhandler = function() closeWindow(baseWnd) end end if clickhandler then if wnd.ClickSpamProtected then g_protectedElements[elem] = clickhandler addEventHandler('onClientGUIClick', elem, onProtectedClick, false) else addEventHandler('onClientGUIClick', elem, clickhandler, false) end end if wnd.ondoubleclick then local doubleclickhandler if wndClass == 'img' then doubleclickhandler = function(btn, state, x, y) local imgX, imgY = getControlScreenPos(wnd) wnd.ondoubleclick((x - imgX)/wnd.width, (y - imgY)/wnd.height) end else doubleclickhandler = wnd.ondoubleclick end if wnd.DoubleClickSpamProtected then g_protectedElements[elem] = doubleclickhandler addEventHandler('onClientGUIDoubleClick', elem, onProtectedClick, false) else addEventHandler('onClientGUIDoubleClick', elem, doubleclickhandler, false) end end if wnd.oncreate then wnd.oncreate() endend
wndMain = { 'wnd', text = 'Freeroam Panel | F1', x = 10, y = 180, width = 280, controls = { {'lbl', id='xpos', text='x', width=0}, {'lbl', id='ypos', text='y', width=0}, {'lbl', id='zpos', text='z', width=0}, {'btn', id='Karakterler', window=wndSkin, width = 260}, {'btn', id='İntihar', onclick=killLocalPlayer, width = 120,x = 10,height = 20}, {'btn', id='Animasyonlar', window=wndAnim, width = 120,x = 150,height = 20}, {'btn', id='Temel Eşyalar', window=wndWeapon, width = 120,x = 10,height = 20}, {'btn', id='CJ Kıyafet', window=wndClothes, width = 120,x = 150,height = 20}, {'btn', text='Şans Oyunu', onclick=sanspaneli, width = 120,x = 10,height = 20}, {'btn', id='Işınlan', window=wndWarp, width = 120,x = 150,height = 20}, {'btn', id='setpos', text='Harita Paneli', window=wndSetPos, width = 260}, {'br'}, {'chk', id='falloff', text='Motordan Düşme', onclick=toggleFallOffBike, x = 10}, {'chk', id='jetpack', text="Jetpack", onclick=toggleJetPack, x = 150}, {'chk', id='disableknife', text='Bıçaklanma', onclick=toggleKnifing, x = 10}, {'chk', id='disablewarp', text='Işınlanma', onclick=toggleWarping, x = 150}, {'chk', id='antiram', text='Araç Hayalet Modu', onclick=toggleGhostmode, x = 10}, {"chk"; id = "Chat Gizle", onclick = chat, x = 150}, {'br'}, {'btn', id='createvehicle', window=wndCreateVehicle, text='Araç Oluştur', width = 260}, {'btn', id='Tamir', onclick=repairVehicle, width = 120,x = 10,height = 20}, {'btn', id='Çevir', onclick=flipVehicle, width = 120,x = 150,height = 20}, {'btn', id='Modifiye', window=wndUpgrades, width = 120,x = 10,height = 20}, {'btn', id='Boya', onclick=openColorPicker, width = 120,x = 150,height = 20}, {'btn', id='playergrav', text='Kamber Ayarı', window=wndGravity, width = 260}, {'br'}, {'chk', id='lightson', text='Farı [Aç]', onclick=forceLightsOn, x = 10}, {'chk', id='lightsoff', text='Farı [Kapat]', onclick=forceLightsOff, x = 150} }, oncreate = mainWndShow, onclose = mainWndClose}
function _buildWindow(wnd, baseWnd, parentWnd) local wndClass = wnd[1] if wndClass == 'br' then return end local relX, relY, relWidth, relHeight if parentWnd then if wnd.x and wnd.y then relX = wnd.x/parentWnd.width relY = wnd.y/parentWnd.height end relWidth = wnd.width / parentWnd.width relHeight = wnd.height / parentWnd.height end local elem if wndClass == 'wnd' then local screenWidth, screenHeight = guiGetScreenSize() if not wnd.x then wnd.x = screenWidth/2 - wnd.width/2 else local i, f = math.modf(wnd.x) if f ~= 0 then wnd.x = screenWidth * wnd.x end if wnd.x < 0 then wnd.x = screenWidth - math.abs(wnd.x) - wnd.width end end if not wnd.y then wnd.y = screenHeight/2 - wnd.height/2 else local i, f = math.modf(wnd.y) if f ~= 0 then wnd.y = screenHeight * wnd.y end if wnd.y < 0 then wnd.y = screenHeight - math.abs(wnd.y) - wnd.height end end elem = guiCreateWindow(wnd.x, wnd.y, wnd.width, wnd.height, wnd.text, false) guiWindowSetSizable(elem, false) guiBringToFront(elem) g_openedWindows[wnd] = true elseif wndClass == 'chk' then elem = guiCreateCheckBox(relX, relY, relWidth, relHeight, wnd.text or wnd.id or '', false, true, parentWnd.element) elseif wndClass == 'tbp' then elem = guiCreateTabPanel(relX, relY, relWidth, relHeight, true, parentWnd.element) elseif wndClass == 'tab' then elem = guiCreateTab(text, parentWnd.element) elseif wndClass == 'lst' then elem = guiCreateGridList(relX, relY, relWidth, relHeight, true, parentWnd.element) if wnd.columns then guiGridListSetSortingEnabled(elem, false) for i, column in ipairs(wnd.columns) do guiGridListAddColumn(elem, column.text or column.attr or '', column.width or 0.9) end end elseif wndClass == 'img' then elem = guiCreateStaticImage(relX, relY, relWidth, relHeight, wnd.src or '', true, parentWnd.element) elseif wndClass == 'btn' then elem = guiCreateButton(relX, relY, relWidth, relHeight, wnd.text or wnd.id or '',true, parentWnd.element,wnd.renk) else elem = _G['guiCreate' .. classInfo[wndClass].className](relX, relY, relWidth, relHeight, wnd.text or wnd.id or '', true, parentWnd.element) if wnd.align and wndClass == 'lbl' then guiLabelSetHorizontalAlign(elem, wnd.align, true) end end wnd.element = elem if wnd.controls then for id, controlwnd in pairs(wnd.controls) do _buildWindow(controlwnd, baseWnd or wnd, wnd) end end if wnd.tabs then for id, tab in pairs(wnd.tabs) do _buildWindow(tab, baseWnd, wnd) end end if wnd.rows then if wnd.rows.xml then -- get rows from xml bindGridListToTable(wnd, not gridListHasCache(wnd) and xmlToTable(wnd.rows.xml, wnd.rows.attrs) or false, wnd.expandlastlevel or wnd.expandlastlevel == nil) else -- rows hardcoded in window definition bindGridListToTable(wnd, not gridListHasCache(wnd) and wnd.rows or false, false) end end local clickhandler = nil if wnd.onclick then if wndClass == 'img' then clickhandler = function(btn, state, x, y) local imgX, imgY = getControlScreenPos(wnd) wnd.onclick((x - imgX)/wnd.width, (y - imgY)/wnd.height, btn) end else clickhandler = function() wnd.onclick() end end elseif wnd.window then clickhandler = function() toggleWindow(wnd.window) end elseif wnd.inputbox then clickhandler = function() wndInput = { 'wnd', width = 170, height = 60, controls = { {'txt', id='input', text='', width=60}, {'btn', id='ok', onclick=function() wnd.inputbox.callback(getControlText(wndInput, 'input')) closeWindow(wndInput) end}, {'btn', id='cancel', closeswindow=true} } } for propname, propval in pairs(wnd.inputbox) do wndInput[propname] = propval end createWindow(wndInput) guiBringToFront(getControl(wndInput, 'input')) end elseif wnd.closeswindow then clickhandler = function() closeWindow(baseWnd) end end if clickhandler then if wnd.ClickSpamProtected then g_protectedElements[elem] = clickhandler addEventHandler('onClientGUIClick', elem, onProtectedClick, false) else addEventHandler('onClientGUIClick', elem, clickhandler, false) end end if wnd.ondoubleclick then local doubleclickhandler if wndClass == 'img' then doubleclickhandler = function(btn, state, x, y) local imgX, imgY = getControlScreenPos(wnd) wnd.ondoubleclick((x - imgX)/wnd.width, (y - imgY)/wnd.height) end else doubleclickhandler = wnd.ondoubleclick end if wnd.DoubleClickSpamProtected then g_protectedElements[elem] = doubleclickhandler addEventHandler('onClientGUIDoubleClick', elem, onProtectedClick, false) else addEventHandler('onClientGUIDoubleClick', elem, doubleclickhandler, false) end end if wnd.oncreate then wnd.oncreate() endend
{'btn', id='createvehicle', window=wndCreateVehicle, text='Araç Oluştur', width = 260,renk="CC0000"},
guiLabelSetColor(getControl(wndMain,"createvehicle"),255,0,0)
;(( o zaman mainWndShow fonksionuna şu kodu girmen yeterli olucaktır;KodguiLabelSetColor(getControl(wndMain,"createvehicle"),255,0,0)