Jump to content

Rank


Arsilex

Recommended Posts

Posted

Hola me gustaria saber como hacer para cuando un player tenga por ejemplo 500 puntos y otro 250 que el que tenga 500 le ponga rank 1 y el que tenga 250 que se le ponga 2 ????

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Podes poner a todos los jugadores con sus puntos en una tabla, y luego usar:

table.sort 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
como los pongo en una tabla ._.?

En .xml

Nada quever.

Lee sobre tablas en lua.org.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Yo vi un script que tiene levels en .XML y funciona bien.
    "Test 1" experienceRequired = "20" /> 
    "Test 2" experienceRequired = "100" /> 
    "Test 3" experienceRequired = "150" /> 
    "Test 4" experienceRequired = "200" /> 
    "Test 5" experienceRequired = "2000" /> 

------------------------------------------------------------------------------------------

My scripts

http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977

http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740

Posted
addEventHandler("onResourceStart", root, 
function() 
local players = getElementsByType ( "player" ) 
    for i, k in ipairs(players) do 
        table.insert (tabla, getElementData ( source, "Puntos-Rangos")) 
        table.sort (tabla) 
    end 
end 

asi seria mas o menos e.e?

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

No, tenes que leer sobre tablas y table.sort.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Nada quever, una tabla se define asi:

tabla = { } 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

hize esto asi y no me funciona

Rangos = { } 
  
addEventHandler("onResourceStart", root, 
function() 
local players = getElementsByType ( "player" ) 
    for i, k in ipairs(players) do 
        table.insert (Rangos, getElementData ( k, "Puntos-Rangos")) 
        table.sort (Rangos) 
    end 
end 
) 

ni me da error ni nada :S

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Porque no se usa asi.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Una forma MUY facil es agregar todo a una BASE DE DATOS, ejecutar una query y ORDER BY RANK ASC creando un INDEX por cada uno, sumándose en UNO.

Nótese que esto sería util para casos como ver en comandos. Si se usa por ejemplo para scoreboard puede empeorar el funcionamiento del server

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...