Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
[fixed]Ban command
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="mark1234" data-source="post: 377652" data-attributes="member: 61921"><p>Hello people. i have a question you know in plusemu you have a ban command like this: :ban %username% %length% %reason% but what i want is that the %lengt% automatic is 24H so you only need to fill :ban %username% %reason% for the one who need it i put the command beneeth here:</p><p></p><p></p><p>[CODE]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p></p><p>using Plus.Utilities;</p><p>using Plus.HabboHotel.Users;</p><p>using Plus.HabboHotel.GameClients;</p><p></p><p></p><p>using Plus.HabboHotel.Moderation;</p><p></p><p>using Plus.Database.Interfaces;</p><p></p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator</p><p>{</p><p> class BanCommand : IChatCommand</p><p> {</p><p></p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_ban"; }</p><p> }</p><p></p><p> public string Parameters</p><p> {</p><p> get { return "%username% %length% %reason% "; }</p><p> }</p><p></p><p> public string Description</p><p> {</p><p> get { return "Ban a player."; ; }</p><p> }</p><p></p><p> public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</p><p> {</p><p> if (Params.Length == 1)</p><p> {</p><p> Session.SendWhisper("dont forget the username ;).");</p><p> return;</p><p> }</p><p></p><p> Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]);</p><p> if (Habbo == null)</p><p> {</p><p> Session.SendWhisper("cant find that user in database.");</p><p> return;</p><p> }</p><p></p><p> if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))</p><p> {</p><p> Session.SendWhisper("Oops, cant ban this user :).");</p><p> return;</p><p> }</p><p></p><p> Double Expire = 0;</p><p> string Hours = Params[2];</p><p> if (String.IsNullOrEmpty(Hours) || Hours == "perm")</p><p> Expire = PlusEnvironment.GetUnixTimestamp() + 78892200;</p><p> else</p><p> Expire = (PlusEnvironment.GetUnixTimestamp() + (Convert.ToDouble(Hours) * 3600));</p><p></p><p> string Reason = null;</p><p> if (Params.Length >= 4)</p><p> Reason = CommandManager.MergeParams(Params, 3);</p><p> else</p><p> Reason = "er is geen reden ingevoerd.";</p><p></p><p> string Username = Habbo.Username;</p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");</p><p> }</p><p></p><p> PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire);</p><p></p><p> GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Username);</p><p> if (TargetClient != null)</p><p> TargetClient.Disconnect();</p><p></p><p> Session.SendWhisper("Je hebt '" + Username + "' gebant voor " + Hours + " uur met de reden '" + Reason + "'!");</p><p> }</p><p> }</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="mark1234, post: 377652, member: 61921"] Hello people. i have a question you know in plusemu you have a ban command like this: :ban %username% %length% %reason% but what i want is that the %lengt% automatic is 24H so you only need to fill :ban %username% %reason% for the one who need it i put the command beneeth here: [CODE]using System; using System.Linq; using System.Text; using System.Collections.Generic; using Plus.Utilities; using Plus.HabboHotel.Users; using Plus.HabboHotel.GameClients; using Plus.HabboHotel.Moderation; using Plus.Database.Interfaces; namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator { class BanCommand : IChatCommand { public string PermissionRequired { get { return "command_ban"; } } public string Parameters { get { return "%username% %length% %reason% "; } } public string Description { get { return "Ban a player."; ; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("dont forget the username ;)."); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("cant find that user in database."); return; } if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Oops, cant ban this user :)."); return; } Double Expire = 0; string Hours = Params[2]; if (String.IsNullOrEmpty(Hours) || Hours == "perm") Expire = PlusEnvironment.GetUnixTimestamp() + 78892200; else Expire = (PlusEnvironment.GetUnixTimestamp() + (Convert.ToDouble(Hours) * 3600)); string Reason = null; if (Params.Length >= 4) Reason = CommandManager.MergeParams(Params, 3); else Reason = "er is geen reden ingevoerd."; string Username = Habbo.Username; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); } PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) TargetClient.Disconnect(); Session.SendWhisper("Je hebt '" + Username + "' gebant voor " + Hours + " uur met de reden '" + Reason + "'!"); } } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
[fixed]Ban command
Top