MasterJiq
Member
- Jul 8, 2016
- 385
- 23
Hello,
I would to release my second one command edit with Plus Emulator, just playing around with it.
So here is the code, it would be 'AddWordfilter.cs' or whatever do you want.
Thanks.
I would to release my second one command edit with Plus Emulator, just playing around with it.
So here is the code, it would be 'AddWordfilter.cs' or whatever do you want.
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.Communication.Packets.Outgoing.Catalog;
using Plus.Core;
using Plus.Database.Interfaces;
using Plus.Communication.Packets.Outgoing.Notifications;
using Plus.HabboHotel.GameClients;
namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator
{
class AddWordFilter: IChatCommand
{
public string PermissionRequired
{
get { return "command_update"; }
}
public string Parameters
{
get { return "%variable%"; }
}
public string Description
{
get { return "Add a restricted word"; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
if (!Session.GetHabbo().GetPermissions().HasCommand("command_update"))
{
Session.SendWhisper("Oops, you do not have the permission.");
}
if (Params.Length == 1)
{
Session.SendWhisper("Put the word to be blacklist.");
return;
}
string word = Params[1];
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("INSERT INTO `wordfilter` (word, replacement, strict, addedby, bannable) VALUES (@word, @replace, '1', @username, '0');");
dbClient.AddParameter("word", word);
dbClient.AddParameter("replace", "censored");
dbClient.AddParameter("username", Session.GetHabbo().Username);
dbClient.RunQuery();
Session.SendWhisper("Added the word, please use :update filter to make the system worked.");
}
}
}
}
Thanks.