Jump to content

toplist


kheelo

Recommended Posts

($scriptdir $+ points.ini,POINTS)

now there are names and points like that:

name = points

So can someone please make me script that reads 3 or 5 best players from points.ini and show them on server when someone types !rank ?

or atleast give me some hints

thx.

Link to comment
on *:SIGNAL:mta.command:{
 if ($3 == !rank) {
   var %a = 0,%b = 0,%c = 0,%d,%e = 0,%f,%g = 0,%h
   while (%a < $ini($scriptdir $+ points.ini,POINTS,0)) {
     %b = $readini($scriptdir $+ points.ini,POINTS,$ini($scriptdir $+ points.ini,POINTS,%a)) 
     if (%b > %c) {
       %e = %c
       %f = %d
       %c = %b
       %d = $ini($scriptdir $+ points.ini,POINTS,%a)
     }
     elseif (%b > %e) {
       %g = %e
       %h = %f
       %e = %b
       %f = $ini($scriptdir $+ points.ini,POINTS,%a)
     }
     elseif (%b > %g) {
       %g = %b
       %h = $ini($scriptdir $+ points.ini,POINTS,%a)
     }
     !inc %a
   }
   mta.text $1 Players with top points:
   if (%d) mta.text $1 1: %d with %c points
   if (%f) mta.text $1 2: %f with %e points
   if (%h) mta.text $1 3: %h with %g points
 }
}

Link to comment
on *:SIGNAL:mta.command:{
 if ($3 == !rank) {
   var %a = 0,%b = 0,%c = 0,%d = 0,%e = 0,%f = 0,%g = 0,%h,%i,%j,%k,%l
   while (%a < $ini($scriptdir $+ points.ini,POINTS,0)) {
     %b = $readini($scriptdir $+ points.ini,POINTS,$ini($scriptdir $+ points.ini,POINTS,%a)) 
     if (%b > %c) { %d = %c | %c = %b | %h = $ini($scriptdir $+ points.ini,POINTS,%a) }
     elseif (%b > %d) { %e = %d | %d = %b | %i = $ini($scriptdir $+ points.ini,POINTS,%a) }
     elseif (%b > %e) { %f = %e | %e = %b | %j = $ini($scriptdir $+ points.ini,POINTS,%a) }
     elseif (%b > %f) { %g = %f | %f = %b | %k = $ini($scriptdir $+ points.ini,POINTS,%a) }
     elseif (%b > %g) { %g = %b | %l = $ini($scriptdir $+ points.ini,POINTS,%a) }
     !inc %a
   }
   mta.text $1 Players with top points:
   if (%h) mta.text $1 1: %h with %c points
   if (%i) mta.text $1 2: %i with %d points
   if (%j) mta.text $1 3: %j with %e points
   if (%k) mta.text $1 4: %k with %f points
   if (%l) mta.text $1 5: %l with %g points
 }
}

Link to comment

it shows 4 and 5 th but doesent show second .-.-

edit: there is something wrong with this script.

points.ini:

[POINTS]

OneManArmy|DmA=7

DarDevil(Rus)=2.4

~RevC~puuks=8

Ristov=2

Player=1

random_noob=4

testing_noob1=20

testing_noob2=19

testing_noob3=18

testing_noob4=17

testing_noob5=16

Sancop=2

it showed 1. 3. 4. and 5. before

now it shows 1. 2. 3. and 4.

edit2:the first script with top 3 works correctly but the top 5 script has errors in list and it skips one or two places.

Link to comment
  • 1 month later...

Lil Toady's method eats CPU when you have 80.000 users in the list

on *:SIGNAL:mta.command:{
 if ($3 == !rank) {
   mta.text $1 Players with top points: 
   mta.text $1 1: $ini($scriptdir $+ points.ini,POINTS,%mta.top.1) with $readini($scriptdir $+ points.ini,POINTS,%mta.top.1)
   mta.text $1 2: $ini($scriptdir $+ points.ini,POINTS,%mta.top.2) with $readini($scriptdir $+ points.ini,POINTS,%mta.top.2)
   mta.text $1 3: $ini($scriptdir $+ points.ini,POINTS,%mta.top.3) with $readini($scriptdir $+ points.ini,POINTS,%mta.top.3)
   mta.text $1 4: $ini($scriptdir $+ points.ini,POINTS,%mta.top.4) with $readini($scriptdir $+ points.ini,POINTS,%mta.top.4)
   mta.text $1 5: $ini($scriptdir $+ points.ini,POINTS,%mta.top.5) with $readini($scriptdir $+ points.ini,POINTS,%mta.top.5)
 }
}
on *:SIGNAL:mta.finish:{
 ;paste snippets after rewarding points
 var %a = $readini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2)), %b = $ini($scriptdir $+ points.ini,POINTS,$mta.nick($1,$2))
 if (%a > $readini($scriptdir $+ points.ini,POINTS,%mta.top.1)) {
   %mta.top.5 = %mta.top.4
   %mta.top.4 = %mta.top.3
   %mta.top.3 = %mta.top.2
   %mta.top.2 = %mta.top.1
   %mta.top.1 = %b
 }
 elseif (%a > $readini($scriptdir $+ points.ini,POINTS,%mta.top.2)) {
   %mta.top.5 = %mta.top.4
   %mta.top.4 = %mta.top.3
   %mta.top.3 = %mta.top.2
   %mta.top.2 = %b
 }
 elseif (%a > $readini($scriptdir $+ points.ini,POINTS,%mta.top.3)) {
   %mta.top.5 = %mta.top.4
   %mta.top.4 = %mta.top.3
   %mta.top.3 = %b
 }
 elseif (%a > $readini($scriptdir $+ points.ini,POINTS,%mta.top.4)) {
   %mta.top.5 = %mta.top.4
   %mta.top.4 = %b
 }
 elseif (%a > $readini($scriptdir $+ points.ini,POINTS,%mta.top.5)) {
   %mta.top.5 = %b
 }
}

This method takes less CPU making it faster and is compatible with lil Toady's script.

The script works perfectly after the leading player (with the most points) has finished 5 times. Of if you make a list of the best players, get there index number of the ini file and set the variables in %mta.top.1 %mta.top.2 %mta.top.3 %mta.top.4 %mta.top.5

*UNTESTED*

Link to comment

I guess I will revert to Lil Toady's script...

Although the idea of keeping a ladder in a .ini file would be a cool idea... so player could check their ladder position with the !stats !points or !rank command.

Aeron > Keep us updated if you can get the script to work or on how to set it up correctly. I didnt understand what you said about tweaking the INI files.

Link to comment
  • Recently Browsing   0 members

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