Ban command with GUI
#1

Does anyone have or could make a /ban command that works like this: you write /ban player and then a GUI menu pops out and you have to choose a reason, for example: Cheating, Advertising and so on. When you choose a reason, that player gets banned and everyone sees a message Admin x has banned player for choosen reason.
Reply
#2

Wrong topic for a request, post it in the sticky "Script Request Thread"
Reply
#3

Noone will see it there, there are too many posts in there. I need this so the administrators wouldn't use stupid reasons
Reply
#4

Quote:
Originally Posted by Moron
Посмотреть сообщение
I need this so the administrators wouldn't use stupid reasons
Fix: Get better admins
Reply
#5

Quote:
Originally Posted by Moron
Посмотреть сообщение
Noone will see it there, there are too many posts in there.
What has the post count to do with that ?

Quote:
Originally Posted by Moron
Посмотреть сообщение
I need this so the administrators wouldn't use stupid reasons
wouldnt use stupid reasons for what ?

And there are tons of /ban commands released in admin scripts, the part with the dialog isnt hard neither
Reply
#6

.... Wrong thread
Reply
#7

BUMP
Reply
#8

Quote:
Originally Posted by Moron
Посмотреть сообщение
Does anyone have or could make a /ban command that works like this: you write /ban player and then a GUI menu pops out and you have to choose a reason, for example: Cheating, Advertising and so on. When you choose a reason, that player gets banned and everyone sees a message Admin x has banned player for choosen reason.
Under OnPlayerCommandText, if you use strcmp:
pawn Код:
if (!strcmp(cmdtext, "/ban", true, 4))
{
  if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xff0000ff, "* You are probably retarded, this is an admin only command");
  if (!cmdtext[4]) return SendClientMessage(playerid, 0xff0000ff, "* Usage: /ban [playerid]");
  new targetid = strval(cmdtext[5]);
  if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xff0000ff, "* Error: player not connected");
  SetPVarInt(playerid, "banP", targetid);
  new name[MAX_PLAYER_NAME], dialogtitle[] = "Why ban 12345678901234567890?";
  GetPlayerName(playerid, name, sizeof(name));
  format(dialogtitle, sizeof(dialogtitle), "Why ban %s?", name);
  ShowPlayerDialog(playerid, 20081, 2, dialogtitle, "Cheating\r\nSpamming\r\nFlooding\r\nTrolling\r\nAdvertising\r\nBad language\r\nCustom reason..", "Ban", "Cancel");
  return 1;
}
Your OnDialogResponse:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  new name1[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], msg[92], targetid = GetPVarInt(playerid, "banP");
  if (dialogid == 20081)
  {
    if (!response) return 1;
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xff0000ff, "* The player has just disconnected before you banned him!");
    GetPlayerName(playerid, name1, sizeof(name1));
    GetPlayerName(targetid, name2,  sizeof(name2));
    switch (listitem)
    {
      case 0: // Cheat
      {
        format(msg, sizeof(msg), "* %s has been banned by %s for cheating.", name2, name1);
        SendClientMessageToAll(0xffff00cc, msg);
        BanEx(targetid, "Dialog BAN - cheating");
      }
      case 1: // SPAM
      {
        format(msg, sizeof(msg), "* %s has been banned by %s for spamming.", name2, name1);
        SendClientMessageToAll(0xffff00cc, msg);
        BanEx(targetid, "Dialog BAN - spamming");
      }
      case 2: // Flood
      {
        format(msg, sizeof(msg), "* %s has been banned by %s for flooding.", name2, name1);
        SendClientMessageToAll(0xffff00cc, msg);
        BanEx(targetid, "Dialog BAN - flooding");
      }
      case 3: // Is a troll :P
      {
        format(msg, sizeof(msg), "* %s has been banned by %s for being a troll.", name2, name1);
        SendClientMessageToAll(0xffff00cc, msg);
        BanEx(targetid, "Dialog BAN - troll!");
      }
      case 4: // Advertising
      {
        format(msg, sizeof(msg), "* %s has been banned by %s for advertising.", name2, name1);
        SendClientMessageToAll(0xffff00cc, msg);
        BanEx(targetid, "Dialog BAN - advertising");
      }
      case 5: // Bad language
      {
        format(msg, sizeof(msg), "* %s has been banned by %s for using swear words.", name2, name1);
        SendClientMessageToAll(0xffff00cc, msg);
        BanEx(targetid, "Dialog BAN - bad language");
      }
      case 6: // Custom reason
      {
        return ShowPlayerDialog(playerid, 20082, 1, "Enter custom reason for banning", "Why do you want to ban that player?", "Ban", "Cancel");
      }
    }
    return 1;
  }
  else if (dialogid == 20082)
  {
    if (!response) return 1;
    if (!IsPlayerConnected(targetid) return SendClientMessage(playerid, 0xff0000ff, "* The player has just disconnected before you banned him!");
    if (!inputtext[0]) return SendClientMessage(playerid, 0xff0000ff, "* You must type a reason for banning!");
    format(msg, sizeof(msg), "* %s has been banned by %s (%s)", name2, name1, inputtext);
    SendClientMessageToAll(0xffff00cc, msg);
    format(msg, sizeof(msg), "Dialog BAN - %s", inputtext);
    BanEx(targetid, msg);
    return 1;
  }
}
Should work.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)