• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] HELP with log.
#1
Is there anything i can use for making logs? like a kick and ban log.
  Reply
#2
You can use mysql for making ban logs.
  Reply
#3
(2021-04-22, 11:27 AM)TheAnimalKa Wrote: You can use mysql for making ban logs.



Is there no way to store it locally?
  Reply
#4
(2021-04-22, 11:59 AM)Ambarita Wrote:
(2021-04-22, 11:27 AM)TheAnimalKa Wrote: You can use mysql for making ban logs.

Is there no way to store it locally?


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.
  Reply
#5
Use this

https://github.com/Southclaws/samp-logger
Using Pawn.CMD?

If you're doing so, this is the very first sign that you absolutely shouldn't utilize your all powerful P-Code knowledge in any of the scripting discussion topics.
  Reply


Forum Jump: