Hi, ive been working on this for a while now, well... i put it off for some time but starting to work on it again.
im trying to figure out how to change the top 10 update to save only the best time by each person. The way it was written, i can get all top 10 times for a map leaving no space for other people. I want it to work so that a person can only have one top 10 time, if there top10 time is 8th they have to have a better time than thier last top 10 time otherwise it doesnt save it. firstly it needs to be changed to use steamid's, which i have done in my modded version by simply adding an extra arg to the list. My issue is, im not sure how i go about updating the top 10. so that if i beat the 4th best time, it removes my old best time ranked 8th, makes my new time 4th, then pushes the other times down a slot, or if im not in the top 10 at all, it would have to push them down, and one time would be removed completely puting the times in the right order. would i have to save the times, then have a seperate function to organise them into thier correct order? here is the code im working with(unmodded the author p4ddy wrote this)
Code:
public topten_update(id) {
new szvault[64], szmap[32], kreedztime
get_mapname(szmap,32)
format(szvault,64,"pk_%s",szmap)
kreedztime = get_systime() - timer_time[id-1]
new vault = nvault_open(szvault) // Now we have to sort the new list :o
if(vault != -1) {
new szkey[8]
for(new i=1;i<=10;i++) {
new szreturn[128]
new arg1[32], arg2[8]
format(szkey,8,"%d",i)
nvault_get(vault,szkey,szreturn,128)
if(parse(szreturn,arg1,32,arg2,8) == 0 || kreedztime < str_to_num(arg2)) {
new sznew[128], szname[32]
get_user_name(id,szname,32)
format(sznew,128,"^"%s^" ^"%d^" ^"%d^"",szname,kreedztime,checkpointnum[id-1])
if(i < 10) {
for(new x=10;x>i;x--) {
new sztemp[128], sztempkey[8]
format(sztempkey,8,"%d",x-1)
nvault_get(vault,sztempkey,sztemp,128)
if(!equal(sztemp,"")) {
format(sztempkey,8,"%d",x)
nvault_pset(vault,sztempkey,sztemp)
}
}
}
nvault_pset(vault,szkey,sznew)
if(i == 1)
client_print(0,print_chat,"[ProKreedz] %s has established a new record",szname)
break
}
}
nvault_close(vault)
}
}
i think from what i can see "szkey = rank, arg1 = nickname, arg2 = recorded time, arg3 = checkpoints used" and in my modded version i had added "arg4 = szid( thier steamid)" which is as far as i got.
thanks for any help.
i have added many new functions to this plugin, it was a good well functioning plugin when i started with it, but i have added many more functions, including different top 10's for begginer, intermediate and pro jumpers, better cheat detection, im still developing a GOOD bhop script detection, a few other bits were added amongst a bit of a tidy/re-write of the whole thing. The only part of this ive never looked into is the VAULT, im still very newb when it comes to using it and this is a little above my head. I will also be making a public release of this once finished. i will add anyones name who helps complete this plugin along with myself and of couse the original author.
++ karma for help.
[Resolution]: re-wrote the whole top15 functions to use text files. withy some help from other KZ plugins (multiplugin and climbtimer).
__________________