Jump to content

CTCCoco

Members
  • Posts

    93
  • Joined

  • Last visited

Everything posted by CTCCoco

  1. 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 !
  2. Thanks but your system doesn't works I will try remake your system and my system to do the final script that works omg
  3. Yes I have 2 houses. The first house have ID 0 and the second house have ID 1. The loop do houses == 0 and == 1. That's why when I call a house variable I call doing this : "hVar." .. houses. ( hVar.0 and hVar.1 , the .(number) are the house ID ). You understand me? It will works but it didn't ( only works the last house ( ID 1 house ) ) And yes the ID 0 are called too and it will works but it didn't Thanks men.
  4. Thanks but now the problem its that ONLY create the LAST HOUSE window, then only the last house of the loop work... What can i do? Thanks.
  5. Yes !! I do it ! finally! this is the code ( 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 guiSetVisible(windowTituloCasa[houses], 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[houses], false) end end --end end end addEventHandler("onClientColShapeLeave",getRootElement(),onColShapeLeaveCrCpCs) ---------------------------------SE CREA LA VENTANA function windowCrCpCs() 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) local casasxml = xmlLoadFile("casas.xml") windowTituloCasa = { } labelDuenoCasa = { } labelDescripcionCasa = { } labelPreAlqCasa = { } botonComprarCasa = { } botonCancelarCasa = { } windowTituloCasa[houses] = guiCreateWindow(460,289,357,171,"Sistema de casas por CTCCoco",false) local hOwner = xmlNodeGetAttribute (casasxml, "hOwner." .. houses ) local hOwner = tostring(hOwner) labelDuenoCasa[houses] = guiCreateLabel(10,29,335,18,"Dueno: " .. hOwner ,false,windowTituloCasa[houses]) guiLabelSetColor(labelDuenoCasa[houses],255,255,255) guiLabelSetVerticalAlign(labelDuenoCasa[houses],"top") guiLabelSetHorizontalAlign(labelDuenoCasa[houses],"left",false) local hDesc = xmlNodeGetAttribute (casasxml, "hDesc." .. houses ) labelDescripcionCasa[houses] = guiCreateLabel(8,47,340,45,"Descripcion: ".. hDesc,false,windowTituloCasa[houses]) guiLabelSetColor(labelDescripcionCasa[houses],255,255,255) guiLabelSetVerticalAlign(labelDescripcionCasa[houses],"top") guiLabelSetHorizontalAlign(labelDescripcionCasa[houses],"left",false) local hValue = xmlNodeGetAttribute (casasxml, "hValue." .. houses ) labelPreAlqCasa[houses] = guiCreateLabel(8,94,334,34,"Precio: " .. hValue .. "$ Alquiler:",false,windowTituloCasa[houses]) guiLabelSetColor(labelPreAlqCasa,255,255,255) guiLabelSetVerticalAlign(labelPreAlqCasa[houses],"top") guiLabelSetHorizontalAlign(labelPreAlqCasa[houses],"left",false) botonComprarCasa[houses] = guiCreateButton(10,136,89,25,"Comprar",false,windowTituloCasa[houses]) botonCancelarCasa[houses] = guiCreateButton(259,136,89,25,"Cancelar",false,windowTituloCasa[houses]) guiSetVisible(windowTituloCasa[houses], false) end end --------------------CUANDO EL JUGADOR SE CONECTA REPITE ESTO CADA SEG. function PlayerSpawn ( ) setTimer(windowCrCpCs, 3000, 1) end -- add this function as a handler for any player that spawns addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), PlayerSpawn ) I think all is correct isn't it? Thanks.
  6. How do you want to use it then? This is used to check if element is within collision shape. What do you need it for? You will never make GUI pop up without using events. EDIT: That's fine, but you should learn from making simple things and get to harder and harder ones.. Most of beginners go straight to hard things and it makes them tear their hair out. I only need if a player is near of a X, Y , Z coordinate and if it is near the GUI appears. This is too easy to do in SAMP with a simple fuction
  7. I am learning LUA on MTA that's why i am doing a gamemode and see how to do things and this is why i don't know how to do this shit. Then you can't use isElementWithinColshape instead onColShapeHit? I think is more usefull use isElementWithinColshape if it can work.
  8. What do you mean? I try with client, source, id , getLocalPlayer(), getRootPlayer() and nothing works What I must change? Sorry for all. PD: I'm trying to do when a player go to a house entrance show a GUI to buy the house and all information and all things.
  9. I don't use this script in server-side, I know GUI fuctions are only for client-side. And what you say? I CAN use casas.xml in server-side and client-side and works fine. The only problem that doesn't work now its that the local posicionjugS1 = createColSphere( hEntrancex, hEntrancey, hEntrancez, 3.0) local posicionjug1 = isElementWithinColShape (source,posicionjugS1) if(posicionjug1) then doesn't works and works in server-side ( the same local posicionjugS1 = createColSphere( hEntrancex, hEntrancey, hEntrancez, 3.0) local posicionjug1 = isElementWithinColShape (source,posicionjugS1) if(posicionjug1) then code ) Here its ALL the code: Client-Side: ---------------------------------SCRIPT DE LOS BOTONES ( GUI ) CLIENT-SIDE ---------------------------------SE CREA LA VENTANA casasnumclient = 1 function crearunamierdadegui() setTimer(windowCrCpCs, 3000, 0, source) --outputchatbox(" has been owned.", client) end addEvent( "crearunamierdadegui1", true ) addEventHandler( "crearunamierdadegui1", getRootElement(), crearunamierdadegui ) function windowCrCpCs(source) local casasxml = xmlLoadFile("casas.xml") for houses=0 , casasnumclient do local hEntrancex = xmlNodeGetAttribute ( casasxml, "hEntradax." .. houses ) local hEntrancey = xmlNodeGetAttribute ( casasxml, "hEntraday." .. houses ) local hEntrancez = xmlNodeGetAttribute ( casasxml, "hEntradaz." .. houses ) local posicionjugS1 = createColSphere( hEntrancex, hEntrancey, hEntrancez, 3.0) local posicionjug1 = isElementWithinColShape (source,posicionjugS1) --if(posicionjug1) then windowTituloCasa = guiCreateWindow(460,289,357,171,"Sistema de casas por CTCCoco",false) local hOwner = xmlNodeGetAttribute (casasxml, "hOwner." .. houses ) local hOwner = tostring(hOwner) 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 = guiCreateButton(10,136,89,25,"Comprar",false,windowTituloCasa) botonCancelarCasa = guiCreateButton(259,136,89,25,"Cancelar",false,windowTituloCasa) guiSetVisible(windowTituloCasa, true) showCursor ( true, true ) outputChatBox("Si",source) return 1 else guiSetVisible(windowTituloCasa, false) outputChatBox("No",source) return 1 end end end server-side: triggerClientEvent ( "crearunamierdadegui1", getRootElement()) in onPlayerJoin. Thanks for FAMAS and 50p. Please help .
  10. I know that I must define it in client-side... that's why its called casasnumclient. I define it in client side, this is not the problem, I don't have any warnings and nothing now And the --if(posicionjug1) it is without " -- " its a fault when I copy it to the post but doesn't works. I think " source " detect anything but not the player and this is why doesn't works , source its valid to detect the player client-side? I mean: local posicionjug1 = isElementWithinColShape (source,posicionjugS1) Maybe don't detect the player... because I use " source " before and doesn't works and I will define it in the SetTimer and in the fuction of the Timer and maybe don't detect a player, detect something that is nothing Thanks
  11. THANKS i solve all Warnings and ERRORS! But I have a little problem yet. function windowCrCpCs(source) local casasxml = xmlLoadFile("casas.xml") for houses=0 , casasnumclient do local hEntrancex = xmlNodeGetAttribute ( casasxml, "hEntradax." .. houses ) local hEntrancey = xmlNodeGetAttribute ( casasxml, "hEntraday." .. houses ) local hEntrancez = xmlNodeGetAttribute ( casasxml, "hEntradaz." .. houses ) local posicionjugS1 = createColSphere( hEntrancex, hEntrancey, hEntrancez, 3.0) local posicionjug1 = isElementWithinColShape (source,posicionjugS1) if(posicionjug1) then windowTituloCasa = guiCreateWindow(460,289,357,171,"Sistema de casas por CTCCoco",false) local hOwner = xmlNodeGetAttribute (casasxml, "hOwner." .. houses ) local hOwner = tostring(hOwner) 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 = guiCreateButton(10,136,89,25,"Comprar",false,windowTituloCasa) botonCancelarCasa = guiCreateButton(259,136,89,25,"Cancelar",false,windowTituloCasa) guiSetVisible(windowTituloCasa, true) outputChatBox("Si",source) return 1 else guiSetVisible(windowTituloCasa, false) outputChatBox("No",source) return 1 end end end Its always detect that the player isn't in the house. I have the SAME code in the server-side command and works perfect but don't works here. What's the problem? Thanks.
  12. WTF?! Why you don't reply before? omg . thanks ( Specially you FAMAS ) Erh sorry This doesn't work yet: local posicionjugS1 = createColSphere( hEntrancex, hEntrancey, hEntrancez, 3.0) local posicionjug1 = isElementWithinColShape ( source, posicionjugS1 ) [2010-03-06 00:42:37] - WARNING: guibotones.lua: Bad argument @ 'isElementWithinColShape' [2010-03-06 00:42:37] - WARNING: guibotones.lua: Bad argument @ 'createColSphere' [2010-03-06 00:42:37] - WARNING: guibotones.lua: Bad argument @ 'isElementWithinColShape' and at labelDuenoCasa = guiCreateLabel(10,29,335,18,"Dueno:" .. hOwner,false,windowTituloCasa) say a ERROR : attempt to concatenate local 'hOwner' (a boolean value). What's the problem? Thanks for all really
  13. WTF?! Why you don't reply before? omg . thanks ( Specially you FAMAS )
  14. NOT Loaded. I do it before. What a shit Thanks men but looks impossible EDIT: I try to create a new XML in client-side but doesn't work too. It says that the XML was created correct ( I use the if( ) and says that is correct) and don't create anything... I use the same to what I use to create the other server-side XML and works fine. Well the xmlLoadXML doesn't work yet. Thanks
  15. Yes I put the xmlLoadFile before all I know it. The GUI works , only thing that doesn't works is the fuctions that NEED the LoadXML. Thanks.
  16. Yes I do it. I tell to you that I use the same on server-side in a command and all works perfect. I don't know what to do. Thanks men for all.
  17. I put it in my RLC resource. But the code is correct and I try with :RLC/casas.xml too and doesn't work. For my experience I can think that it some save problem, but it works perfect in server side then... wtf?
  18. I found the problems. The .xml don't load and the fuctions doesn't works because it's needed load the xml. In server-side the xml load correctly. Why? local casasxml = xmlLoadFile("casas.xml") the SAME works perfect in server-side
  19. Doesn't work yet and i don't know what the hell is goin on. I think the guibotones doesn't loaded because I do errors in the guibotones.lua script on purpose and the console don't say anything, and If I do it in a server-side script, the console say the problems. What happens? guibotones.lua doesn't loaded? my meta: <meta> <?xml version="1.0" encoding="UTF-8" ?> <info author="Coco" type="gamemode" name="RLC" description="RLC" /> <script src="spawn.lua" /> <script src="comandos.lua" /> <script src="registrarse.lua" /> <script src="guibotones.lua" type="client" /> </meta> Please help. Thanks for all people. EDIT: I see that if you put type="client" ( this says that the script is client-side ) don't detect the problems.
  20. what the...?! I don't see this noob problem -.- . I solve this problem and casasnum problem and I tell you what happens. Thanks for all men.
  21. No, I think you don't need include it. I know how to use XML fuctions, the system works fine in a command but I mean that doesn't works the GUI Thanks men.
  22. casasnum is defined in another server-side script and I think that I can use it in the script but I see that I can't in Client. You mean that I will destroy the Col Sphere when it is used? posicionjugS1 is used at line 10. I am trying to do when a player go to the enter of a House then displays a GUI to buy the house , to see information, etc I hope you understand me and thanks for trying help me. Sorry for my bad English. THANKS!
  23. Show me your givePlayerMoney (person, math.abs(tonumber(amount))) script please.
  24. What do you mean to XML in Client? How I can use the XML in both server side and client ? And what do you mean saying the SetTimer is bugged? Please help. and thanks men.
  25. It says: INFO: votemanager precreateGuiElements What is that? THANKS for the help.
×
×
  • Create New...