Jump to content
  • 0

Cum se face un 'top'?


NERS

Question

Nu stiu cum sa explic asta foarte bine, dar cum pot sa fac de exemplu o comanda /top care iti arata top 10 jucatori cu cele mai multe ucideri?

Adica, sa zicem ca avem urmatorii jucatori:

Player1 (id 0) - 500 kills

Player2 (id 1) - 3 kills

Player3 (id 2) - 43 kills

Cu foreach(new i : Player) va arata fiecare jucator dupa ID, dar cum pot sa arat in functie de ucideri? adica asa:

Player1 (id 0) - 500 kills

Player3 (id 2) - 43 kills

Player2 (id 1) - 3 kills

stiu ca este posibil cu baza de date folosind "SELECT `Name` FROM `users` ORDER BY `Kills` DESC LIMIT 10" (sau ceva asemanator nu mai stiu sigur), dar este cumva posibil fara mysql?

Edited by NERS
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Salut, nu este posibil fara mysql. Poti face o functie prin care apelezi un query (exact ala pe care l-ai pus tu ca exemplu) si sa-ti incarce din baza primii 10 jucatorii cu cele mai multe kill-uri, si sa incarce nr de kills si death-uri (for(new i; i < cache_get_row_count(); i++)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.