kheelo Posted October 10, 2006 Share Posted October 10, 2006 ($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
*VoLDo* Posted October 10, 2006 Share Posted October 10, 2006 This Scr is for MTA 0.5 or MTA:SA Link to comment
lil Toady Posted October 10, 2006 Share Posted October 10, 2006 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
kheelo Posted October 10, 2006 Author Share Posted October 10, 2006 nice but what i need to add to get top 5? or the script gets too long? anyway thx alot man! Link to comment
lil Toady Posted October 10, 2006 Share Posted October 10, 2006 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
kheelo Posted October 10, 2006 Author Share Posted October 10, 2006 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
kheelo Posted October 11, 2006 Author Share Posted October 11, 2006 the top5 version also mixes up names so can u plz look through ur script just to make sure it ok. thx. Link to comment
vincedss Posted November 13, 2006 Share Posted November 13, 2006 yes it's kinda screwy... I wonder if someone could fix this script. Link to comment
vincedss Posted November 23, 2006 Share Posted November 23, 2006 apologies, the top 5 script works now. I didnt have many players in my points.ini before. Seems to work fine. But some lines wont show once in a while. Link to comment
Aeron Posted November 24, 2006 Share Posted November 24, 2006 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
vincedss Posted November 24, 2006 Share Posted November 24, 2006 As leading player I have finished like 10 races and still the !rank command only shows : Players with top points : 1: with 2: with 3: with 4: with 5: with I will try to add manually the %mta.top.X values in points.ini Link to comment
lil Toady Posted November 24, 2006 Share Posted November 24, 2006 I will try to add manually the %mta.top.X values in points.ini Don't do that P.S: muhahahahahha Aeron, you fail! (you can also load the ini into hash, so itll take less time/cpu with big ini's) Link to comment
vincedss Posted November 24, 2006 Share Posted November 24, 2006 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
kheelo Posted November 25, 2006 Author Share Posted November 25, 2006 Theres 450 players in my points.ini.... both top3 and top5 scripts are totally screwed Link to comment
lil Toady Posted November 25, 2006 Share Posted November 25, 2006 Theres 450 players in my points.ini....both top3 and top5 scripts are totally screwed cant be.. top 3 works, not sure about top 5, maybe u or ur mirc is "screwed".. hope u dont have mirc 6.2 or 6.21 Link to comment
kheelo Posted November 25, 2006 Author Share Posted November 25, 2006 i have 6.16 both scripts skip and mix up names. [RevC]ZaMuT: !top3 <1: ~RevC~HUNJA with 6410.3 points> <2: ~RevC~PaX with 4022.6 points> <3: ~RevC~Rix with 1680.7 points> i have 2600 points it never shows me Link to comment
vincedss Posted November 26, 2006 Share Posted November 26, 2006 Yeah, I noticed that sometimes some of the players in game dont appear in the ranking. But they are gone or rejoin it's fine. Link to comment
*VoLDo* Posted November 26, 2006 Share Posted November 26, 2006 it is possible to make !top Script for MTA: VC? Link to comment
Recommended Posts