Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. Castillo

    Error

    No se, la unica manera seria guardar cada cuenta y su experiencia en una tabla al iniciar y loguearse un jugador, y luego tendrias que hacer un for-loop, pero eso podria laguear al servidor.
  2. Castillo

    Error

    Ah, ahora entiendo, pero para eso vas a tener que editar el script, para que guarde la experiencia siguiente o algo asi.
  3. Castillo

    Error

    La verdad es que sigo sin entender. Si player 1 tiene 2500 de exp y player 2 tiene 2000, obvio que player 1 sera rango 1.
  4. Castillo

    Error

    Decis que se auto refresque?
  5. Castillo

    Error

    addCommandHandler ( "ran", function ( ) for index, rank in ipairs ( tabladeRanks ( ) ) do if ( isElement ( rank [ 2 ] ) ) then setElementData ( rank [ 2 ], "Rank", index ) end end end ) function tabladeRanks ( ) local datat = { } for _, player in ipairs ( getElementsByType ( "player" ) ) do table.insert ( datat, { tonumber ( getElementData ( player, "Exp" ) or 0 ), player } ) end table.sort ( datat, function ( a, b ) return ( tonumber ( a [ 1 ] ) or 0 ) > ( tonumber ( b [ 1 ] ) or 0 ) end ) return datat end
  6. Castillo

    Error

    addCommandHandler ( "ran", function ( ) for _, rank in ipairs ( tabladeRanks ( ) ) do outputChatBox ( tonumber ( rank [ 1 ] )..": ".. getPlayerName ( rank [ 2 ] ) ) --setElementData(player, "Rank", i ) end end ) function tabladeRanks ( ) local datat = { } for _, player in ipairs ( getElementsByType ( "player" ) ) do table.insert ( datat, { tonumber ( getElementData ( player, "Exp" ) or 0 ), player } ) end table.sort ( datat, function ( a, b ) return ( tonumber ( a [ 1 ] ) or 0 ) > ( tonumber ( b [ 1 ] ) or 0 ) end ) return datat end Mucho mas facil con table.sort.
  7. Castillo

    Error

    Copia mi ultimo codigo.
  8. Castillo

    Error

    addCommandHandler ( "ran", function ( ) for _, rank in ipairs ( tabladeRanks ( ) ) do outputChatBox ( tonumber ( rank [ 1 ] )..": ".. getPlayerName ( rank [ 2 ] ) ) --setElementData(player, "Rank", i ) end end ) function tabladeRanks ( ) local datat = { } for k, player in ipairs ( getElementsByType ( "player" ) ) do local top = ( datat [ 1 ] and datat [ 1 ] [ 1 ] or 0 ) local low = ( datat [ #datat ] and datat [ #datat ] [ 1 ] or math.huge ) local pmon = tonumber ( getElementData ( player, "Exp" ) or 0 ) if ( pmon > top ) then table.insert ( datat, { 1, player } ) elseif ( pmon < low ) then table.insert ( datat, { #datat + 1, player } ) end end return datat end
  9. Oh, I actually didn't notice you were using bindKey.
  10. Castillo

    Error

    Cierto, me olvide de algo, copialo nuevamente.
  11. Lo copiaste mal seguramente.
  12. Castillo

    Error

    Copialo de nuevo.
  13. Es porque getPlayerTeam devuelve un elemento, no un nombre. fileWrite( xml, "\""..getPlayerName(player).."\" team=\"".. getTeamName ( getPlayerTeam(player) ).."\"/> \n")
  14. En que linea dice eso?
  15. Pusiste 'fileWrite' y 'fileClose' despues de cerrar la funcion, ponelo antes del 'end'.
  16. Castillo

    Error

    Proba esto: addCommandHandler ( "ran", function ( ) for _, rank in ipairs ( tabladeRanks ( ) ) do outputChatBox ( tonumber ( rank [ 1 ] )..": ".. getPlayerName ( rank [ 2 ] ) ) --setElementData(player, "Rank", i ) end end ) function tabladeRanks ( ) local datat = { } for k, player in ipairs ( getElementsByType ( "player" ) ) do local top = ( datat [ 1 ] and datat [ 1 ] [ 1 ] or 0 ) local low = datat [ #datat ] or math.huge local pmon = tonumber ( getElementData ( player, "Exp" ) or 0 ) if ( pmon > top ) then table.insert ( datat, { 1, player } ) elseif ( pmon < low ) then table.insert ( datat, { #datat + 1, player } ) end end return datat end
  17. Castillo

    Error

    Ambos son numeros, ese error no deberia aparecer, estas segurisimo de que es en esa linea?
  18. Castillo

    Error

    Fijate que devuelve "pmon" y "top".
  19. addEvent ( "SitForm", true ) addEventHandler ( "SitForm", root, function ( WTF ) if ( WTF == "pc1" ) then outputChatBox ( "pc1", 255, 0, 0 ) elseif ( WTF == "pc2" ) then outputChatBox ( "pc2", 255, 0, 0 ) end end )
  20. teamTaxistas = createTeam ( "Taxistas", 255, 255, 0 ) function taxiCommand ( thePlayer, command ) taxiOphaalBlip = createBlipAttachedTo ( thePlayer, 48, 1, 255, 0, 0, 0, 0, 99999.0, getRootElement() ) outputChatBox ("textoasdasd1.", thePlayer, 255, 190, 0, false ) for _, player in ipairs ( getPlayersInTeam ( teamTaxistas ) ) do outputChatBox ("textoasdasd.",player,0,255,0,true) end end addCommandHandler ( "taxi", taxiCommand )
×
×
  • Create New...