Jump to content

top 10 players list


Wisin

Recommended Posts

im not sure if you can do this witout sqlite/mysql - as you can't get data from offline players.

just save kills to database, then just select, ordering by kills.

i'm actually using account data to save their kills, but my question is how i can retrive highest data and stop adding when reaches 10?

hope someone can give me a code to start :D

Link to comment
i think it's not possible to getAccountData of player which is not on the server. you without database you will be able only to create a rank of online players - which is nothing useful i think

Well said, you "think"..

https://wiki.multitheftauto.com/wiki/GetAccount

https://wiki.multitheftauto.com/wiki/GetAccounts

You are my salvation dude! thank you very much!

Edit: Hmm could someone give me a little example of how i can get the highest kills from the table of accounts?

Link to comment

Patience is good thing.

Text-description:

prepare table for top 10,

Loop through all accounts,

if table size is smaller than 10 - just add values, if its size equals to 10 loop through whole table, if one of values is less than value from account - remove smallest value from table and add that one from current account in your loop.

At the end-sort the table. Maybe lua have some sorting functions-if not, search google for sorting function and use it.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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