SA-MP Forums Archive
Just a question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Just a question (/showthread.php?tid=351836)



Just a question - A7X_CEEJAY - 17.06.2012

Hey, I'm wondering how to make a SEPERATE log to serverlog.txt to store my LOGINS and LOGOUTS of users.

Currently, I can only make a log of people logging in via When they login they get a message. Here's my welcome message:

pawn Код:
format(string, sizeof(string), "SERVER: {FFFFFF}Welcome, {FF6347}%s{FFFFFF}. (Your last successful login was from %s)", RPN(playerid), PlayerInfo[playerid][pIP]);
    SendClientMessage(playerid, COLOR_LIGHTRED, string);
    Log("logs/joins.log", string);
RPN = Roleplay name ( As my server has Roleplay accounts and then Admin accounts)

But when I try to add the (log"logs/joins.log", string); to OnPlayerDisconnect, it says string is undefined, and I can't figure out how to define it, I did add
pawn Код:
string[64];
but it didn't work.

Any ideas on how to do this? so it logs when people logs in and out (Prefably with username and admin level)


Re: Just a question - milanosie - 17.06.2012

Here, what about this?
I made this function to log all cmd's but with a modification it should work.


pawn Код:
forward writecmdlog(text[]);
stock writecmdlog(text[])
{
   new File:cmdlog = fopen("realityrp/logs/commands.txt", io_append);
   fwrite(cmdlog, text);
   fwrite(cmdlog, "\r\n");
   fclose(cmdlog);
   return 1;
}
Just add at OnPlayerConnect:

pawn Код:
new year2, month2,day2;
        new hour2,minuite2,second2;
        getdate(year2, month2, day2);
        gettime(hour2,minuite2,second2);
        new string[128];
        format(string, sizeof(string), "[%d:%d:%d][%d/%d] %s joined", hour2 + 2, minuite2, second2, day2, month2, name);
        writecmdlog(string);



Re: Just a question - A7X_CEEJAY - 17.06.2012

It didn't work, fixed it now though

+Rep anyways


Re: Just a question - milanosie - 17.06.2012

Didn't work? Thats not true,
I'm using it myself so you are probably doing something wrong.
didn't work isn't right.


Also, People expect you to past the fixed code after you fixed it,