AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   top 15 list from saved file (https://forums.alliedmods.net/showthread.php?t=56117)

scrtxxcaz 06-07-2007 02:16

top 15 list from saved file
 
ive tried many times to do this and researched alot and could not find any answers. Maybe some one can help me. My question is.... is there any way to read from a file and then print that info out as a top15 list? For example some of my code below that i was playin around with:

Code:

public show_top15awp(sBuffer[MAX_BUFFER_LENGTH + 1]) {
 new iLen = 0
 new pos
 new nick[32],sid[32],kl[32],dd[32],hh[32],ht[32],awpsomin[32]
 new filepointer = fopen(awpfile,"r")
 if(filepointer)
{
              new readdata[128]
              while(fgets(filepointer,readdata,127))
              {
                      parse(readdata,nick,32,sid,32,kl,31,dd,31,hh,31,ht,31)
                      {
                              awpsomin[pos] = str_to_num(kl)
                      }
                      pos++
              }
 }
 new rank = pos + 1,stats[32]
 new j = 0,h = 0
 while( h <= pos)
 {
        while (j <= pos)
        {
              if (awpsomin[h] >= awpsomin[j])
              {
                        rank--
 
                }
                j++
                stats[h] = rank
        }
        h++
 }
 new HUD[212]
 new g = 1
 while(g <= pos)
 {
            format(HUD,211,"%s %d %d %d",nick[g],kl[g],dd[g],stats[g])
            new num,players[32]
            get_players(players,num)
            iLen = format(sBuffer, MAX_BUFFER_LENGTH, "<body bgcolor=#000000><font color=#FFB000><pre>")
            iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2s %-22.22s %6s %6s^n", "#", "Nick", "Kills","Deaths")
            for(new r = 0;r <= num;r++)
            {
                      iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2d %-22.22s %6d %6d^n",stats[g],nick[g],kl[g],dd[g])
            }
            g++
 }
 
}



All times are GMT -4. The time now is 10:30.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.