Log system
#1

<fixed>
Reply
#2

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);
}
Reply
#3

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.
Reply
#4

<fixed>
Reply
#5

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
Reply
#6

<fixed>
Reply
#7

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

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

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
Reply
#10

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.
Reply
#11

<fixed>
Reply
#12

Lol. Well it should
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)