Admin Message

Author Topic: Admin Message  (Read 1584 times)

No, I'm not asking for another admin chat. I think it would be cool to have a mod that allows players to type /admin [message], which would display a blue/yellow/[something that stands out] message from the player to all the admins on the server. This would be good for reporting things to moderators, and could conveniently double as an admin chat. The only way this would be able to be abused is by spamming, but I think that it would be fixed if you put the "[player's name]:" before the message. I mean, if you have the balls to spam the server moderators directly, you deserve to be able to.

This would allow you to report things to admins directly while not letting regular players see what you are reporting. Also, it would catch the admins' attentions, especially if the server is very chat-heavy.

/support

ot:

i remember this time when i got so mad at someone on mc that is wanted to report him to a mod for i guess taunting me, but i failed the command and got embarresed.

They have this on SS13. It is the single best moderation utility I've ever seen, and I'm utterly amazed there is no /report command.

They have this on SS13. It is the single best moderation utility I've ever seen, and I'm utterly amazed there is no /report command.
Link?

Hmm. I might try to make this. Here is some ideas I would add too: Timeouts (So they can't spam it), you can ban them from using the command for any reason, and they could send it to only super admins

Hmm. I might try to make this. Here is some ideas I would add too: Timeouts (So they can't spam it), you can ban them from using the command for any reason, and they could send it to only super admins
Like /report and /admin for admin and up, /sadmin, /superadmin, and /SA for super admin and up, and /host for the host? Or maybe /report could be with moderators if you want to support that script.

I guess it would be good to have different levels of reporting if badmins are a concern, and to have a lot if commands if you want it to be easy to figure out.

It would be good to have something like ""[message]" has been sent to the [moderators/admins/super admins/host" for the sender so they don't think they typed the command wrong.
« Last Edit: March 25, 2014, 09:24:26 PM by Who Cares99 »

Oh I made this exact thing or my server.

Oh I made this exact thing or my server.
Feeling generous?

I could maybe make this tom, I ran out of time for this tonight




Code: [Select]
function servercmdreport(%client, %c1, %c2, %c3, %c4, %c5, %c6, %c7, %c8, %c9, %c10, %c11, %c12, %c13, %c14, %c15, %c16, %c17, %c18, %c19, %c20)
{
%text="";
for(%j=1;%j<=20;%j++)
{
%text = %text SPC %c[%j];
}
messageclient(%client,'',"\c5You reported\c4:"@%text);

for(%i=0;%i<clientGroup.getcount();%i++)
{
%b=clientgroup.getobject(%i);
if(%b.isAdmin)
{
messageclient(%b,'',"\c5"@%client.name@" reports\c4:"@%text);
}
}
}

https://www.dropbox.com/s/k1rbnotec6a2fki/Server_Report.zip

Alternatively:

Code: [Select]
function servercmdReport(%cl, %t0, %t1, %t2, %t3, %t4, %t5, %t6, %t7, %t8, %t9, %t10, %t11, %t12, %t13, %t14, %t15, %t16, %t17, %t18, %t19)
{
    for(%i=0;%i<20;%i++) %text = %text SPC %t[%i];
    while((%temp = stripMLControlChars(%text)) !$= %text) %text = %temp;
    %text = trim(%text);
    messageClient(%cl, '', "\c5You reported\c4: "@%text);
    %count = ClientGroup.getCount();
    for(%i=0;%i<%count;%i++)
    {
        %this = ClientGroup.getObject(%i);
        if(%this == %cl) continue;
        if(%this.isAdmin || %this.isSuperAdmin)
            messageClient(%this, '', "\c5"@%cl.name@" reports\c4: "@%text);
    }
}

Strips control tags to keep starfishs from doing /report <just:right>forget THE ADMINS! LOL. and also only shows the sender the message once, even if they are admin themselves. Also checks against isSuperAdmin as well as isAdmin.

Code: [Select]
function servercmdreport(%client, %c1, %c2, %c3, %c4, %c5, %c6, %c7, %c8, %c9, %c10, %c11, %c12, %c13, %c14, %c15, %c16, %c17, %c18, %c19, %c20)
{
%text="";
for(%j=1;%j<=20;%j++)
{
%text = %text SPC %c[%j];
}
messageclient(%client,'',"\c5You reported\c4:"@%text);

for(%i=0;%i<clientGroup.getcount();%i++)
{
%b=clientgroup.getobject(%i);
if(%b.isAdmin)
{
messageclient(%b,'',"\c5"@%client.name@" reports\c4:"@%text);
}
}
}

https://www.dropbox.com/s/k1rbnotec6a2fki/Server_Report.zip
[/quote]

Add a write to file function so that reports can be logged. In case the only admin online is the badmin.

Code: [Select]
function writeToFile(%name, %content)
{
if(%name $= "")
{
messageClient(%client,'',"\c6[\c3WtF\c6]: Useage /writeToFile filename.cs 'content' ");
}
else
{
%outFileHandle = new FileObject() ;

%outFileHandle.openForAppend(%name) ;

%outFileHandle.writeLine(%content) ;

%outFileHandle.close() ;

}}

function readFromFile(%filename)
{
if(%filename $= "")
{messageClient(%client,'',"No filename defined");}
%inFileHandle = new FileObject() ;

%inFileHandle.openForRead(%filename) ;

while(!%inFileHandle.IsEOF())
{
%inLine = %inFileHandle.readLine() ;

                // output read text to console.
echo(%inLine) ;
}

%inFileHandle.close() ;

}

Code: [Select]
function writeToFile(%name, %content)
{
if(%name $= "")
{
messageClient(%client,'',"\c6[\c3WtF\c6]: Useage /writeToFile filename.cs 'content' ");
}
else
{
%outFileHandle = new FileObject() ;

%outFileHandle.openForAppend(%name) ;

%outFileHandle.writeLine(%content) ;

%outFileHandle.close() ;

}}

function readFromFile(%filename)
{
if(%filename $= "")
{messageClient(%client,'',"No filename defined");}
%inFileHandle = new FileObject() ;

%inFileHandle.openForRead(%filename) ;

while(!%inFileHandle.IsEOF())
{
%inLine = %inFileHandle.readLine() ;

                // output read text to console.
echo(%inLine) ;
}

%inFileHandle.close() ;

}

First of all, where is %client defined. You have syntax errors as well. Look at your codes before giving them out.

Also in your codes, for statements like if, if there is only one item, you don't really need brackets.



Here is some useful code.


if(!strLen($Pref::Server::ReportTimeoutMS))
   $Pref::Server::ReportTimeoutMS = 3000; //3 second timeout I guess

//Thanks for Xalos
function servercmdReport(%cl, %t0, %t1, %t2, %t3, %t4, %t5, %t6, %t7, %t8, %t9, %t10, %t11, %t12, %t13, %t14, %t15, %t16, %t17, %t18, %t19)
{
   if(getSimTime() - %cl.lastReport > $Pref::Server::ReportTimeoutMS)
      return messageClient(%cl, '', "\c3You are reporting too fast!");
    for(%i=0;%i<20;%i++) %text = %text SPC %t[%i];
    while((%temp = stripMLControlChars(%text)) !$= %text) %text = %temp;
    %text = trim(%text);
    messageClient(%cl, '', "\c5You reported\c4: "@%text);
    %count = ClientGroup.getCount();
    for(%i=0;%i<%count;%i++)
    {
        %this = ClientGroup.getObject(%i);
        if(%this == %cl) continue;
        if(%this.isAdmin || %this.isSuperAdmin)
            messageClient(%this, '', "\c5 " @ %cl.name @ " reports\c4: "@ %text);
    }
    %cl.lastReport = getSimTime();
    %cl.WriteLog("Reports.txt",%text);
}
//END

function serverCmdReportTimeout(%this,%time)
{
   if(!%this.isSuperAdmin)
      return;
   %time = mFloor(%time);
   if(%time < 1)
      return messageClient(%this, '', "\c3Timeout shouldn't be less than 0 seconds.");
   $Pref::Server::ReportTimeoutMS = %time;
   messageClient(%this, '', "\c3Timeout is now set at " @ %time/1000 @ " seconds.");
}

function GameConnection::WriteLog(%this,%file,%line)
{
   if(!isObject(%this)) return;
   %file = "config/server/Logs/" @ %this.getBLID() @ "(" @ %this.name @ ")/" @ %file;
   //Ex. "config/server/Logs/20490 (Visolator)/Reports.txt"
   %FO = new FileObject();
   %FO.openForAppend(%file);
   %FO.writeLine(%line);
   %FO.close();
   %FO.delete();
}


Created an add-on for it. http://forum.blockland.us/index.php?topic=255433.0
« Last Edit: April 06, 2014, 02:10:54 AM by Advanced Bot »