Plate Posted January 27, 2013 Share Posted January 27, 2013 Hola tengo un problema con un mi script que me ayudo alex pero me da bad argument en getTeamFromName y en guiGridListGetItemText client function deteam() local team = guiGridListGetItemText(teamList, row, columnA) triggerServerEvent("Move", getLocalPlayer(), team) end addEventHandler("onClientGUIClick", mover, deteam, false) server function setTeam(player, teamName) local theTeam = getTeamFromName ( teamName ) if ( theTeam ) then setPlayerTeam ( player , theTeam ) end end addEvent("Move", true) addEventHandler("Move",getRootElement(), setTeam) Link to comment
Castillo Posted January 27, 2013 Share Posted January 27, 2013 function deteam ( ) local row, col = guiGridListGetSelectedItem ( teamList ) if ( row and col and row ~= -1 and col ~= -1 ) then local team = guiGridListGetItemText ( teamList, row, columnA ) triggerServerEvent ( "Move", localPlayer, localPlayer, team ) end end addEventHandler ( "onClientGUIClick", mover, deteam, false ) Link to comment
Plate Posted January 27, 2013 Author Share Posted January 27, 2013 Y para borrar un team es lo mismo solid? pero con un destroyElement en lugar del setPlayerTeam? Link to comment
Plate Posted January 27, 2013 Author Share Posted January 27, 2013 Me da bad argument en getTeamFromName server function borro() local theTeam = getTeamFromName ( teamName ) if ( theTeam ) then destroyElement(theTeam) end end addEvent("borro", true) addEventHandler("borro", getRootElement(), borro) client function borr ( ) local row, col = guiGridListGetSelectedItem ( teamList ) if ( row and col and row ~= -1 and col ~= -1 ) then local team = guiGridListGetItemText ( teamList, row, columnA ) triggerServerEvent ( "borro", localPlayer, localPlayer, team ) end end addEventHandler ( "onClientGUIClick", borrar, borr, false ) Link to comment
Castillo Posted January 27, 2013 Share Posted January 27, 2013 Primero: Quita uno de los 'localPlayer' de triggerServerEvent. Segundo: Te olvidaste de definir 'teamName' en al funcion 'borro'. Link to comment
Alexs Posted January 27, 2013 Share Posted January 27, 2013 function borro(teamName) local theTeam = getTeamFromName ( teamName ) if ( theTeam ) then destroyElement(theTeam) end end addEvent("borro", true) addEventHandler("borro", getRootElement(), borro) function borr ( ) local row, col = guiGridListGetSelectedItem ( teamList ) if ( row and col and row ~= -1 and col ~= -1 ) then local team = guiGridListGetItemText ( teamList, row, columnA ) triggerServerEvent ( "borro", root, team ) end end addEventHandler ( "onClientGUIClick", borrar, borr, false ) Link to comment
Plate Posted January 27, 2013 Author Share Posted January 27, 2013 Gracias alex y solid pero hay una cosa es que cuando borro el team todabia queda en la gridlist Link to comment
Castillo Posted January 27, 2013 Share Posted January 27, 2013 Usa guiGridListClear y luego pone los teams de nuevo. Link to comment
Plate Posted January 27, 2013 Author Share Posted January 27, 2013 Listo muchas gracias!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! solid y alex!!!!!!!!!!!!!!!!! Link to comment
Plate Posted January 27, 2013 Author Share Posted January 27, 2013 PD lo de la guiGridListClear no me funciono lo puse antes de lo de los teams y sigue sin andar Link to comment
Plate Posted January 27, 2013 Author Share Posted January 27, 2013 guiGridListClear ( teamList ) for id, team in ipairs(getElementsByType("team")) do local row = guiGridListAddRow ( teamList ) guiGridListSetItemText ( teamList, row, columnA, getTeamName ( team ), false, false ) guiGridListSetItemColor ( teamList, row, columnA, getTeamColor ( team ) ) end Link to comment
Castillo Posted January 27, 2013 Share Posted January 27, 2013 guiGridListClear ( teamList ) for id, team in ipairs(getElementsByType("team")) do local row = guiGridListAddRow ( teamList ) guiGridListSetItemText ( teamList, row, columnA, getTeamName ( team ), false, false ) guiGridListSetItemColor ( teamList, row, columnA, getTeamColor ( team ) ) end Si esta todo bien puesto, deberia funcionar. Link to comment
Plate Posted January 27, 2013 Author Share Posted January 27, 2013 Pero no me anda igual Link to comment
Castillo Posted January 27, 2013 Share Posted January 27, 2013 Postea todo el script o enviamelo por PM. Link to comment
Plate Posted January 27, 2013 Author Share Posted January 27, 2013 Hya te lo mando por pm Link to comment
Recommended Posts