Feature #378

Custom ban reason directly from server

Added by Adam 'HiJacker' Lucansky 99 days ago. Updated 23 days ago.

Status:Resolved Start:09/28/2008
Priority:Normal Due date:
Assigned to:Jannik Hartung % Done:

100%

Category:Game Plugin
Target version:1.4.0

Description

When admin choose player to ban , then for how long, and in Reason , there will be Own Reason , When admin press it, In chat will appear : Type ban reason into chat , Admin open chat, and type reason of ban , and person will be banned.

This feature was first used on AMX Bans And Mani Admin Plugin , in feature "Adding admins in-game" , where you can choose clients name/group name by typing name into chat, not console

Associated revisions

Revision 180
Added by Jannik Hartung 23 days ago

  • Added #378 - Custom ban reasons from chat input. (Replaced "Team Stacking" with "Own Reason" in the reason menu)
  • Removes temporary 5 minutes ban from server when unbanning or deleting a ban from webpanel
  • Added german translation phrases to the plugin

History

Updated by Erik Minekus 99 days ago

I thought this wasn't possible in the Source Engine, but I guess if Mani can do it too. We'll have to talk to BAILOPAN to see if he can implement this into SourceMod.

Updated by Recon _ 99 days ago

That's pretty slick.

Does the chat box auto open? Either way, I'm guessing it sends a message to the client saying send the reason in all chat and then waits for their next message.

Opening the chat box could be trivial. The key people press to open the chat box is probably bound to a console command. If we can find that command, we can probably run it with ClientCommand(). Since admins can bind people's keys with cexec, I think we should be able to run the command.

Sending a message and then waiting for the next message the admin sends and using that as the reason is pretty trivial.

Here's the code:


// Global array
new Handle:ownReasonPacks[MAXPLAYERS] = {INVALID_HANDLE, ...};

// Hook the say console command in OnPluginStart
RegConsoleCmd("say", ClientChat, "Sends a chat message.");

// We have entered the reason menu handler ********************

// client is the admin
// target is the person to ban
// length is the length of the ban

// If the admin is using the own reason option
if (param2 == "ownreason")
{
   // Pack up ban data (client to ban, time to ban for)
   new Handle:pack = CreateDataPack();   
   WritePackCell(pack, target);
   WritePackCell(pack, length);
   ResetPack(pack);

   // Store the datapack
   ownReasonPacks[client] = pack;

   PrintToChat(client, "Please type the reason in all chat and press enter.");

   // If there is some command to open the chat box, this would be the time to exec it
}

// We have left the reason menu handler ********************

public Action:ClientChat(client, args)
{
   // Is this user preparing to ban someone
   if (ownReasonPacks[client] != INVALID_HANDLE)
   {
       // Get the reason
       decl String:reason[256];
       GetCmdArgString(reason, sizeof(reason));

       // Yes they are, get the ban details
       new target = ReadPackCell(ownReasonsPacks[client]);
       new length = ReadPackCell(ownReasonPacks[client]);

       // I would hope this sets the handle == INVALID_HANDLE, 
       // if not, add a line to do that after the next line
       CloseHandle(ownReasonPacks[client]);

       // Ban the user (just an example)
       SBBanClient(client, target, length, message);

       // Block the reason from being sent out over text chat
       return Plugin_Handled;
   }

   return Plugin_Continue;
}

Updated by Erik Minekus 96 days ago

Nope. Y is bound to "say", U is bound to "say_team". Both are commands that you can't run on the client as Valve blocked them.

Updated by Recon _ 96 days ago

You can run both commands on the client. I have done it myself.

Updated by Adam 'HiJacker' Lucansky 96 days ago

So .. is it possible to try integrate it with SB ? Thx. for answer.

Updated by Jannik Hartung 78 days ago

  • Target version set to 1.4.0

i think this is easily implemented.. Even I would be able to do this;)

Updated by Lane Babuder 28 days ago

  • Status changed from New to Assigned
  • Assigned to set to Jannik Hartung

Then feel free, it's been assigned to you :p

Updated by Jannik Hartung 23 days ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

added in r180

need the polish translation of the new phrase;)

Also available in: Atom PDF