Most players online ever
#3

I made a filterscript first so it would be easier to understand. Heres what I got:

pawn Код:
#include <a_samp>
#include <dini>

#pragma unused strtok
#pragma unused ret_memcpy

#define OLD dini_Int(SERVER_RECORD_FILE, "record")
#define SERVER_RECORD_FILE "SERVER/STATS/record.ini"

public OnFilterScriptInit()
{
    rcrd();
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(!IsPlayerNPC(playerid))
    {
        rcrd();
    }
    return 1;
}

stock rcrd()
{
    if(!fexist(SERVER_RECORD_FILE))
    {
        dini_Create(SERVER_RECORD_FILE);
        dini_IntSet(SERVER_RECORD_FILE, "record", CountPlayersOnline());
    }
    else
    {
        if(CountPlayersOnline() > OLD)
        {
            dini_IntSet(SERVER_RECORD_FILE, "record", CountPlayersOnline());
        }
    }
    return 1;
}

stock CountPlayersOnline()
{
    new iCount;
    for(new slots = GetMaxPlayers(), i; i < slots; i++)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i)) iCount++;
    }
    return iCount;
}
But the value in the file is always 0. Am I making a stupid mistake? If so, what?
Reply


Messages In This Thread
Most players online ever - by sciman001 - 07.11.2011, 02:29
Re: Most players online ever - by Snipa - 07.11.2011, 02:33
Re: Most players online ever - by sciman001 - 07.11.2011, 02:48
Re: Most players online ever - by MP2 - 07.11.2011, 02:56
Re: Most players online ever - by sciman001 - 07.11.2011, 02:57
Re: Most players online ever - by MP2 - 07.11.2011, 03:01
Re: Most players online ever - by sciman001 - 07.11.2011, 03:02
Re: Most players online ever - by Norn - 07.11.2011, 03:06
Re: Most players online ever - by sciman001 - 07.11.2011, 03:08

Forum Jump:


Users browsing this thread: 1 Guest(s)