JesusAliso Posted January 9, 2014 Share Posted January 9, 2014 Buenas. Estoy creando un "Spawn" para mi servidor... y necesito una ayuda con esto Gridlist: gridlist1 = guiCreateGridList(9, 23, 176, 157, false, ventana1) guiGridListAddColumn(gridlist1, "Ciudad:", 0.9) for i = 1, 3 do guiGridListAddRow(gridlist1) end gui1 = guiGridListSetItemText(gridlist1, 0, 1, "San Fierro", false, false) gui2 = guiGridListSetItemText(gridlist1, 1, 1, "Las Venturas", false, false) gui3 = guiGridListSetItemText(gridlist1, 2, 1, "Los Santos", false, false) gridlist2 = guiCreateGridList(205, 23, 176, 157, false, ventana1) guiGridListAddColumn(gridlist2, "Clases:", 0.9) Bueno, me explico. como podría hacer para que cuando seleccione que si "San Fierro" en la (gridlist1) se creen los "row" en la segunda (gridlist2). Intente así: addEventHandler ("onClientGUIClick", gui1, sanfierro, false) function sanfierro () guiGridListSetItemText(gridlist2, 0, 1, "Civiles", false, false) guiGridListSetItemText(gridlist2, 1, 1, "Agentes Especiales", false, false) guiGridListSetItemText(gridlist2, 2, 1, "Criminales", false, false) end PD: Todo lo hice con el recurso "guieditor". Link to comment
Castillo Posted January 9, 2014 Share Posted January 9, 2014 function sanfierro ( ) guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Civiles", false, false ) guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Agentes Especiales", false, false ) guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Criminales", false, false ) end addEventHandler ( "onClientGUIClick", gui1, sanfierro, false ) Link to comment
JesusAliso Posted January 9, 2014 Author Share Posted January 9, 2014 Gracias solid, pero me sale "Bad argument" @ 'addEventHandler' [Expected element at argument 2, got bolean] - En el addEventHandler que me pusiste arriba. PD: Me podrias explicar por que sale ese error? - Es para aprender Link to comment
Castillo Posted January 9, 2014 Share Posted January 9, 2014 Quiere decir que "gui1" no existe, postea el codigo entero. Link to comment
JesusAliso Posted January 9, 2014 Author Share Posted January 9, 2014 Solo tengo todo el spawn, creado por "guieditor" pero no tienen ninguna funcion por los momentos. Aquí todo: addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor = { gridlist = {}, label = {} } ventana1 = guiCreateWindow(623, 278, 391, 486, "RPG:Server | Seleccion de Clases |", false) guiWindowSetMovable(ventana1, false) guiWindowSetSizable(ventana1, false) guiSetAlpha(ventana1, 0.73) gridlist1 = guiCreateGridList(9, 23, 176, 157, false, ventana1) guiGridListAddColumn(gridlist1, "Ciudad:", 0.9) for i = 1, 3 do guiGridListAddRow(gridlist1) end gui1 = guiGridListSetItemText(gridlist1, 0, 1, "San Fierro", false, false) gui2 = guiGridListSetItemText(gridlist1, 1, 1, "Las Venturas", false, false) gui3 = guiGridListSetItemText(gridlist1, 2, 1, "Los Santos", false, false) gridlist2 = guiCreateGridList(205, 23, 176, 157, false, ventana1) guiGridListAddColumn(gridlist2, "Clases:", 0.9) for i = 1, 3 do guiGridListAddRow(gridlist2) end gridlist3 = guiCreateGridList(205, 190, 176, 214, false, ventana1) guiGridListAddColumn(gridlist3, "Personas:", 0.9) for i = 1, 3 do guiGridListAddRow(gridlist3) end skins = guiCreateGridList(9, 190, 176, 214, false, ventana1) boton1 = guiCreateButton(9, 409, 35, 18, "<", false, ventana1) guiSetProperty(boton1, "NormalTextColour", "FFAAAAAA") boton2 = guiCreateButton(150, 409, 35, 18, ">", false, ventana1) guiSetProperty(boton2, "NormalTextColour", "FFAAAAAA") imagen1 = guiCreateStaticImage(204, 420, 177, 56, ":guieditor/images/examples/mtalogo.png", false, ventana1) ventana2 = guiCreateWindow(623, 176, 391, 102, "RPG:Server | Clase Informacion |", false) guiWindowSetSizable(ventana2, false) guiSetAlpha(ventana2, 0.70) memo1 = guiCreateMemo(9, 21, 372, 71, "", false, ventana2) guiMemoSetReadOnly(memo1, true) showCursor (true) end ) function sanfierro () guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Civiles", false, false ) guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Agentes Especiales", false, false ) guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Criminales", false, false ) end addEventHandler ( "onClientGUIClick", gui1, sanfierro, false ) Link to comment
Castillo Posted January 9, 2014 Share Posted January 9, 2014 addEventHandler ( "onClientGUIClick", gui1, sanfierro, false ) Move eso dentro de la funcion donde creas el GUI. Link to comment
JesusAliso Posted January 9, 2014 Author Share Posted January 9, 2014 Ya lo intente, pero igual dice eso. Link to comment
Castillo Posted January 9, 2014 Share Posted January 9, 2014 Mostrame donde lo pusiste. Link to comment
JesusAliso Posted January 9, 2014 Author Share Posted January 9, 2014 showCursor (true) --------------------------- addEventHandler ( "onClientGUIClick", gui1, sanfierro, false ) Link to comment
Castillo Posted January 9, 2014 Share Posted January 9, 2014 Postea el script completo. Link to comment
JesusAliso Posted January 9, 2014 Author Share Posted January 9, 2014 addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor = { gridlist = {}, label = {} } ventana1 = guiCreateWindow(623, 278, 391, 486, "RPG:Server | Seleccion de Clases |", false) guiWindowSetMovable(ventana1, false) guiWindowSetSizable(ventana1, false) guiSetAlpha(ventana1, 0.73) gridlist1 = guiCreateGridList(9, 23, 176, 157, false, ventana1) guiGridListAddColumn(gridlist1, "Ciudad:", 0.9) for i = 1, 3 do guiGridListAddRow(gridlist1) end gui1 = guiGridListSetItemText(gridlist1, 0, 1, "San Fierro", false, false) gui2 = guiGridListSetItemText(gridlist1, 1, 1, "Las Venturas", false, false) gui3 = guiGridListSetItemText(gridlist1, 2, 1, "Los Santos", false, false) gridlist2 = guiCreateGridList(205, 23, 176, 157, false, ventana1) guiGridListAddColumn(gridlist2, "Clases:", 0.9) gridlist3 = guiCreateGridList(205, 190, 176, 214, false, ventana1) guiGridListAddColumn(gridlist3, "Personas:", 0.9) for i = 1, 3 do guiGridListAddRow(gridlist3) end skins = guiCreateGridList(9, 190, 176, 214, false, ventana1) boton1 = guiCreateButton(9, 409, 35, 18, "<", false, ventana1) guiSetProperty(boton1, "NormalTextColour", "FFAAAAAA") boton2 = guiCreateButton(150, 409, 35, 18, ">", false, ventana1) guiSetProperty(boton2, "NormalTextColour", "FFAAAAAA") imagen1 = guiCreateStaticImage(204, 420, 177, 56, ":guieditor/images/examples/mtalogo.png", false, ventana1) ventana2 = guiCreateWindow(623, 176, 391, 102, "RPG:Server | Clase Informacion |", false) guiWindowSetSizable(ventana2, false) guiSetAlpha(ventana2, 0.70) memo1 = guiCreateMemo(9, 21, 372, 71, "", false, ventana2) guiMemoSetReadOnly(memo1, true) showCursor (true) --------------------------- addEventHandler ( "onClientGUIClick", gui1, sanfierro, false ) end ) function sanfierro () guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Civiles", false, false ) guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Agentes Especiales", false, false ) guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Criminales", false, false ) end Link to comment
Sasu Posted January 9, 2014 Share Posted January 9, 2014 Quiere decir que "gui1" no existe, postea el codigo entero. guiGridListSetItemText devuelve un boolean, no un elemento. Link to comment
Castillo Posted January 9, 2014 Share Posted January 9, 2014 Sabes que al mirar el script la primera vez vi que decia "guiCreateGridList" y no "guiGridListSetItemText". @Jesus: Cambia "gui1" en addEventHandler por "gridlist1", y luego tendras que verificar que item clickeo el jugador. Link to comment
JesusAliso Posted January 9, 2014 Author Share Posted January 9, 2014 ok, y para verificar, que funciones utilizo? Link to comment
Castillo Posted January 9, 2014 Share Posted January 9, 2014 guiGridListGetSelectedItem guiGridListGetItemText Link to comment
JesusAliso Posted January 9, 2014 Author Share Posted January 9, 2014 ya sabia!, si no que pregunte por si no eran esas 2, por que la otravez intente utilizar esas funciones pero no logre nada. EDIT: si no es de mucha molestia, me podrías enseñar?, es que te aseguro que intente y nada. Link to comment
Castillo Posted January 10, 2014 Share Posted January 10, 2014 function sanfierro ( ) local row, col = guiGridListGetSelectedItem ( gridlist1 ) if ( row and col and row ~= -1 and col ~= -1 ) then local cityName = guiGridListGetItemText ( gridlist1, row, col ) if ( cityName == "San Fierro" ) then guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Civiles", false, false ) guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Agentes Especiales", false, false ) guiGridListSetItemText ( gridlist2, guiGridListAddRow ( gridlist2 ), 1, "Criminales", false, false ) end end end Link to comment
JesusAliso Posted January 10, 2014 Author Share Posted January 10, 2014 Muchas gracias castillo, pero no se crean en la otra gridlist. dice el mismo error en el "addEventHandler". addEventHandler ( "onClientGUIClick", guiGridListSetItemText, sanfierro, false ) Hay lo cambie como tu dijiste. Link to comment
Castillo Posted January 10, 2014 Share Posted January 10, 2014 Oh, me equivoque al escribir, perdon. addEventHandler ( "onClientGUIClick", gridlist1, sanfierro, false ) Link to comment
JesusAliso Posted January 10, 2014 Author Share Posted January 10, 2014 D: Muchas gracias solid por tu ayuda. Link to comment
Recommended Posts