Marko97
M97 Project based Plus EMU
- Aug 7, 2013
- 99
- 45
Hello!
I've remade the mimic command to work also the target user is offline.
Go in the class MimicCommand.cs and replace all with:
Credits:
Creator of this class for the command, me for remade the command.
I've remade the mimic command to work also the target user is offline.
Go in the class MimicCommand.cs and replace all with:
Code:
using System;
using Plus.Communication.Packets.Outgoing.Rooms.Engine;
using Plus.Database.Interfaces;
using Plus.Communication.Packets.Outgoing.Rooms.Avatar;
using System.Data;
namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
{
class MimicCommand : IChatCommand
{
public string PermissionRequired
{
get { return "command_mimic"; }
}
public string Parameters
{
get { return "%utente%"; }
}
public string Description
{
get { return "Copia il look dell'utente."; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
if (Params.Length == 1)
{
Session.SendWhisper("Choose the user which you want copy the look.", 34);
return;
}
DataRow UserData = null;
string Username = Params[1];
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("SELECT `look`,`gender`,`allow_mimic` FROM users WHERE `username` = @Username LIMIT 1");
dbClient.AddParameter("Username", Username);
UserData = dbClient.GetRow();
}
if (UserData == null)
{
Session.SendWhisper("User not exists.", 34);
return;
}
var TargetAllowMimic = Convert.ToInt32(UserData["allow_mimic"]);
var TargetGender = Convert.ToString(UserData["gender"]);
var TargetLook = Convert.ToString(UserData["look"]);
if (TargetAllowMimic == 0)
{
Session.SendWhisper("You can't copy this look because the target user doesn't authorize it.", 34);
return;
}
Session.GetHabbo().Gender = TargetGender;
Session.GetHabbo().Look = TargetLook;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("UPDATE `users` SET `gender` = @gender, `look` = @look WHERE `id` = @id LIMIT 1");
dbClient.AddParameter("gender", TargetGender);
dbClient.AddParameter("look", TargetLook);
dbClient.AddParameter("id", Session.GetHabbo().Id);
dbClient.RunQuery();
}
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User != null)
{
Session.SendPacket(new AvatarAspectUpdateComposer(Session.GetHabbo().Look, Session.GetHabbo().Gender));
Session.SendPacket(new UserChangeComposer(User, true));
Room.SendPacket(new UserChangeComposer(User, false));
}
}
}
}
Credits:
Creator of this class for the command, me for remade the command.