Author Topic: Ban History log  (Read 1155 times)

I dunno. Some addon that shows the history of all bans on the server. It should show the name of the player who was banned, their ID, who banned them, the ID of who banned them,  when the ban occurred, how long it was, and the ban reason.

you know if you hit 'unban' it shows exactly what you're asking for right

you know if you hit 'unban' it shows exactly what you're asking for right
It shows bans that are still active, as in still issued.
He wants one that shows all bans that occurred, even ones that have passed.
I believe something like this was being worked on but never finished.
Not entirely sure.

Would be easy to do honestly.
Code: [Select]
package banLog
{
function serverCmdBan(%a,%b,%c,%d,%e,%f)
{
    %f=new fileObject();
    %f.openForAppend("config/server/BanLog.txt");
    %f.writeLine(%a TAB %b TAB %c TAB %d TAB %e TAB %f);
    %f.close();
    %f.delete();
    parent::serverCmdBan(%a,%b,%c,%d,%e,%f);
}
};
activatePackage(banLog);

Would be easy to do honestly.
-codestuff-

Oh uh
In that case could you package it for me? I'm not keen on packaging addons

FYI, all bans, even after expiration, are kept in the banlist.txt, as long as you don't manually remove them
But if you want manually removed bans to be kept you'll need to do what Thorfin posted. Although there's more than what he posted: The default banlist logs banner name, banner id, victim name, victim id, victim IP, ban reason, and two numbers I'm not entirely sure what they are (I assume time related)
« Last Edit: January 07, 2015, 06:52:57 PM by Headcrab Zombie »

I didn't know if I put enough arguments down there.

Edit:
Sorry was busy working on other stuffs.
Link to the thing.
« Last Edit: January 07, 2015, 09:01:09 PM by Thorfin25 »

Can you try to use the actual arguments, and not a made up number of single letters?
You can figure out the arguments simply by typing "/ban 1 2 3 4 5 6 7 8...." and seing what the resulting message is
function serverCmdBan(%client,%victim,%victimID,%time,%reason)
The rest come from fields/method calls on client/victim (IDs, IPs) or function calls (whatever format of time is used)
Also if you want this to actually be readable, you should give it headers so people actually know what field is what
« Last Edit: January 07, 2015, 09:32:16 PM by Headcrab Zombie »

I didn't bother trying to do that as it seems rather pointless for such a small mod, also I dislike headers as people with longer names will throw everything out of whack, although the %client argument probably should have .name on there when writing to the file.

Edit:
Well I went to try to ban myself under a different ID to actually get what all of the arguments would be to make it easier to read, that however failed. However I labeled them the best I could, you'll find the link above is the slightly updated version.
« Last Edit: January 07, 2015, 11:18:54 PM by Thorfin25 »

But I told you the arguments
function serverCmdBan(%client,%victim,%victimID,%time,%reason)
Also:
The name method is getPlayerName(), not getName()
%victim is just be the ID (the number that identifies every object, not blid) of the victim at the time, which just becomes a meaningless number after server restart. Use %victim.getPlayerName()
You may also want IP, which the default banlist logs
%time is just the length of the ban. You'll want start time and end time.




also I dislike headers as people with longer names will throw everything out of whack
Then you end up with a bunch of numbers that users may have no idea what they are.
Personally I would either
a) write it as a CSV file, which would be viewable by Excel and other spreadsheet software. You could also use Greek2Me's CSV reader to read it back into game
or b) write it plain text you like are, but couple it with an in-game viewer add-on
« Last Edit: January 08, 2015, 08:34:53 AM by Headcrab Zombie »

I didn't know if I put enough arguments down there.

Edit:
Sorry was busy working on other stuffs.
Link to the thing.
This isn't gonna check if the person is admin or if it even passes through any of the checks, it's just going to log whatever you type after /ban.

and two numbers I'm not entirely sure what they are (I assume time related)
Unban year and unban minute-of-year.

You might consider packaging BanManagerSO::addBan(%this, %adminID, %victimID, %victimBL_ID, %reason, %banTime) instead. Would work for bans added in other ways as well and saves you the trouble of checking if the ban went through. Depending on how it's called, the admin or the victim IDs may not exist, so test for that before calling getPlayerName and getBLID on them.

There was Server_Logwriter, wasn't there?