|
New Member
|

11-19-2006
, 03:20
ProKreedz Top10
|
#1
|
Hello!
Help to copy please a piece of a code from a plug-in (prokreedz) that kept statistics of a map in txt a file.
PHP Code:
// ================================================================================================= // Top10 // ================================================================================================= 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) } } public topten_show(id) { new motd[2048] new szvault[64], szmap[32] get_mapname(szmap,32) format(szvault,64,"pk_%s",szmap) new vault = nvault_open(szvault) if(vault != -1) { add(motd,2048,"<html><head><style>") add(motd,2048,"body { background-color:#000000; font-family:Tahoma; font-size:10px; color:#FFFFFF; }") add(motd,2048,".tabel { border-style:solid; border-width:1px; border-color:#FFFFFF; font-family:Tahoma; font-size:10px; color:#FFFFFF; }") add(motd,2048,".header { background-color:#292929; font-family:Tahoma; font-size:10px; color:#FFFFFF; font-weight:800; }") add(motd,2048,"</style></head><body>") add(motd,2048,"<br><br><table border=0 cellspacing=0 cellpadding=1 width=90% align=center class=tabel>") add(motd,2048,"<tr><td class=header>#</td><td class=header>Name</td><td class=header>Time</td><td class=header>Checkpoints</td></tr>") new szkey[8] for(new i=1;i<=10;i++) { new szreturn[128] format(szkey,8,"%d",i) nvault_get(vault,szkey,szreturn,128) new arg1[32], arg2[8], arg3[8] if(parse(szreturn,arg1,32,arg2,8,arg3,8) != 0) { new sztime[32] new imin, kreedztime = str_to_num(arg2) if((kreedztime / 60.0) >= 1) { imin = floatround(kreedztime / 60.0,floatround_floor) kreedztime -= (floatround(kreedztime / 60.0,floatround_floor) * 60) } format(sztime,32,"%d minutes and %d seconds",imin,kreedztime) add(motd,2048,"<tr><td>") add(motd,2048,szkey) add(motd,2048,"</td><td>") add(motd,2048,arg1) add(motd,2048,"</td><td>") add(motd,2048,sztime) add(motd,2048,"</td><td>") add(motd,2048,arg3) add(motd,2048,"</td></tr>") } } nvault_close(vault) add(motd,2048,"</table></body></html>") show_motd(id,motd,"ProKreedz Top10") } }
In general it would be smart, if at concurrence STEAM ID the record of the same players was replaced, instead of finished as in the variant resulted above. I think, such completion of this plug-in would please very much to many administrators, and players KZ of servers. If it is very complex, then it is a pity...
I am sorry for bad English language
|
|