Author Topic: Administrative action log writer V3  (Read 6129 times)

LogWriter
This add-on will log all chat, demotions. promotions, WHIS(IGSO), bans, and unbans

Description
This is my first add-on(released however)!

SORRY ACCIDENTALLY WENT TO V3

Changelog:


2

Logs log-ons and log-offs
Revised servercmdRTB_AdminPlayer() according to Ephialtes
Optimized help file according to Ephialtes
Now logs it when you make people super-admin(woops forgot!)

4

Syntax error, needed to update. I'm an idiot.

----------------------

The point of logging bans and unbans is that it logs the time unlike the ban menu.

For bans, you can catch all those expired bans in case of abuse.

Unbans are a little different, I can't log the name because it doesn't work that way. A name is cleared from the unban list by the position in the list, so I can't retrieve the name but the time is important enough.

Download
Script_LogWriters.zip (Last Updated: Thu Mar 12, 2009 2:47 pm)

Installation
Put Script_LogWriters.zip into the Add-Ons folder in your Blockland folder.

Click Here to view this file on the RTB Download Manager
« Last Edit: March 12, 2009, 03:49:01 PM by Kalphiter »


Good
I still have some work to do such as adding to auto-admin list and demoting/promoting for IGSO(only logs for RTB so far)

I still have some work to do such as adding to auto-admin list and demoting/promoting for IGSO(only logs for RTB so far)
will help me alot though
« Last Edit: March 08, 2009, 09:48:51 AM by Haylord »

Thankyou. Does it log server entering and leaving aswell?

Good idea, keep it coming.

Log the IP's .
Pretty useful for me, since I get dissconnected for a reason I can't tell.
« Last Edit: March 07, 2009, 04:54:05 PM by Haylord »

That's written exceptionally badly...

If only it logged IDs I take it.

That's written exceptionally badly...
Why is it "written" bad. The only part written bad is thing that adds the help file.

Code: [Select]
writeToFileLine(%location, %crap);
writeToFileLine(%location);
writeToFileLine(%location, "Ban logs");
writeToFileLine(%location, "Date, banner's name, banner's ID, banned's name, banned's ID, amount of time, reason");
writeToFileLine(%location);
writeToFileLine(%location, "Unban logs");
writeToFileLine(%location, "Date, unbanner's name, unbanner's ID, unbanner's position in list");
writeToFileLine(%location);
writeToFileLine(%location, "Chat logs");
writeToFileLine(%location, "Date, name, ID, message");
writeToFileLine(%location);
writeToFileLine(%location, "Status logs(demotion and promotion)");
writeToFileLine(%location, "Date, Person who did it, who did it's ID, action, opposing name, opposing ID");
writeToFileLine(%location, "Actions: N means normal, S means super admin, A means admin");
writeToFileLine(%location);
writeToFileLine(%location, "Whis logs(only if you have IGSO)");
writeToFileLine(%location, "Date, client's ID, target's name, target's ID, message");

You're creating, opening, closing and deleting a file object and file 16 times in a row.

Code: [Select]
    function servercmdRTB_AdminPlayer(%client,%victim)
    {

if(!%client.isSuperAdmin)
{
    parent::servercmdRTB_AdminPlayer(%client,%victim);
    return;
}

if(%victim.isAdmin)
    return;

if(!%victim.name) //don't log if person was not found
{
    parent::servercmdRTB_AdminPlayer(%client,%victim);
    return;
}
%string1 = "";
%string2 = "";

if(%victim.isSuperAdmin)
    %string1 = "S";

%string2 = "A";

%stringFINAL = %string1 @"-"@ %string2;

//Date, Person who did it, who did it's ID, action, opposing name, opposing ID
writeToFileLine($LOGWrite::statusPath, addTime() TAB %client.name TAB %client.bl_id TAB %stringFINAL TAB %victim.name TAB %victim.bl_id);
parent::servercmdRTB_AdminPlayer(%client,%victim);
    }

That is just a total mess, you're even randomly creating empty variables, And it can be totally replaced with this:

Code: [Select]
function servercmdRTB_AdminPlayer(%client,%victim)
{
%oldMask = %victim.isAdmin @ %victim.isSuperAdmin;
Parent::serverCmdRTB_AdminPlayer(%client,%victim);
%newMask = %victim.isAdmin @ %victim.isSuperAdmin;

if(%newMask !$= %oldMask)
{
writeToFileLine($LOGWrite::statusPath, addTime() TAB %client.name TAB %client.bl_id TAB (%victim.isAdmin) ? "A" : "" @ "-" @ (%victim.isSuperAdmin) ? "S" : "" TAB %victim.name TAB %victim.bl_id);
}
}

And that way it wont break RTB if i decide to change how RTB permissions work in the future. Overall its just a mess.
« Last Edit: March 07, 2009, 06:20:31 PM by Ephialtes »

Yes, the shorthand if-else is in the back of my mind, I always forget it.

No its not just that, you're re-writing (and overwriting) a bunch of RTB logic when you don't even need to.

Will you also approve it if I fix what you said?

The random blank variable things is that I was worried about the scope.

Do I have to worry about the scope, or is the variable available to the whole function?

% is a local variable and only exists until the function has been run and then its destroyed and cannot be accessed.

And yeah, I'll approve it if you fix those.