SA-MP Forums Archive
Logs save Y_INI - 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: Logs save Y_INI (/showthread.php?tid=516900)



Logs save Y_INI - Need4samp - 02.06.2014

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);



Re: Logs save Y_INI - BroZeus - 02.06.2014

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


Re: Logs save Y_INI - Need4samp - 02.06.2014

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