[Include] Some Small Functions
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Do you know WHY people claim that dini isn't a very good file system? Because it's slow! Why is it slow? Because it opens, writes, and closes, the file for EVERY operation instead of buffering data for more efficient writes. You figure out why I'm telling you this.

Also, we have a shiny new "Includes" forum - I moved this one there but you might want to pay more attention in the future.
Why are you talking about dini? Nothing to do with this?


And yes, I just noticed. thank you


EDIT:

Код:
   new File:cmdlog = fopen("logs/commands.txt", io_append);
   fwrite(cmdlog, text);
   fwrite(cmdlog, "\r\n");
   fclose(cmdlog);
Yeah, but what else? its a damn log file.

EDIT2:

Working on a solution, would like your opinion once its done


EDIT 3:


What would you think of this? Would this take loads of memory?
I have no experience on this part of coding/scripting, so this might be absolute shit what I'm posting now.



pawn Код:
new logline[MAX_PLAYERS][10][128];
new logamount[MAX_PLAYERS];



public OnPlayerConnect(playerid)
{
    logamount[playerid] = 0;
    canpm[playerid] = 1;
    return 1;
}


forward writecmdlog(text[]);
stock writecmdlog(text[])
{
    if(logamount[playerid] < 10)
    {
        logamount[playerid] ++;
        format(logline[playerid][logamount[playerid]], sizeof(logline[playerid][logamount[playerid]]), text);
    }
    else
    {
        new File:cmdlog = fopen("logs/commands.txt", io_append);
        for(new i=1; i<11; i++)
        {
            fwrite(cmdlog, logline[playerid][i]);
            fwrite(cmdlog, "\r\n");
        }
        fclose(cmdlog);
    }
    return 1;
}
:3

Might be shit though
Reply


Messages In This Thread
REMOVE PLEASE - by milanosie - 28.06.2012, 21:03
Re: Some Small Functions - by milanosie - 28.06.2012, 21:16
Re: Some Small Functions - by AndreT - 29.06.2012, 21:14
Re: Some Small Functions - by ipsBruno - 29.06.2012, 22:37
Re: Some Small Functions - by BlackBank - 30.06.2012, 14:41

Forum Jump:


Users browsing this thread: 1 Guest(s)