![]() |
|
[Pawn] HELP with log. - Printable Version +- open.mp forum (https://forum.open.mp) +-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) +--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) +--- Thread: [Pawn] HELP with log. (/showthread.php?tid=1933) |
HELP with log. - Ambarita - 2021-04-22 Is there anything i can use for making logs? like a kick and ban log. RE: HELP with log. - TheAnimalKa - 2021-04-22 You can use mysql for making ban logs. RE: HELP with log. - Ambarita - 2021-04-22 (2021-04-22, 11:27 AM)TheAnimalKa Wrote: You can use mysql for making ban logs. Is there no way to store it locally? RE: HELP with log. - TheAnimalKa - 2021-04-22 (2021-04-22, 11:59 AM)Ambarita Wrote:(2021-04-22, 11:27 AM)TheAnimalKa Wrote: You can use mysql for making ban logs. Code: stock WriteLog(const path[], const str[], {Float,_}:...) // Credit Emmet
{
static
args,
start,
end,
File:file,
string[1024]
;
if ((start = strfind(path, "/")) != -1) {
strmid(string, path, 0, start 1);
if (!fexist(string))
return printf("** Warning: Directory \"%s\" doesn't exist.", string);
}
#emit LOAD.S.pri 8
#emit STOR.pri args
file = fopen(path, io_append);
if (!file)
return 0;
if (args > 8)
{
#emit ADDR.pri str
#emit STOR.pri start
for (end = start (args - 8); end > start; end -= 4)
{
#emit LREF.pri end
#emit PUSH.pri
}
#emit PUSH.S str
#emit PUSH.C 1024
#emit PUSH.C string
#emit PUSH.C args
#emit SYSREQ.C format
fwrite(file, string);
fwrite(file, "\r\n");
fclose(file);
#emit LCTRL 5
#emit SCTRL 4
#emit RETN
}
fwrite(file, str);
fwrite(file, "\r\n");
fclose(file);
return 1;
}And you use it like this CMD:ban(playerid, params[]) { if(sscanf(params, "us[128]", playerb, reason)) return SendClientMessage(playerid, -1, "/ban [playerid/PartofName] [reason]"); WriteLog("ban_logs/ban.txt", "%s has banned?%s?for?%s.",? ReturnName(playerid), ReturnName(playerb), reason); return 1; } if no log will show in your scriptfiles I think you have to manual create a folder named ban_logs and inside it is ban.txt. RE: HELP with log. - Pinch - 2021-04-22 Use this https://github.com/Southclaws/samp-logger |