Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TOP
#1
Can you help me? I don't know what's wrong.

Code:
SCRIPT (SERVER)

local top_winrate_1_name = "";
local top_winrate_1 = 0;
local top_winrate_2_name = "";
local top_winrate_2 = 0;

function onInit()
{
ReadTOPRating();
}



function ReadTOPRating()
{

{
    local reg_pl = 0;
    local file = fileOpen("DB/RegisteredPlayers.txt","r");
    if (file)
    {
        local registered_players = fileRead(file,"d");
        reg_pl = registered_players.tointeger();
        fileClose(file);
    }
    reg_pl = reg_pl + 1;
    file = fileOpen("DB/Rating/Winrate.txt","r");
    for (local i = 1; i < reg_pl; ++i)
    {
        local name = fileRead(file);
        local rating = fileRead(file);
        if (rating > top_winrate_1)
        {
            top_winrate_1_name = name;
            top_winrate_1 = rating;
        }
        else if (rating > top_winrate_2)
        {
            top_winrate_2_name = name;
            top_winrate_2 = rating;
        }
        print(top_winrate_1_name);
        print(top_winrate_1);
        print("------------");
        print(top_winrate_2_name);
        print(top_winrate_2);
    }
}

Code:
FILE WINRATE

OsmithREV
7700
Bagoga
665

Code:
OUTPUT (if print top_winrate_1_name and top_winrate_2_name)

Bagoga
7700

Bagoga
655
Discord: I'm not a spy...#9943.
GG: 60474243.

[Image: OsmithREV.gif]
[Image: 76561198181768479.png]
Reply


Messages In This Thread
TOP - by Osmith - 01.05.2016, 20:03
RE: TOP - by HammelGammel - 01.05.2016, 22:12
RE: TOP - by Osmith - 01.05.2016, 23:09
RE: TOP - by HammelGammel - 02.05.2016, 02:29
RE: TOP - by Osmith - 02.05.2016, 10:14
RE: TOP - by HammelGammel - 02.05.2016, 12:16

Forum Jump:


Users browsing this thread: 1 Guest(s)