SA-MP Forums Archive
Log system - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Log system (/showthread.php?tid=273512)



Log system - Kingunit - 02.08.2011

<fixed>


Re: Log system - Laronic - 02.08.2011

This should work

pawn Код:
format(string, sizeof(string), "%s has been kicked by Admin %s. Reason: %s", playername, adminname, reason);
AdminLog(string);
pawn Код:
stock AdminLog(string[])
{
    new LogString[150], YEAR_string[5], Year, Month, Day, Hour, Minute, Second;
    new File:AdminLog = fopen("admin_log.txt", io_append);
    getdate(Year, Month, Day);
    gettime(Hour, Minute, Second);
    format(YEAR_string, sizeof(YEAR_string), "%d", Year);
    strdel(YEAR_string, 0, 2);
    format(LogString, sizeof(LogString), "[%d/%d/%s | %d:%d] %s", Day, Month, YEAR_string, Hour, Minute, string);
    fwrite(AdminLog, LogString);
    fwrite(AdminLog, "\r\n");
    return fclose(AdminLog);
}



Re: Log system - =WoR=Varth - 02.08.2011

With y_ini:
pawn Код:
stock SLog(stringtext1[],stringtext2[],name[])
{
    new INI:file = INI_Open(name);
    INI_WriteString(file,stringtext1,stringtext2);
    INI_Close(file);
    return 1;
}
//That stock will write "stringtext1 = stringtext2" inside "name" file.
//f.e:
stock STimeDate()
{
    new Times[2],Dates[3],string[64];
    gettime(Times[0],Times[1]);
    getdate(Dates[0],Dates[1],Dates[2]);
    CostumFormat(string,"%d/%d/%d - %d:%d",Dates[2],Dates[1],Dates[0],Times[0],Times[1]);
    return string;
}

//Somewhere
SLog(STimeDate(),"blahblahblah","Testfile.ini")
//That code will write "day/month/year - hour:minute = blahblahblah" inside "Testfile.ini" file.



Re: Log system - Kingunit - 02.08.2011

<fixed>


Re: Log system - PGTips - 02.08.2011

These are Stocksthey go out side coding and basicly hold info you may want to access by using for example strings or loading data and can be easly loaded

PS theformatting of the string still has to go inside some sort of code


Re: Log system - Kingunit - 02.08.2011

<fixed>


Re: Log system - Kingunit - 02.08.2011

Thank you CyberGhost for helping me out! This works, seriously thank you very much!


Re: Log system - Famalamalam - 02.08.2011

For the "enters" use \n ... that basically tells the script to form a new line.


Re: Log system - PGTips - 02.08.2011

please dont reply to solved posts because when we go down the list we click t and its just you posting somthing he doesnt need and porbs isnnt going to use at the bottem of the script and it gets annoying

Thanks


Re: Log system - Famalamalam - 02.08.2011

Be quiet, child. He asked for an explanation, I gave it to him since nobody else did. Throwing code at newbies is all well and good, but unless you explain what it does, you will never learn.


Re: Log system - Kingunit - 02.08.2011

<fixed>


Re: Log system - Famalamalam - 02.08.2011

Lol. Well it should