Jump to content

GUI Problem [SOLVED]


DRW

Recommended Posts

Posted (edited)

Clientside

markerzp = createMarker ( -509.60546875, 2629.099609375, 52.6140625, "cylinder", 1.0) 
  
  
local screenW, screenH = guiGetScreenSize() 
ventanazp = guiCreateWindow((screenW - 501) / 2, (screenH - 337) / 2, 501, 337, "Tienda de ZombiePoints [ZNEXT]", false) 
guiWindowSetSizable(ventanazp, false) 
guiWindowSetMovable (ventanazp, false) 
guiSetAlpha(ventanazp, 0.71) 
  
mejora1 = guiCreateButton(10, 89, 142, 35, "Chuck Norris\n(ZP:1595)", false, ventanazp) 
guiSetProperty(mejora1, "NormalTextColour", "FFAAAAAA") 
memo1 = guiCreateMemo(152, 89, 335, 35, "Todas las mejoras de \"stats\" serán desbloqueadas.", false, ventanazp) 
    guiMemoSetReadOnly(memo1, true)  
memo2 = guiCreateMemo(9, 22, 478, 57, "Aquí podrás comprar todo tipo de mejoras con ZombiePoints, ten en cuenta que subir la cantidad de éstos te costará un tiempo, pero al fin y al cabo merecen la pena.\nPuedes conseguirlos a base de subir niveles empezando por el 13, no funcionará\npedírselo a los Admins.", false, ventanazp) 
        guiMemoSetReadOnly(memo2, true)  
mejora2 = guiCreateButton(10, 124, 142, 35, "Regeneración\n(ZP:1095)", false, ventanazp) 
guiSetProperty(mejora2, "NormalTextColour", "FFAAAAAA") 
memo3 = guiCreateMemo(152, 124, 335, 35, "Tendrás regeneración de vida.", false, ventanazp) 
        guiMemoSetReadOnly(memo3, true)  
mejora3 = guiCreateButton(10, 159, 142, 35, "Recompensa doble\n(ZP:995)", false, ventanazp) 
guiSetProperty (mejora3, "NormalTextColour", "FFAAAAAA") 
memo4 = guiCreateMemo(152, 159, 335, 35, "Ganarás el doble de dinero por zombie asesinado.", false, ventanazp) 
        guiMemoSetReadOnly(memo4, true)  
mejora4 = guiCreateButton(10, 299, 477, 28, "Cerrar", false, ventanazp) 
guiSetProperty(mejora4, "NormalTextColour", "FFFF0000") 
mejora5 = guiCreateButton(10, 194, 142, 35, "Regeneración II\n(ZP:1295)", false, ventanazp) 
guiSetProperty(mejora5, "NormalTextColour", "FFAAAAAA") 
memo5 = guiCreateMemo(152, 194, 335, 35, "Tendrás regeneración de armadura.", false, ventanazp) 
        guiMemoSetReadOnly(memo5, true)  
mejora6 = guiCreateButton(10, 229, 142, 35, "Clase - Especialista\n(ZP:1595)", false, ventanazp) 
guiSetProperty(mejora6, "NormalTextColour", "FFAAAAAA") 
memo6 = guiCreateMemo(152, 229, 335, 35, "Desbloquea la clase \"Especialista\". 500 balas de M4,\nUZI y Francotirador son ganadas si apareces con ésta clase,\nademás puedes vender armas, e incluso\natacar bases.", false, ventanazp) 
mejora7 = guiCreateButton(10, 264, 142, 35, "Transporte a base\n(ZP:895)", false, ventanazp) 
        guiMemoSetReadOnly(memo6, true)  
guiSetProperty(mejora7, "NormalTextColour", "FFAAAAAA") 
  
memo7 = guiCreateMemo(152, 264, 335, 35, "Serás transportado a la base principal desde cualquier lugar si escribes el comando /base. Tardas 10 segundos en ir.", false, ventanazp) 
        guiMemoSetReadOnly(memo7, true)  
  
addEventHandler ("onClientResourceStart", getResourceRootElement(), function() 
guiSetVisible (ventanazp, false) 
end) 
  
addEvent ("verzps", true) 
addEventHandler ("verzps", localPlayer,function() 
guiSetVisible (ventanazp, true) 
showCursor (true) 
end) 
  
addEventHandler ("onClientGUIClick", mejora1, function() 
coins = exports.coinsystem:getPlayerCoin (localPlayer) 
if (coins<1595) then 
outputChatBox ("¡NO TIENES SUFICIENTES ZPS!", 255,0,0) 
return 
elseif (coins>=1595) then 
triggerServerEvent ("mejora1q",localPlayer) 
outputChatBox ("¡Gracias por tu compra!", 100,255,100) 
end 
end) 
  
addEventHandler ("onClientGUIClick", mejora2, function() 
coins = exports.coinsystem:getPlayerCoin (localPlayer) 
if (coins<1095) then 
outputChatBox ("¡NO TIENES SUFICIENTES ZPS!", 255,0,0) 
return 
elseif (coins>=1095) then 
triggerServerEvent ("mejora2q",localPlayer) 
outputChatBox ("¡Gracias por tu compra!", 100,255,100) 
end 
end) 
  
addEventHandler ("onClientGUIClick", mejora3, function() 
coins = exports.coinsystem:getPlayerCoin (localPlayer) 
if (coins<995) then 
outputChatBox ("¡NO TIENES SUFICIENTES ZPS!", 255,0,0) 
return 
elseif (coins>=995) then 
triggerServerEvent ("mejora3q",localPlayer) 
outputChatBox ("¡Gracias por tu compra!", 100,255,100) 
end 
end) 
  
addEventHandler ("onClientGUIClick", mejora4, function() 
guiSetVisible (ventanazp, false) 
showCursor (false) 
end) 
  
addEventHandler ("onClientGUIClick", mejora5, function() 
coins = exports.coinsystem:getPlayerCoin (localPlayer) 
if (coins<1295) then 
outputChatBox ("¡NO TIENES SUFICIENTES ZPS!", 255,0,0) 
return 
elseif (coins>=1295) then 
triggerServerEvent ("mejora5q",localPlayer) 
outputChatBox ("¡Gracias por tu compra!", 100,255,100) 
end 
end) 

The problem is when I click the window only the script executes all the events bound to the GUI buttons. Why?

Edited by Guest

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted

change

addEventHandler ( "onClientGUIClick", button, function () ... end, false ) 

addEventHandler ( "onClientGUIClick", button, function () ... end, false )

Posted
change
addEventHandler ( "onClientGUIClick", button, function () ... end, false ) 

addEventHandler ( "onClientGUIClick", button, function () ... end, false )

Thanks!

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

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...