Jump to content

Problem with my GUI


CTCCoco

Recommended Posts

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Thanks but your system doesn't works xD I will try remake your system and my system to do the final script that works omg xD

Yesss I do it now works perfect!.

Final Script all client-side:

---------------------------------SCRIPT DE LOS BOTONES ( GUI ) CLIENT-SIDE
casasnumclient = 1
---------------------------------DETECTA SI EL JUGADOR ESTÁ EN EL COLSHAPE
function onColShapeHitCrCpCs( theElement, matchingDimension )
if ( theElement == getLocalPlayer() ) then
for houses=0 , casasnumclient do
if(source == posicionCasas[houses]) then
     windowTituloCasa = guiCreateWindow(460,289,357,171,"Sistema de casas por CTCCoco",false)
local casasxml = xmlLoadFile("casas.xml")
local hOwner = xmlNodeGetAttribute (casasxml, "hOwner." .. houses )
     labelDuenoCasa = guiCreateLabel(10,29,335,18,"Dueno: " .. hOwner ,false,windowTituloCasa)
guiLabelSetColor(labelDuenoCasa,255,255,255)
guiLabelSetVerticalAlign(labelDuenoCasa,"top")
guiLabelSetHorizontalAlign(labelDuenoCasa,"left",false)
local hDesc = xmlNodeGetAttribute (casasxml, "hDesc." .. houses )
     labelDescripcionCasa = guiCreateLabel(8,47,340,45,"Descripcion: ".. hDesc,false,windowTituloCasa)
guiLabelSetColor(labelDescripcionCasa,255,255,255)
guiLabelSetVerticalAlign(labelDescripcionCasa,"top")
guiLabelSetHorizontalAlign(labelDescripcionCasa,"left",false)
local hValue = xmlNodeGetAttribute (casasxml, "hValue." .. houses )
     labelPreAlqCasa = guiCreateLabel(8,94,334,34,"Precio: " .. hValue .. "$              Alquiler:",false,windowTituloCasa)
guiLabelSetColor(labelPreAlqCasa,255,255,255)
guiLabelSetVerticalAlign(labelPreAlqCasa,"top")
guiLabelSetHorizontalAlign(labelPreAlqCasa,"left",false)
     botonComprarCasa[houses] = guiCreateButton(10,136,89,25,"Comprar",false,windowTituloCasa)
     botonCancelarCasa[houses] = guiCreateButton(259,136,89,25,"Cancelar",false,windowTituloCasa)
guiSetVisible(windowTituloCasa, true)
end
end
end
end
addEventHandler("onClientColShapeHit",getRootElement(),onColShapeHitCrCpCs)
-------------------------------------DETECTA SI EL JUGADOR SE A IDO DEL COLSHAPE
function onColShapeLeaveCrCpCs( theElement, matchingDimension )
if ( theElement == getLocalPlayer() ) then  -- Checks whether the leaving element is the local player
--if( source == posicionjugS1 ) then
for houses=0 , casasnumclient do
if(source == posicionCasas[houses]) then
guiSetVisible(windowTituloCasa, false)
end
end
--end
end
end
addEventHandler("onClientColShapeLeave",getRootElement(),onColShapeLeaveCrCpCs)
---------------------------------SE CREA LA VENTANA
--------------------CUANDO EL JUGADOR SE CONECTA REPITE ESTO CADA SEG.
function PlayerSpawn ( )
local casasxml = xmlLoadFile("casas.xml")
for houses=0 , casasnumclient do
local hEntrancex = { }
local hEntrancey = { }
local hEntrancez = { }
posicionCasas = { }
hEntrancex[houses] = xmlNodeGetAttribute ( casasxml, "hEntradax." .. houses )
hEntrancey[houses] = xmlNodeGetAttribute ( casasxml, "hEntraday." .. houses )
hEntrancez[houses] = xmlNodeGetAttribute ( casasxml, "hEntradaz." .. houses )
posicionCasas[houses] = createColSphere( hEntrancex[houses], hEntrancey[houses], hEntrancez[houses], 3.0)
--windowTituloCasa = { }
--labelDuenoCasa = { }
--labelDescripcionCasa = { }
--labelPreAlqCasa = { }
botonComprarCasa = { }
botonCancelarCasa = { }
end
end
-- add this function as a handler for any player that spawns
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), PlayerSpawn )

Thanks for FAMAS and 50p for all help !

Link to comment

Sorry but my internet didn't work ^^

Ok so it's work now but why you have make two butons if you doesn't show the cursor to click this butons ?

Keep the two addEventHandler in the gui and the two functions which I maked and put the actions to buy the house

And keep my function to hide the window and so you don't need the event onColShapeLeave because if he click in cancelar, he want to leave that. Do you understand what I mean ?

But congratulation for the issue :mrgreen:

The Fama's brother

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