Logs save Y_INI
#1

Hi guys

please i want create file in Logs/makeadmin.ini

pawn Код:
format(string, sizeof(string), "AdminWarn : Admin %s has give admin level %d To %s", pname, level, idname);
    SendAdminMessage(COLOR_HMARMGHLO9, string);
How can i do that ?

other : if u can make for me stock , because i need save many logs in many place on pawno







Answer
↓↓

First of all :

put stock (EX
pawn Код:
stock logswrite(file[] , text[])
{
new File:pp=fopen(file,io_append);
fwrite(pp,text);
fwrite(pp,"\r\n");
fclose(pp);
return 1;
}

Go to the string u want to save and use

pawn Код:
format(string, sizeof(string), "AdminWarn : Admin %s has give admin level %d To %s", pname, level, idname);
    SendAdminMessage(COLOR_HMARMGHLO9, string);
    logswrite("makeadmin.log", string);
logswrite("makeadmin.log", string);
Reply
#2

i recommend you use fwrite function for logs
so a stock as you requested will be like this--
pawn Код:
stock Write(file[] , text[])
{
new File:pp=fopen(file,io_append);
fwrite(pp,text);
fwrite(pp,"\r\n");
fclose(pp);
return 1;
}
NOTE - File should exist to write into it otherwise server will crash so make sure file is there
and also file name while using stock should be with its extension ,i.e., .txt/.ini
Reply
#3

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
i recommend you use fwrite function for logs
so a stock as you requested will be like this--
pawn Код:
stock Write(file[] , text[])
{
new File:pp=fopen(file,io_append);
fwrite(pp,text);
fwrite(pp,"\r\n");
fclose(pp);
return 1;
}
NOTE - File should exist to write into it otherwise server will crash so make sure file is there
and also file name while using stock should be with its extension ,i.e., .txt/.ini
Done , thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)