Estevam2d Posted October 25, 2013 Share Posted October 25, 2013 Good morning, good afternoon or good evening. You guys could help me? The problem is that when I click on the window I buy the gun already in it and not on the Button, I want to put in so Button. Sorry for the bad english. Client.lua GUIEditor_Image = {} function setga( ) guiMoveToBack( source ) end tiendaDeArmas2 = guiCreateWindow(30,30,400,200,"Brasil-jobs Loja de armas",false) guiSetAlpha(tiendaDeArmas2, 500.0) -- Pistola botonComprarPistola = guiCreateButton(175,45,65,52,"Comprar\n\($12,000)",false,tiendaDeArmas2) botonComprarMunicPistola = guiCreateButton(255,45,65,52,"Muniçao\n\ x30($60)",false,tiendaDeArmas2) imagePistola = guiCreateStaticImage(35,38,63,61,"images/22.png",false,tiendaDeArmas2) Pistola = guiCreateLabel(110,65,65,52, "Colt.45", false, tiendaDeArmas2 ) Salir = guiCreateButton(30,120,140,29,"Sair",false,tiendaDeArmas2) guiWindowSetMovable(tiendaDeArmas2,true) guiWindowSetSizable(tiendaDeArmas2,true) guiSetVisible(tiendaDeArmas2,false) function mostrarTienda() guiSetVisible (tiendaDeArmas2,true) showCursor(true) end addEvent("mostrarTienda",true) addEventHandler("mostrarTienda",getRootElement(),mostrarTienda) function closeShop2() if guiGetVisible(tiendaDeArmas2) then guiSetVisible(tiendaDeArmas2,false) guiWindowSetSizable( tiendaDeArmas2, false ) showCursor(false) end end addEventHandler ("onClientGUIClick", Salir, closeShop2) -- Pistola function darPistola() local itemID = 22 local itemCost = 12000 local itemMunic = 100 triggerServerEvent ("comproPistola", getLocalPlayer(), itemID, itemCost,itemMunic) end addEventHandler ("onClientGUIClick", botonComprarPistola, darPistola) function darMunicPistola() local armaID = 22 local itemCost = 60 local itemMunic = 30 triggerServerEvent ("comproMunicionPistola", getLocalPlayer(), armaID, itemCost,itemMunic) end addEventHandler ("onClientGUIClick", botonComprarMunicPistola, darMunicPistola) Aqui esta o Server.lua local vendedor = createPed(107,2502.6999511719,-1711.5,13.6) setPedRotation(vendedor,269) marcadorTienda = createMarker(2505.6000976563,-1711.5,13,"cylinder",1.5,0,125,250,153) function mostrarTienda(hitsource) triggerClientEvent(hitsource,"mostrarTienda",getRootElement(),hitsource) end addEventHandler("onMarkerHit",marcadorTienda,mostrarTienda) -- Pistola addEvent ("comproPistola", true) addEventHandler ("comproPistola", getRootElement(), function (id, cost,munic) if (getPlayerMoney (source) >= tonumber(cost)) then outputChatBox ("Has comprado una Deagle", source, 0, 255, 0, false) takePlayerMoney (source, tonumber (cost)) giveWeapon(source, tonumber (id),tonumber (munic)) else outputChatBox ("Necesitas dinero", source, 255, 0, 0, false) end end) addEvent ("comproMunicionPistola", true) addEventHandler ("comproMunicionPistola", getRootElement(), function (id, cost,munic) local tienePistola = getPedWeapon(source,2) if (getPlayerMoney (source) >= tonumber(cost)) and (tienePistola == 22) then outputChatBox ("Has comprado municion de Pistola", source, 0, 255, 0, false) takePlayerMoney (source, tonumber (cost)) giveWeaponAmmo(source,tonumber(id),tonumber(munic)) elseif (getPlayerMoney (source) >= tonumber(cost)) and (tienePistola ~= 22) then outputChatBox ("Necesitas tener una Pistola para comprar municion de Pistola", source, 255, 0, 0, false) elseif (getPlayerMoney (source) < tonumber(cost)) and (tienePistola == 22) then outputChatBox ("Necesitas dinero", source, 255, 0, 0, false) else outputChatBox ("Necesitas tener una Pistola para comprar municion de Pistola", source, 255, 0, 0, false) end end) -- Deagle addEvent ("comproDeagle", true) addEventHandler ("comproDeagle", getRootElement(), function (id, cost,munic) if (getPlayerMoney (source) >= tonumber(cost)) then outputChatBox ("Has comprado una Deagle", source, 0, 255, 0, false) takePlayerMoney (source, tonumber (cost)) giveWeapon(source, tonumber (id),tonumber (munic)) else outputChatBox ("Necesitas dinero", source, 255, 0, 0, false) end end) addEvent ("comproMunicionDeagle", true) addEventHandler ("comproMunicionDeagle", getRootElement(), function (id, cost,munic) local tieneDeagle = getPedWeapon(source,2) if (getPlayerMoney (source) >= tonumber(cost)) and (tieneDeagle == 24) then outputChatBox ("Has comprado municion de Deagle", source, 0, 255, 0, false) takePlayerMoney (source, tonumber (cost)) giveWeaponAmmo(source,tonumber(id),tonumber(munic)) elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneDeagle ~= 24) then outputChatBox ("Necesitas tener una Deagle para comprar municion de Deagle", source, 255, 0, 0, false) elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneDeagle == 24) then outputChatBox ("Necesitas dinero", source, 255, 0, 0, false) else outputChatBox ("Necesitas tener una Deagle para comprar municion de Deagle", source, 255, 0, 0, false) end end) addEventHandler("onResourceStart",getRootElement(), function () end ) Link to comment
Castillo Posted October 25, 2013 Share Posted October 25, 2013 The problem is that you forgot to set the 'getPropagated' argument from addEventHandlet to 'false'. addEventHandler ( "onClientGUIClick", botonComprarPistola, darPistola ) change it to: addEventHandler ( "onClientGUIClick", botonComprarPistola, darPistola, false ) Do the same with your other 'onClientGUIClick' events. Link to comment
Estevam2d Posted October 25, 2013 Author Share Posted October 25, 2013 worked perfectly Thank you for everything 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