Plate Posted March 6, 2013 Posted March 6, 2013 Hola tengo una duda esto esta bien? function showmembers() local row = guiGridListAddRow(members) local row, col = guiGridListGetSelectedItem ( members ) if ( row and col and row ~= -1 and col ~= -1 ) then local team = guiGridListGetItemText ( members, row, mlist ) guiGridListSetItemText(members, row, mlist, getPlayersInTeam(team), false, false) end end addEventHandler("onClientGUIClick", showlist, showmembers, false)
Castillo Posted March 6, 2013 Posted March 6, 2013 Te lo dijo todo al reves, "team" en tu script es un string, supongo que el nombre de un team, lo que tenes que hacer es obtener el elemento del team usando: getTeamFromName Luego en guiGridListSetItemText, estas poniendo una tabla como texto, no creo que quieras hacer eso.
Plate Posted March 6, 2013 Author Posted March 6, 2013 Lo que yo quiero es poner los miembros de un team en una gridlist
Castillo Posted March 6, 2013 Posted March 6, 2013 Entonces tenes que usar un for-loop con la tabla que devuelve getPlayersInTeam.
Plate Posted March 6, 2013 Author Posted March 6, 2013 for i, team in ipairs (getElementsByType("team")) do asi?
Plate Posted March 6, 2013 Author Posted March 6, 2013 for i, v in ipairs (getPlayersInTeam(team)) do guiGridListSetItemText(members, row, mlist, v, false, false)
Castillo Posted March 6, 2013 Posted March 6, 2013 Si, pero tenes que obtener el team del nombre usando la funcion que ya te dije antes.
Plate Posted March 6, 2013 Author Posted March 6, 2013 function showmembers() local row, col = guiGridListGetSelectedItem ( clist ) if ( row and col and row ~= -1 and col ~= -1 ) then local team = guiGridListGetItemText ( clist, row, columnC ) for i, v in ipairs (getPlayersInTeam(getTeamFromName(team))) do local row = guiGridListAddRow(members) guiGridListSetItemText(members, row, mlist, getPlayerName(v), false, false) end end addEventHandler("onClientGUIClick", showlist, showmembers, false)
Plate Posted March 6, 2013 Author Posted March 6, 2013 Nop me dice expected string at argument 4 got table
Renkon Posted March 6, 2013 Posted March 6, 2013 Como lo puedo hacer un string Renkon Quise decir que el team que pide la funcion tiene que ser un elemento TEAM no un strnig. Me explique mal
Castillo Posted March 6, 2013 Posted March 6, 2013 Nop me diceexpected string at argument 4 got table En esta linea? guiGridListSetItemText(members, row, mlist, getPlayerName(v), false, false) Es impossible, porque getPlayerName devuelve un string.
Plate Posted March 6, 2013 Author Posted March 6, 2013 Si solid en esa linea me da el error en el argumento 4
Recommended Posts