Hotel or RP command service

Status
Not open for further replies.

Seriosk

Programmer;
Oct 29, 2016
256
105
Hello, I have decided to start a command coding service for anyone on devbest. It seems that a lot of people are starting to do roleplay emulators and might struggle coding certain features or commands, so thats mainly why I included the roleplay commands in here also..
Anyway...

Emulators Supported:

  • Azure
  • Plus
  • Phoenix
  • Mango
Information Required:
  • Command Name (ie: :commandname)
  • What the command does

I can also add delays, cool downs, or extra features to the command if you would like that, anyway leave a comment below of what commands you want and I'll code them for you.
 
Last edited:

Seriosk

Programmer;
Oct 29, 2016
256
105
@Leader not many people use it and I believe it has missing features? (teles and something else) but okay I'll add it to my list...
 

xxfanywe

Member
Mar 25, 2015
40
3
emu plus command :shoot i want it for hotel but users can use the shoot command aswell so their health goes down and stuff thanks! c:
 

Seriosk

Programmer;
Oct 29, 2016
256
105
emu plus command :shoot i want it for hotel but users can use the shoot command aswell so their health goes down and stuff thanks! c:

I'm guessing you'll want a health system as well then? I'll code it like an RP system then I guess.
Just let me know what you want to happen when their health hits 0..
 

xxfanywe

Member
Mar 25, 2015
40
3
I'm guessing you'll want a health system as well then? I'll code it like an RP system then I guess.
Just let me know what you want to happen when their health hits 0..

dont worry about when there health hits 0 ill make it so it just reloads the room for them thanks
 

Seriosk

Programmer;
Oct 29, 2016
256
105
Sorry it took so long, had things planned that couldn't be re-arranged, anyways here it is:p

So first, your going to want to implement the health system...
  • Go to /HabboHotel/Users/Habbo.cs
  • Find public bool SessionClothingBlocked
  • Underneath that, add this code below
Code:
public int Health
        {
            get { return this._health; }
            set { this._health = value; }
        }

At this point you'll have 2 errors because you haven't implemented the _health field, so to do that find private IChatCommand _iChatCommand; and undearneath it, add this code
Code:
private int _health;

Now, you will need to read this from the database so, you want to find this big chunck of coding below (Yours may vary but will be pretty much the same)
Code:
public Habbo(int Id, string Username, int Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int HomeRoom,
            bool HasFriendRequestsDisabled, int LastOnline, bool AppearOffline, bool HideInRoom, double CreateDate, int Diamonds,
            string machineID, string clientVolume, bool ChatPreference, bool FocusPreference, bool PetsMuted, bool BotsMuted, bool AdvertisingReportBlocked, double LastNameChange,
            int GOTWPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, int VIPRank)

All you want to do is after the last parameter, add this code
Code:
int Health

So
Code:
public Habbo(int Id, string Username, int Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int HomeRoom,
            bool HasFriendRequestsDisabled, int LastOnline, bool AppearOffline, bool HideInRoom, double CreateDate, int Diamonds,
            string machineID, string clientVolume, bool ChatPreference, bool FocusPreference, bool PetsMuted, bool BotsMuted, bool AdvertisingReportBlocked, double LastNameChange,
            int GOTWPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, int VIPRank)
Becomes
Code:
public Habbo(int Id, string Username, int Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int HomeRoom,
            bool HasFriendRequestsDisabled, int LastOnline, bool AppearOffline, bool HideInRoom, double CreateDate, int Diamonds,
            string machineID, string clientVolume, bool ChatPreference, bool FocusPreference, bool PetsMuted, bool BotsMuted, bool AdvertisingReportBlocked, double LastNameChange,
            int GOTWPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, int VIPRank, int Health)

Now, we're almost there, stick with me... now find this code
Code:
this.UsersRooms = new List<RoomData>();
and undearneath it, add this
Code:
this._health = Health;

One last step, we need to pass the parameter to the Habbo constructor, so find the file /HabboHotel/Users/Authenticator/Authenticator.cs
In this file you'll see something like this..
Code:
return new Habbo(Convert.ToInt32(Row["id"]), Convert.ToString(Row["username"]), Convert.ToInt32(Row["rank"]), Convert.ToString(Row["motto"]), Convert.ToString(Row["look"]),
                Convert.ToString(Row["gender"]), Convert.ToInt32(Row["credits"]), Convert.ToInt32(Row["activity_points"]),
                Convert.ToInt32(Row["home_room"]), PlusEnvironment.EnumToBool(Row["block_newfriends"].ToString()), Convert.ToInt32(Row["last_online"]),
                PlusEnvironment.EnumToBool(Row["hide_online"].ToString()), PlusEnvironment.EnumToBool(Row["hide_inroom"].ToString()),
                Convert.ToDouble(Row["account_created"]), Convert.ToInt32(Row["vip_points"]),Convert.ToString(Row["machine_id"]), Convert.ToString(Row["volume"]),
                PlusEnvironment.EnumToBool(Row["chat_preference"].ToString()), PlusEnvironment.EnumToBool(Row["focus_preference"].ToString()), PlusEnvironment.EnumToBool(Row["pets_muted"].ToString()), PlusEnvironment.EnumToBool(Row["bots_muted"].ToString()),
                PlusEnvironment.EnumToBool(Row["advertising_report_blocked"].ToString()), Convert.ToDouble(Row["last_change"].ToString()), Convert.ToInt32(Row["gotw_points"]),
                PlusEnvironment.EnumToBool(Convert.ToString(Row["ignore_invites"])), Convert.ToDouble(Row["time_muted"]), Convert.ToDouble(UserInfo["trading_locked"]),
                PlusEnvironment.EnumToBool(Row["allow_gifts"].ToString()), Convert.ToInt32(Row["friend_bar_state"]),  PlusEnvironment.EnumToBool(Row["disable_forced_effects"].ToString()),
                PlusEnvironment.EnumToBool(Row["allow_mimic"].ToString()), Convert.ToInt32(Row["rank_vip"]));

Now all you want to do is add this code to the end before );
Code:
Convert.ToInt32(Row["health"])

So this code
Code:
return new Habbo(Convert.ToInt32(Row["id"]), Convert.ToString(Row["username"]), Convert.ToInt32(Row["rank"]), Convert.ToString(Row["motto"]), Convert.ToString(Row["look"]),
                Convert.ToString(Row["gender"]), Convert.ToInt32(Row["credits"]), Convert.ToInt32(Row["activity_points"]),
                Convert.ToInt32(Row["home_room"]), PlusEnvironment.EnumToBool(Row["block_newfriends"].ToString()), Convert.ToInt32(Row["last_online"]),
                PlusEnvironment.EnumToBool(Row["hide_online"].ToString()), PlusEnvironment.EnumToBool(Row["hide_inroom"].ToString()),
                Convert.ToDouble(Row["account_created"]), Convert.ToInt32(Row["vip_points"]),Convert.ToString(Row["machine_id"]), Convert.ToString(Row["volume"]),
                PlusEnvironment.EnumToBool(Row["chat_preference"].ToString()), PlusEnvironment.EnumToBool(Row["focus_preference"].ToString()), PlusEnvironment.EnumToBool(Row["pets_muted"].ToString()), PlusEnvironment.EnumToBool(Row["bots_muted"].ToString()),
                PlusEnvironment.EnumToBool(Row["advertising_report_blocked"].ToString()), Convert.ToDouble(Row["last_change"].ToString()), Convert.ToInt32(Row["gotw_points"]),
                PlusEnvironment.EnumToBool(Convert.ToString(Row["ignore_invites"])), Convert.ToDouble(Row["time_muted"]), Convert.ToDouble(UserInfo["trading_locked"]),
                PlusEnvironment.EnumToBool(Row["allow_gifts"].ToString()), Convert.ToInt32(Row["friend_bar_state"]),  PlusEnvironment.EnumToBool(Row["disable_forced_effects"].ToString()),
                PlusEnvironment.EnumToBool(Row["allow_mimic"].ToString()), Convert.ToInt32(Row["rank_vip"]));
becomes
Code:
return new Habbo(Convert.ToInt32(Row["id"]), Convert.ToString(Row["username"]), Convert.ToInt32(Row["rank"]), Convert.ToString(Row["motto"]), Convert.ToString(Row["look"]),
                Convert.ToString(Row["gender"]), Convert.ToInt32(Row["credits"]), Convert.ToInt32(Row["activity_points"]),
                Convert.ToInt32(Row["home_room"]), PlusEnvironment.EnumToBool(Row["block_newfriends"].ToString()), Convert.ToInt32(Row["last_online"]),
                PlusEnvironment.EnumToBool(Row["hide_online"].ToString()), PlusEnvironment.EnumToBool(Row["hide_inroom"].ToString()),
                Convert.ToDouble(Row["account_created"]), Convert.ToInt32(Row["vip_points"]),Convert.ToString(Row["machine_id"]), Convert.ToString(Row["volume"]),
                PlusEnvironment.EnumToBool(Row["chat_preference"].ToString()), PlusEnvironment.EnumToBool(Row["focus_preference"].ToString()), PlusEnvironment.EnumToBool(Row["pets_muted"].ToString()), PlusEnvironment.EnumToBool(Row["bots_muted"].ToString()),
                PlusEnvironment.EnumToBool(Row["advertising_report_blocked"].ToString()), Convert.ToDouble(Row["last_change"].ToString()), Convert.ToInt32(Row["gotw_points"]),
                PlusEnvironment.EnumToBool(Convert.ToString(Row["ignore_invites"])), Convert.ToDouble(Row["time_muted"]), Convert.ToDouble(UserInfo["trading_locked"]),
                PlusEnvironment.EnumToBool(Row["allow_gifts"].ToString()), Convert.ToInt32(Row["friend_bar_state"]),  PlusEnvironment.EnumToBool(Row["disable_forced_effects"].ToString()),
                PlusEnvironment.EnumToBool(Row["allow_mimic"].ToString()), Convert.ToInt32(Row["rank_vip"]), Convert.ToInt32(Row["health"]));

Well done, you've now implemented the health system.. now, here is the command file (Add to /HabboHotel/Rooms/Chat/Commands/User/Fun):
Code:
using Plus.HabboHotel.GameClients;

namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
{
    class ShootCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return ""; }
        }

        public string Parameters
        {
            get { return "%username%"; }
        }

        public string Description
        {
            get { return "Shoots another user"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username of the user you wish to shoot.");
                return;
            }

            RoomUser roomUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (roomUser == null)
                return;

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
            {
                Session.SendWhisper("Why? just why...");
                return;
            }

            RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
            if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }

            int randomShotDamage = PlusEnvironment.GetRandomNumber(1, 8);

            if ((TargetClient.GetHabbo().Health - randomShotDamage) < 1)
            {
                Room.SendMessage(new ShoutComposer(roomUser.VirtualId, "*Shoots " + TargetClient.GetHabbo().Username + ", killing them!*", 0, roomUser.LastBubble));
                TargetClient.GetHabbo().Health = 100; // rest the targets health
                // Here you would reload the room for target? :P, you said you would do this so I'll leave it
            }
            else
            {
                Room.SendMessage(new ShoutComposer(roomUser.VirtualId, "*Shoots " + TargetClient.GetHabbo().Username + ", causing " + randomShotDamage + " damage*", 0, roomUser.LastBubble));

                TargetClient.GetHabbo().Health -= randomShotDamage;

                if (TargetClient.GetHabbo().Health >= 60)
                    Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "*" + TargetClient.GetHabbo().Health + "/100*", 0, 6));

                if (TargetClient.GetHabbo().Health < 60 && TargetClient.GetHabbo().Health >= 31)
                    Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "*" + TargetClient.GetHabbo().Health + "/100*", 0, 5));

                if (TargetClient.GetHabbo().Health < 31)
                    Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "*" + TargetClient.GetHabbo().Health + "/100*", 0, 3));
            }
        }
    }
}

You also need to register the comand, so go to the file: /HabboHotel/Rooms/Chat/Commands/CommadManager
Find this code (Yours may vary, just find the last command you added, if you have added any, the last user in RegisterUser() method)
Code:
this.Register("superpush", new SuperPushCommand());
Underneath that, you want to add this
Code:
this.Register("shoot", new ShootCommand());

You'll need to save this on logout so find this code
Code:
return "UPDATE `users` SET `online` = '0', `last_online` = '" + PlusEnvironment.GetUnixTimestamp() + "', `activity_points` = '" + this.Duckets + "', `credits` = '" + this.Credits + "', `vip_points` = '" + this.Diamonds + "', `home_room` = '" + this.HomeRoom + "', `gotw_points` = '" + this.GOTWPoints + "', `time_muted` = '" + this.TimeMuted + "',`friend_bar_state` = '" + FriendBarStateUtility.GetInt(this._friendbarState) + "' WHERE id = '" + Id + "' LIMIT 1;UPDATE `user_stats` SET `roomvisits` = '" + this._habboStats.RoomVisits + "', `onlineTime` = '" + (PlusEnvironment.GetUnixTimestamp() - SessionStart + this._habboStats.OnlineTime) + "', `respect` = '" + this._habboStats.Respect + "', `respectGiven` = '" + this._habboStats.RespectGiven + "', `giftsGiven` = '" + this._habboStats.GiftsGiven + "', `giftsReceived` = '" + this._habboStats.GiftsReceived + "', `dailyRespectPoints` = '" + this._habboStats.DailyRespectPoints + "', `dailyPetRespectPoints` = '" + this._habboStats.DailyPetRespectPoints + "', `AchievementScore` = '" + this._habboStats.AchievementPoints + "', `quest_id` = '" + this._habboStats.QuestID + "', `quest_progress` = '" + this._habboStats.QuestProgress + "', `groupid` = '" + this._habboStats.FavouriteGroupId + "',`forum_posts` = '" + this._habboStats.ForumPosts + "' WHERE `id` = '" + this.Id + "' LIMIT 1;";

And replace it with this
Code:
return "UPDATE `users` SET `online` = '0', `last_online` = '" + PlusEnvironment.GetUnixTimestamp() + "', `activity_points` = '" + this.Duckets + "', `credits` = '" + this.Credits + "', `vip_points` = '" + this.Diamonds + "', `home_room` = '" + this.HomeRoom + "', `gotw_points` = '" + this.GOTWPoints + "', `time_muted` = '" + this.TimeMuted + "',`friend_bar_state` = '" + FriendBarStateUtility.GetInt(this._friendbarState) + "' WHERE id = '" + Id + "' LIMIT 1;UPDATE `user_stats` SET `roomvisits` = '" + this._habboStats.RoomVisits + "', `onlineTime` = '" + (PlusEnvironment.GetUnixTimestamp() - SessionStart + this._habboStats.OnlineTime) + "', `respect` = '" + this._habboStats.Respect + "', `respectGiven` = '" + this._habboStats.RespectGiven + "', `giftsGiven` = '" + this._habboStats.GiftsGiven + "', `giftsReceived` = '" + this._habboStats.GiftsReceived + "', `dailyRespectPoints` = '" + this._habboStats.DailyRespectPoints + "', `dailyPetRespectPoints` = '" + this._habboStats.DailyPetRespectPoints + "', `AchievementScore` = '" + this._habboStats.AchievementPoints + "', `quest_id` = '" + this._habboStats.QuestID + "', `quest_progress` = '" + this._habboStats.QuestProgress + "', `groupid` = '" + this._habboStats.FavouriteGroupId + "',`forum_posts` = '" + this._habboStats.ForumPosts + "', `health` = '" + this._health + "' WHERE `id` = '" + this.Id + "' LIMIT 1;";

Finally, you want to add the health column to the users table, execute this query.
Code:
ALTER TABLE `users` ADD `health`INT(3) NOT NULL DEFAULT '100'

Want a cooldown? here is the code
In Habbo.cs file, find this code
Code:
public ConcurrentDictionary<string, UserAchievement> Achievements;
underneath it, add this
Code:
public DateTime LastShoot;

In your ShootCommand.cs command, find this
Code:
if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }
underneath it, add this
Code:
TimeSpan lastShoot = Session.GetHabbo().LastShoot - DateTime.Now;
            if (lastShoot.Seconds < 5)
            {
                Session.SendWhisper("You're cooling down! [" + lastShoot.Seconds + "/5]");
                return;
            }

Want a maximum distance on the command? here...
Find this code
Code:
if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }

Underneath it, add this code
Code:
if (!((Math.Abs((roomUser.X - TargetUser.X)) >= 7) || (Math.Abs((roomUser.Y - TargetUser.Y)) >= 7))
                {
                    Room.SendMessage(new ShoutComposer(roomUser.VirtualId, "*Tries to shot" + TargetClient.GetHabbo().Username + " but they are too far away*", 0, roomUser.LastBubble));
                    return;
                }

Enjoy :)

EDIT: 02/11/2016, 18:26 - Fix for "new" plus edition...
Hello, since some of you guys have the new Plus EMU and its been improved a little (querys) it is a bit different, here is what you have to do AFTER you have completed the previous spoiler.
 
Last edited:

xxfanywe

Member
Mar 25, 2015
40
3
Sorry it took so long, had things planned that couldn't be re-arranged, anyways here it is:p

So first, your going to want to implement the health system...
  • Go to /HabboHotel/Users/Habbo.cs
  • Find public bool SessionClothingBlocked
  • Underneath that, add this code below
Code:
public int Health
        {
            get { return this._health; }
            set { this._health = value; }
        }

At this point you'll have 2 errors because you haven't implemented the _health field, so to do that find private IChatCommand _iChatCommand; and undearneath it, add this code
Code:
private int _health;

Now, you will need to read this from the database so, you want to find this big chunck of coding below (Yours may vary but will be pretty much the same)
Code:
public Habbo(int Id, string Username, int Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int HomeRoom,
            bool HasFriendRequestsDisabled, int LastOnline, bool AppearOffline, bool HideInRoom, double CreateDate, int Diamonds,
            string machineID, string clientVolume, bool ChatPreference, bool FocusPreference, bool PetsMuted, bool BotsMuted, bool AdvertisingReportBlocked, double LastNameChange,
            int GOTWPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, int VIPRank)

All you want to do is after the last parameter, add this code
Code:
int Health

So
Code:
public Habbo(int Id, string Username, int Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int HomeRoom,
            bool HasFriendRequestsDisabled, int LastOnline, bool AppearOffline, bool HideInRoom, double CreateDate, int Diamonds,
            string machineID, string clientVolume, bool ChatPreference, bool FocusPreference, bool PetsMuted, bool BotsMuted, bool AdvertisingReportBlocked, double LastNameChange,
            int GOTWPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, int VIPRank)
Becomes
Code:
public Habbo(int Id, string Username, int Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int HomeRoom,
            bool HasFriendRequestsDisabled, int LastOnline, bool AppearOffline, bool HideInRoom, double CreateDate, int Diamonds,
            string machineID, string clientVolume, bool ChatPreference, bool FocusPreference, bool PetsMuted, bool BotsMuted, bool AdvertisingReportBlocked, double LastNameChange,
            int GOTWPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, int VIPRank, int Health)

Now, we're almost there, stick with me... now find this code
Code:
this.UsersRooms = new List<RoomData>();
and undearneath it, add this
Code:
this._health = Health;

One last step, we need to pass the parameter to the Habbo constructor, so find the file /HabboHotel/Users/Authenticator/Authenticator.cs
In this file you'll see something like this..
Code:
return new Habbo(Convert.ToInt32(Row["id"]), Convert.ToString(Row["username"]), Convert.ToInt32(Row["rank"]), Convert.ToString(Row["motto"]), Convert.ToString(Row["look"]),
                Convert.ToString(Row["gender"]), Convert.ToInt32(Row["credits"]), Convert.ToInt32(Row["activity_points"]),
                Convert.ToInt32(Row["home_room"]), PlusEnvironment.EnumToBool(Row["block_newfriends"].ToString()), Convert.ToInt32(Row["last_online"]),
                PlusEnvironment.EnumToBool(Row["hide_online"].ToString()), PlusEnvironment.EnumToBool(Row["hide_inroom"].ToString()),
                Convert.ToDouble(Row["account_created"]), Convert.ToInt32(Row["vip_points"]),Convert.ToString(Row["machine_id"]), Convert.ToString(Row["volume"]),
                PlusEnvironment.EnumToBool(Row["chat_preference"].ToString()), PlusEnvironment.EnumToBool(Row["focus_preference"].ToString()), PlusEnvironment.EnumToBool(Row["pets_muted"].ToString()), PlusEnvironment.EnumToBool(Row["bots_muted"].ToString()),
                PlusEnvironment.EnumToBool(Row["advertising_report_blocked"].ToString()), Convert.ToDouble(Row["last_change"].ToString()), Convert.ToInt32(Row["gotw_points"]),
                PlusEnvironment.EnumToBool(Convert.ToString(Row["ignore_invites"])), Convert.ToDouble(Row["time_muted"]), Convert.ToDouble(UserInfo["trading_locked"]),
                PlusEnvironment.EnumToBool(Row["allow_gifts"].ToString()), Convert.ToInt32(Row["friend_bar_state"]),  PlusEnvironment.EnumToBool(Row["disable_forced_effects"].ToString()),
                PlusEnvironment.EnumToBool(Row["allow_mimic"].ToString()), Convert.ToInt32(Row["rank_vip"]));

Now all you want to do is add this code to the end before );
Code:
Convert.ToInt32(Row["health"])

So this code
Code:
return new Habbo(Convert.ToInt32(Row["id"]), Convert.ToString(Row["username"]), Convert.ToInt32(Row["rank"]), Convert.ToString(Row["motto"]), Convert.ToString(Row["look"]),
                Convert.ToString(Row["gender"]), Convert.ToInt32(Row["credits"]), Convert.ToInt32(Row["activity_points"]),
                Convert.ToInt32(Row["home_room"]), PlusEnvironment.EnumToBool(Row["block_newfriends"].ToString()), Convert.ToInt32(Row["last_online"]),
                PlusEnvironment.EnumToBool(Row["hide_online"].ToString()), PlusEnvironment.EnumToBool(Row["hide_inroom"].ToString()),
                Convert.ToDouble(Row["account_created"]), Convert.ToInt32(Row["vip_points"]),Convert.ToString(Row["machine_id"]), Convert.ToString(Row["volume"]),
                PlusEnvironment.EnumToBool(Row["chat_preference"].ToString()), PlusEnvironment.EnumToBool(Row["focus_preference"].ToString()), PlusEnvironment.EnumToBool(Row["pets_muted"].ToString()), PlusEnvironment.EnumToBool(Row["bots_muted"].ToString()),
                PlusEnvironment.EnumToBool(Row["advertising_report_blocked"].ToString()), Convert.ToDouble(Row["last_change"].ToString()), Convert.ToInt32(Row["gotw_points"]),
                PlusEnvironment.EnumToBool(Convert.ToString(Row["ignore_invites"])), Convert.ToDouble(Row["time_muted"]), Convert.ToDouble(UserInfo["trading_locked"]),
                PlusEnvironment.EnumToBool(Row["allow_gifts"].ToString()), Convert.ToInt32(Row["friend_bar_state"]),  PlusEnvironment.EnumToBool(Row["disable_forced_effects"].ToString()),
                PlusEnvironment.EnumToBool(Row["allow_mimic"].ToString()), Convert.ToInt32(Row["rank_vip"]));
becomes
Code:
return new Habbo(Convert.ToInt32(Row["id"]), Convert.ToString(Row["username"]), Convert.ToInt32(Row["rank"]), Convert.ToString(Row["motto"]), Convert.ToString(Row["look"]),
                Convert.ToString(Row["gender"]), Convert.ToInt32(Row["credits"]), Convert.ToInt32(Row["activity_points"]),
                Convert.ToInt32(Row["home_room"]), PlusEnvironment.EnumToBool(Row["block_newfriends"].ToString()), Convert.ToInt32(Row["last_online"]),
                PlusEnvironment.EnumToBool(Row["hide_online"].ToString()), PlusEnvironment.EnumToBool(Row["hide_inroom"].ToString()),
                Convert.ToDouble(Row["account_created"]), Convert.ToInt32(Row["vip_points"]),Convert.ToString(Row["machine_id"]), Convert.ToString(Row["volume"]),
                PlusEnvironment.EnumToBool(Row["chat_preference"].ToString()), PlusEnvironment.EnumToBool(Row["focus_preference"].ToString()), PlusEnvironment.EnumToBool(Row["pets_muted"].ToString()), PlusEnvironment.EnumToBool(Row["bots_muted"].ToString()),
                PlusEnvironment.EnumToBool(Row["advertising_report_blocked"].ToString()), Convert.ToDouble(Row["last_change"].ToString()), Convert.ToInt32(Row["gotw_points"]),
                PlusEnvironment.EnumToBool(Convert.ToString(Row["ignore_invites"])), Convert.ToDouble(Row["time_muted"]), Convert.ToDouble(UserInfo["trading_locked"]),
                PlusEnvironment.EnumToBool(Row["allow_gifts"].ToString()), Convert.ToInt32(Row["friend_bar_state"]),  PlusEnvironment.EnumToBool(Row["disable_forced_effects"].ToString()),
                PlusEnvironment.EnumToBool(Row["allow_mimic"].ToString()), Convert.ToInt32(Row["rank_vip"]), Convert.ToInt32(Row["health"]));

Well done, you've now implemented the health system.. now, here is the command file (Add to /HabboHotel/Rooms/Chat/Commands/User/Fun):
Code:
using Plus.HabboHotel.GameClients;

namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
{
    class ShootCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return ""; }
        }

        public string Parameters
        {
            get { return "%username%"; }
        }

        public string Description
        {
            get { return "Shoots another user"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username of the user you wish to shoot.");
                return;
            }

            RoomUser roomUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (roomUser == null)
                return;

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
            {
                Session.SendWhisper("Why? just why...");
                return;
            }

            RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
            if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }

            int randomShotDamage = PlusEnvironment.GetRandomNumber(1, 8);

            if ((TargetClient.GetHabbo().Health - randomShotDamage) < 1)
            {
                Room.SendMessage(new ShoutComposer(roomUser.VirtualId, "*Shoots " + TargetClient.GetHabbo().Username + ", killing them!*", 0, roomUser.LastBubble));
                TargetClient.GetHabbo().Health = 100; // rest the targets health
                // Here you would reload the room for target? :P, you said you would do this so I'll leave it
            }
            else
            {
                Room.SendMessage(new ShoutComposer(roomUser.VirtualId, "*Shoots " + TargetClient.GetHabbo().Username + ", causing " + randomShotDamage + " damage*", 0, roomUser.LastBubble));

                TargetClient.GetHabbo().Health -= randomShotDamage;

                if (TargetClient.GetHabbo().Health >= 60)
                    Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "*" + TargetClient.GetHabbo().Health + "/100*", 0, 6));

                if (TargetClient.GetHabbo().Health < 60 && TargetClient.GetHabbo().Health >= 31)
                    Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "*" + TargetClient.GetHabbo().Health + "/100*", 0, 5));

                if (TargetClient.GetHabbo().Health < 31)
                    Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "*" + TargetClient.GetHabbo().Health + "/100*", 0, 3));
            }
        }
    }
}

You also need to register the comand, so go to the file: /HabboHotel/Rooms/Chat/Commands/CommadManager
Find this code (Yours may vary, just find the last command you added, if you have added any, the last user in RegisterUser() method)
Code:
this.Register("superpush", new SuperPushCommand());
Underneath that, you want to add this
Code:
this.Register("shoot", new ShootCommand());

Finally, you want to add the health column to the users table, execute this query.
Code:
ALTER TABLE `users` ADD `health`INT(3) NOT NULL DEFAULT '100'

Want a cooldown? here is the code
In Habbo.cs file, find this code
Code:
public ConcurrentDictionary<string, UserAchievement> Achievements;
underneath it, add this
Code:
public DateTime LastShoot;

In your ShootCommand.cs command, find this
Code:
if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }
underneath it, add this
Code:
TimeSpan lastShoot = Session.GetHabbo().LastShoot - DateTime.Now;
            if (lastShoot.Seconds < 5)
            {
                Session.SendWhisper("You're cooling down! [" + lastShoot.Seconds + "/5]");
                return;
            }

Want a maximum distance on the command? here...
Find this code
Code:
if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }

Underneath it, add this code
Code:
if (!((Math.Abs((roomUser.X - TargetUser.X)) >= 7) || (Math.Abs((roomUser.Y - TargetUser.Y)) >= 7))
                {
                    Room.SendMessage(new ShoutComposer(roomUser.VirtualId, "*Tries to shot" + TargetClient.GetHabbo().Username + " but they are too far away*", 0, roomUser.LastBubble));
                    return;
                }

Enjoy :)

thanks ill try this in a bit
 

LeComet

Retaliation 3
Jun 26, 2016
31
9
The command coding did not work, I done everything right and it's stuck on 76%, none of the database tables are null. Any Help?
 

Seriosk

Programmer;
Oct 29, 2016
256
105
The command coding did not work, I done everything right and it's stuck on 76%, none of the database tables are null. Any Help?

Other guy added it fine, make sure your loading the column on your SELECT WHERE `auth ticket` etc, if you're still stuck then drop me a message on skype
lithq123
 

Jozh

New Project Coming Soon!
Oct 8, 2016
122
21
Hiya mate, i am using plus emu, normal hotel wondering if u can make me 2 commands,

:wb *username* Welcome username back to hex hotel, thanks for coming back and choosing us! Effect puts thumb up in the air, like when you respect someone!
:shoot x *Shoots username with gun* * user who shoots the gun holds the gun enable.... , < if possible Target user *Starts bleeding heavely* *Falls to the floor and dies* Effect the target user :lay command,

thank you,
 
May 1, 2015
467
152
The command coding did not work, I done everything right and it's stuck on 76%, none of the database tables are null. Any Help?
You have to modify userdatafactory.cs to select health from the users table.
That command isn't the best and can be fixed up.
What i don't understand is, why you're checking up on the health 3 times when it can easily be done like this:
Code:
Room.SendMessage(new ChatComposer(TargetUser.VirtualId, "[" + TargetUser.GetClient().GetHabbo().Health + "/100]", 0, TargetUser.LastBubble));
other than that, good service i guess.
good luck.
 

Seriosk

Programmer;
Oct 29, 2016
256
105
You have to modify userdatafactory.cs to select health from the users table.
That command isn't the best and can be fixed up.
What i don't understand is, why you're checking up on the health 3 times when it can easily be done like this:
Code:
Room.SendMessage(new ChatComposer(TargetUser.VirtualId, "[" + TargetUser.GetClient().GetHabbo().Health + "/100]", 0, TargetUser.LastBubble));
other than that, good service i guess.
good luck.
WHAAAAAAAAT?
Your answer defeats the whole functionality of that command, I check it 3 times because the target outputs a "green", "yello" or "red" bubble depending on their health..
smh @Altercationz

anyway tbh should do var local variable store (will edit later), or even setting just lastbubble

ON TOPIC:
Sorry took so long, @Manuela kept me talking (only jking, was fun), anyway..
Both commands coded..

In CommandManager.cs (/HabboHotel/Rooms/Chat/Commands/CommandManager.cs find this code
Code:
this.Register("superpush", new SuperPushCommand());

Add this (underneath)
Code:
this.Register("wb", new WelcomeBackCommand());

Here is the command file, just create a new file (WelcomeBackCommand.cs in /HabboHotel/Rooms/Chat/Commands/CommandManager.cs)
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Rooms.Chat.Styles;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Users
{
    class WelcomeBackCommand : IChatCommand
    {
        private string _hotelName = "Hex";
   
        public string PermissionRequired
        {
            get { return ""; }
        }

        public string Parameters
        {
            get { return "%username%"; }
        }

        public string Description
        {
            get { return "Welcomes a user back to " + _hotelName + " hotel"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            if (Params.Length == 1)
            {
                Session.SendWhisper("Oops, you forgot to enter a username!");
                return;
            }
       
            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
            if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }
       
            Room.SendMessage(new ShoutComposer(User.VirtualId, "Welcome back to " + _hotelName + " " + TargetClient.GetHabbo().Username + ", thanks for coming back and choosing us!", 0, User.LastBubble));
        }
    }
}

Command: (repeat what u did for :wb when adding it)
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Rooms.Chat.Styles;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Users
{
    class ShootCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return ""; }
        }

        public string Parameters
        {
            get { return "%username%"; }
        }

        public string Description
        {
            get { return "Shoots another user"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            if (Params.Length == 1)
            {
                Session.SendWhisper("Oops, you forgot to enter a username!");
                return;
            }
         
            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
            if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }
         
            Room.SendMessage(new ShoutComposer(User.VirtualId, "*Shoots " + TargetClient.GetHabbo().Username + " with their gun*", 0, User.LastBubble));
            Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "*Starts bleeding heavely*", 0, TargetUser.LastBubble));
            Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "*Falls to the floor and dies*", 0, TargetUser.LastBubble));
        }
    }
}
 
Last edited:

Jaden

not so active
Aug 24, 2014
886
263
... you didn't have to use MySQL. He said it was for a hotel so I reckon he won't mind if it's just session storage.
 

Velaski

winner
Aug 4, 2015
562
165
This service is bad imo. Hotels stand out from their custom features/commands and people will just all have the same shit. Nice service from you, bad service for people who cant code a command.
 

Seriosk

Programmer;
Oct 29, 2016
256
105
... you didn't have to use MySQL. He said it was for a hotel so I reckon he won't mind if it's just session storage.
(Not sure if your talking about the health system being MySQL related, but if you are...)
I know I could of just used session variables but I figured he might want to save the health on reload, I guess its better having it save than having someone comment the next day asking how to save it on reload.

This service is bad imo. Hotels stand out from their custom features/commands and people will just all have the same shit. Nice service from you, bad service for people who cant code a command.
Not sure what you we're even trying to achieve with that comment, so I will just forget I even seen it..
 
Last edited:

yoyok

Member
Apr 24, 2013
197
24
Command :kickwars on - it gives everyone rights - even when new users enter the room. / :kickwars off disable the game kickwars and disable kick and no one have rights anymore.
Emulator: for plusemu
 
Status
Not open for further replies.

Users who are viewing this thread

Top