Plate Posted January 27, 2013 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)
Castillo Posted January 27, 2013 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 )
Plate Posted January 27, 2013 Author Posted January 27, 2013 Y para borrar un team es lo mismo solid? pero con un destroyElement en lugar del setPlayerTeam?
Plate Posted January 27, 2013 Author 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 )
Castillo Posted January 27, 2013 Posted January 27, 2013 Primero: Quita uno de los 'localPlayer' de triggerServerEvent. Segundo: Te olvidaste de definir 'teamName' en al funcion 'borro'.
Alexs Posted January 27, 2013 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 )
Plate Posted January 27, 2013 Author Posted January 27, 2013 Gracias alex y solid pero hay una cosa es que cuando borro el team todabia queda en la gridlist
Castillo Posted January 27, 2013 Posted January 27, 2013 Usa guiGridListClear y luego pone los teams de nuevo.
Plate Posted January 27, 2013 Author Posted January 27, 2013 Listo muchas gracias!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! solid y alex!!!!!!!!!!!!!!!!!
Plate Posted January 27, 2013 Author Posted January 27, 2013 PD lo de la guiGridListClear no me funciono lo puse antes de lo de los teams y sigue sin andar
Plate Posted January 27, 2013 Author 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
Castillo Posted January 27, 2013 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.
Recommended Posts