Jump to content

GUI Problems


Lalalu

Recommended Posts

Hello, i'm doing this post today because i need help with a script ( this script isn't obviusly created by me, i'm just modifying it, the original owner is "TorN" )

i don't know too much about guis, guieditor, i did it in the gui editor and there looks perfect, but i don't know how to add it to the .lua correctly, also i do not know how to fit with all the resolutions :/, i've been trying everything for hours, i hope u can reply this and help me with this

CLIENT

label = {}
foodwindow = guiCreateWindow(388, 199, 465, 639,"COMBINI FRIENDLY",true)
guiSetAlpha(foodwindow,225)
guiSetProperty(foodwindow, "ImageColours", "tl:FFFFFE0C tr:FF0000FF bl:FF0000FF br:FFFFFE0C")                                           guiCreateStaticImage ( 9, 26, 446, 200,"image.png",true,foodwindow)
ramenimg = guiCreateStaticImage(38, 288, 157, 61, "ramen.png", true, foodwindow)
pockyimg = guiCreateStaticImage(262, 289, 157, 60, "pocky.png", true, foodwindow)
laysimg = guiCreateStaticImage(262, 372, 156, 60, "lays.png", true, foodwindow)
omuraisuimg = guiCreateStaticImage(38, 543, 157, 60, "omuraisu.png", true, foodwindow)
picanteimg = guiCreateStaticImage(262, 458, 157, 60, "picante.png", true, foodwindow)
tartaletaimg = guiCreateStaticImage(262, 543, 157, 61, "tartaleta.png", true, foodwindow)
yakisobaimg = guiCreateStaticImage(38, 372, 157, 60, "yakisoba.png", true, foodwindow)
onigiriimg = guiCreateStaticImage(38, 458, 157, 60, "onigiri.png", true, foodwindow)
closebtn = guiCreateButton(119, 235, 219, 43, "CERRAR", true, foodwindow)			
guiSetVisible(foodwindow, false)    
guiSetProperty(closebtn, "NormalTextColour", "FFAAAAAA")

        GUIEditor.label[2] = guiCreateLabel(437, 550, 153, 20, "RAMEN INSTANTANEO", false)
        guiLabelSetColor(GUIEditor.label[2], 255, 252, 0)


        GUIEditor.label[3] = guiCreateLabel(468, 633, 153, 20, "YAKISOBA", false)
        guiLabelSetColor(GUIEditor.label[3], 255, 252, 0)


        GUIEditor.label[4] = guiCreateLabel(478, 719, 153, 20, "ONIGIRI", false)
        guiLabelSetColor(GUIEditor.label[4], 255, 252, 0)


        GUIEditor.label[5] = guiCreateLabel(473, 804, 153, 20, "OMURAISU", false)
        guiLabelSetColor(GUIEditor.label[5], 255, 252, 0)


        GUIEditor.label[6] = guiCreateLabel(700, 804, 153, 20, "TARTALETA", false)
        guiLabelSetColor(GUIEditor.label[6], 255, 252, 0)


        GUIEditor.label[7] = guiCreateLabel(694, 633, 153, 20, "PAPAS LAYS", false)
        guiLabelSetColor(GUIEditor.label[7], 255, 252, 0)


        GUIEditor.label[8] = guiCreateLabel(700, 550, 153, 20, "POCKYS", false)
        guiLabelSetColor(GUIEditor.label[8], 255, 252, 0)


        GUIEditor.label[9] = guiCreateLabel(684, 719, 153, 20, "PAPAS PICANTES", false)
        guiLabelSetColor(GUIEditor.label[9], 255, 252, 0)    
    end
)

function lol (hitElement)
local screenW,screenH=guiGetScreenSize()
local windowW,windowH=guiGetSize(foodwindow,false)
local x,y = (screenW-windowW)/2,(screenH-windowH)/2
guiSetPosition(foodwindow,x,y,false)
if hitElement == getLocalPlayer() then
guiSetVisible(foodwindow, true)
showCursor(true)
centerWindow(foodwindow)
end
end

function createramen()
ramen = createMarker(443.5146484375, -6.431640625, 1059.5,"cylinder", 1, 60, 60, 60,250) 
setElementDimension(ramen, 5) 
setElementInterior(ramen, 1)
addEventHandler('onClientMarkerHit', ramen, lol)
end
addEventHandler('onClientResourceStart', getResourceRootElement(),createramen)

function createburgers()
omuraisu = createMarker(443.5146484375, -6.431640625, 1059.5,"cylinder", 1, 60, 60, 60,250) 
setElementDimension(omuraisu, 66) 
setElementInterior(omuraisu, 1)
addEventHandler('onClientMarkerHit', omuraisu, lol)
end
addEventHandler('onClientResourceStart', getResourceRootElement(),createburgers)                                                                         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
function createpocky()
pocky = createMarker(443.5146484375, -6.431640625, 1059.5,"cylinder", 1, 60, 60, 60,250) 
setElementDimension(pocky, 8) 
setElementInterior(pocky, 1)
addEventHandler('onClientMarkerHit', pocky, lol)
end
addEventHandler('onClientResourceStart', getResourceRootElement(),createpocky)


function close ()
guiSetVisible(foodwindow, false)
showCursor(false)
end
addEventHandler("onClientGUIClick", closebtn, close)

function lays()
if getPlayerMoney(player) >= 150 then
inc = 150
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("lays", getLocalPlayer())
outputChatBox("Has comprado Papas Lays por: 150¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", laysimg, lays)

function ramen()
if getPlayerMoney(player) >= 400 then
inc = 400
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("ramen", getLocalPlayer())
outputChatBox("Has comprado Ramen instantáneo por: 400¥", 0, 255, 250, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", ramenimg, ramen)

function pocky()
if getPlayerMoney(player) >= 200 then
inc = 200
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("pocky", getLocalPlayer())
outputChatBox("Has comprado Pockys por: 200¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", pockyimg, pocky)

function omuraisu()
if getPlayerMoney(player) >= 300 then
inc = 300
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("omuraisu", getLocalPlayer())
outputChatBox("Has comprado Omuraisu por: 300¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", omuraisuimg, omuraisu)

function picante()
if getPlayerMoney(player) >= 200 then
inc = 200
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("picante", getLocalPlayer())
outputChatBox("Has comprado Papas Picantes por: 200¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", picanteimg, picante)

function tartaleta()
if getPlayerMoney(player) >= 1000 then
inc = 1000
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("tartaleta", getLocalPlayer())
outputChatBox("Has comprado una Tartaleta por: 1000¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", tartaletaimg, tartaleta)

function yakisoba()
if getPlayerMoney(player) >= 300 then
inc = 300
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("yakisoba", getLocalPlayer())
outputChatBox("Has comprado Yakisoba por: 300¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", yakisobaimg, yakisoba)

function onigiri()
if getPlayerMoney(player) >= 250 then
inc = 250
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("onigiri", getLocalPlayer())
outputChatBox("Has comprado Onigiri por: 250¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", onigiriimg, onigiri)

 

 

Edited by Lalalu
mistake
Link to comment
label = {}
foodwindow = guiCreateWindow(388, 199, 465, 639,"COMBINI FRIENDLY",true)
guiSetAlpha(foodwindow,225)
guiSetProperty(foodwindow, "ImageColours", "tl:FFFFFE0C tr:FF0000FF bl:FF0000FF br:FFFFFE0C")                                           guiCreateStaticImage ( 9, 26, 446, 200,"image.png",true,foodwindow)
ramenimg = guiCreateStaticImage(38, 288, 157, 61, "ramen.png", true, foodwindow)
pockyimg = guiCreateStaticImage(262, 289, 157, 60, "pocky.png", true, foodwindow)
laysimg = guiCreateStaticImage(262, 372, 156, 60, "lays.png", true, foodwindow)
omuraisuimg = guiCreateStaticImage(38, 543, 157, 60, "omuraisu.png", true, foodwindow)
picanteimg = guiCreateStaticImage(262, 458, 157, 60, "picante.png", true, foodwindow)
tartaletaimg = guiCreateStaticImage(262, 543, 157, 61, "tartaleta.png", true, foodwindow)
yakisobaimg = guiCreateStaticImage(38, 372, 157, 60, "yakisoba.png", true, foodwindow)
onigiriimg = guiCreateStaticImage(38, 458, 157, 60, "onigiri.png", true, foodwindow)
closebtn = guiCreateButton(119, 235, 219, 43, "CERRAR", true, foodwindow)			
guiSetVisible(foodwindow, false)    
guiSetProperty(closebtn, "NormalTextColour", "FFAAAAAA")

        GUIEditor.label[2] = guiCreateLabel(437, 550, 153, 20, "RAMEN INSTANTANEO", false)
        guiLabelSetColor(GUIEditor.label[2], 255, 252, 0)


        GUIEditor.label[3] = guiCreateLabel(468, 633, 153, 20, "YAKISOBA", false)
        guiLabelSetColor(GUIEditor.label[3], 255, 252, 0)


        GUIEditor.label[4] = guiCreateLabel(478, 719, 153, 20, "ONIGIRI", false)
        guiLabelSetColor(GUIEditor.label[4], 255, 252, 0)


        GUIEditor.label[5] = guiCreateLabel(473, 804, 153, 20, "OMURAISU", false)
        guiLabelSetColor(GUIEditor.label[5], 255, 252, 0)


        GUIEditor.label[6] = guiCreateLabel(700, 804, 153, 20, "TARTALETA", false)
        guiLabelSetColor(GUIEditor.label[6], 255, 252, 0)


        GUIEditor.label[7] = guiCreateLabel(694, 633, 153, 20, "PAPAS LAYS", false)
        guiLabelSetColor(GUIEditor.label[7], 255, 252, 0)


        GUIEditor.label[8] = guiCreateLabel(700, 550, 153, 20, "POCKYS", false)
        guiLabelSetColor(GUIEditor.label[8], 255, 252, 0)


        GUIEditor.label[9] = guiCreateLabel(684, 719, 153, 20, "PAPAS PICANTES", false)
        guiLabelSetColor(GUIEditor.label[9], 255, 252, 0)    
    end
)

function lol (hitElement)
local screenW,screenH=guiGetScreenSize()
local windowW,windowH=guiGetSize(foodwindow,false)
local x,y = (screenW/2-windowW/2),(screenH/2-windowH/2)
guiSetPosition(foodwindow,x,y,false)
if hitElement == getLocalPlayer() then
guiSetVisible(foodwindow, true)
showCursor(true)
centerWindow(foodwindow)
end
end

function createramen()
ramen = createMarker(443.5146484375, -6.431640625, 1059.5,"cylinder", 1, 60, 60, 60,250) 
setElementDimension(ramen, 5) 
setElementInterior(ramen, 1)
addEventHandler('onClientMarkerHit', ramen, lol)
end
addEventHandler('onClientResourceStart', getResourceRootElement(),createramen)

function createburgers()
omuraisu = createMarker(443.5146484375, -6.431640625, 1059.5,"cylinder", 1, 60, 60, 60,250) 
setElementDimension(omuraisu, 66) 
setElementInterior(omuraisu, 1)
addEventHandler('onClientMarkerHit', omuraisu, lol)
end
addEventHandler('onClientResourceStart', getResourceRootElement(),createburgers)                                                                         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
function createpocky()
pocky = createMarker(443.5146484375, -6.431640625, 1059.5,"cylinder", 1, 60, 60, 60,250) 
setElementDimension(pocky, 8) 
setElementInterior(pocky, 1)
addEventHandler('onClientMarkerHit', pocky, lol)
end
addEventHandler('onClientResourceStart', getResourceRootElement(),createpocky)


function close ()
guiSetVisible(foodwindow, false)
showCursor(false)
end
addEventHandler("onClientGUIClick", closebtn, close)

function lays()
if getPlayerMoney(player) >= 150 then
inc = 150
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("lays", getLocalPlayer())
outputChatBox("Has comprado Papas Lays por: 150¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", laysimg, lays)

function ramen()
if getPlayerMoney(player) >= 400 then
inc = 400
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("ramen", getLocalPlayer())
outputChatBox("Has comprado Ramen instantáneo por: 400¥", 0, 255, 250, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", ramenimg, ramen)

function pocky()
if getPlayerMoney(player) >= 200 then
inc = 200
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("pocky", getLocalPlayer())
outputChatBox("Has comprado Pockys por: 200¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", pockyimg, pocky)

function omuraisu()
if getPlayerMoney(player) >= 300 then
inc = 300
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("omuraisu", getLocalPlayer())
outputChatBox("Has comprado Omuraisu por: 300¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", omuraisuimg, omuraisu)

function picante()
if getPlayerMoney(player) >= 200 then
inc = 200
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("picante", getLocalPlayer())
outputChatBox("Has comprado Papas Picantes por: 200¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", picanteimg, picante)

function tartaleta()
if getPlayerMoney(player) >= 1000 then
inc = 1000
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("tartaleta", getLocalPlayer())
outputChatBox("Has comprado una Tartaleta por: 1000¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", tartaletaimg, tartaleta)

function yakisoba()
if getPlayerMoney(player) >= 300 then
inc = 300
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("yakisoba", getLocalPlayer())
outputChatBox("Has comprado Yakisoba por: 300¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", yakisobaimg, yakisoba)

function onigiri()
if getPlayerMoney(player) >= 250 then
inc = 250
player = getLocalPlayer ()
setElementHealth(player, getElementHealth(player) + inc)
triggerServerEvent("onigiri", getLocalPlayer())
outputChatBox("Has comprado Onigiri por: 250¥", 0, 255, 0, player)
else
outputChatBox("Necesitas más dinero para comprar ",255,0,250)
end
end
addEventHandler("onClientGUIClick", onigiriimg, onigiri)

try it like this

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...