using Plus.Database.Interfaces;
using Plus.HabboHotel.GameClients;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator
{
public class RankCommand : IChatCommand
{
public string PermissionRequired
{
get { return "command_rank"; }
}
public string Parameters
{
get { return "%username% %rank%"; }
}
public string Description
{
get { return ""; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
if (Params.Length != 2)
{
Session.SendWhisper(":rank %username% %rank%");
return;
}
GameClient Target = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
if (Target == null)
{
Session.SendWhisper("Oops, couldn't find that user!");
return;
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("UPDATE `users` SET `rank`=@rank WHERE `id` = '" + Target.GetHabbo().Id + "' LIMIT 1");
dbClient.AddParameter("rank", Params[2]);
dbClient.RunQuery();
}
Target.GetHabbo().Rank = Convert.ToInt32(Params[2]);
Session.SendWhisper("Successfully set "+Target.GetHabbo().Username+"'s rank to: "+Params[2]);
}
}
}
Use visual studio to edit the emulator add rank command class and then register it in commandmanagerhow do i add this
There is many tutorials on how to use visual studio.Can you explain how if possible - I'm a noob haha
so i done this and when i do ;rank x they just repeated the same msgCode:using Plus.Database.Interfaces; using Plus.HabboHotel.GameClients; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator { public class RankCommand : IChatCommand { public string PermissionRequired { get { return "command_rank"; } } public string Parameters { get { return "%username% %rank%"; } } public string Description { get { return ""; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length != 2) { Session.SendWhisper(":rank %username% %rank%"); return; } GameClient Target = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (Target == null) { Session.SendWhisper("Oops, couldn't find that user!"); return; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `rank`=@rank WHERE `id` = '" + Target.GetHabbo().Id + "' LIMIT 1"); dbClient.AddParameter("rank", Params[2]); dbClient.RunQuery(); } Target.GetHabbo().Rank = Convert.ToInt32(Params[2]); Session.SendWhisper("Successfully set "+Target.GetHabbo().Username+"'s rank to: "+Params[2]); } } }