[RESOLVED] Name Prefix Plus Emulator

Status
Not open for further replies.

Marko97

M97 Project based Plus EMU
Aug 7, 2013
99
45
Hello anyone!
I've installed name prefix release by Spyro in another forum but I've found a potential problem:
problema.png


How to resolve this?

The problematic code are:
RoomUser.cs
Code:
public void SendNameVoidPacket()
        {
            if (GetClient() == null || GetClient().GetHabbo() == null)
                return;

            string Username = GetClient().GetHabbo().Username;
            string Prefix, NameColor = null;

            if (!String.IsNullOrEmpty(GetClient().GetHabbo().PrefixName) && !String.IsNullOrEmpty(GetClient().GetHabbo().PrefixColor))
                Prefix = "<font color='#" + GetClient().GetHabbo().PrefixColor + "'>[" + GetClient().GetHabbo().PrefixName + "]</font> ";
            else if (!String.IsNullOrEmpty(GetClient().GetHabbo().PrefixName) && String.IsNullOrEmpty(GetClient().GetHabbo().PrefixColor))
                Prefix = "[" + GetClient().GetHabbo().PrefixName + "] ";
            else
                Prefix = "";

            if (!String.IsNullOrEmpty(GetClient().GetHabbo().NameColor))
                NameColor = "<font color='#" + GetClient().GetHabbo().NameColor + "'>" + GetClient().GetHabbo().Username + "</font>";
            else
                NameColor = GetClient().GetHabbo().Username;

            if (!String.IsNullOrEmpty(Prefix) || !String.IsNullOrEmpty(NameColor))
                Username = Prefix + NameColor;

            GetRoom().SendPacket(new UserNameChangeComposer(RoomId, VirtualId, Username));
        }
 

Marko97

M97 Project based Plus EMU
Aug 7, 2013
99
45
Show me the code from PurchaseFromCatalogEvent.cs for this


The prefix is taken by extradata (furniture table) and extradata are in text format, then if is in text format is allowed to add new line, for example when you create a new trophy you can add new lines.
 
Last edited:

Marko97

M97 Project based Plus EMU
Aug 7, 2013
99
45
Code:
string Colour = Item.Name.Split(new[] { '\r', '\n' }).FirstOrDefault()
Then replace Item.Name in the AddParameter to Colour
I need to split the ExtraData string and not the Item.Name.

I've make this:
Code:
string PrefixSplitted = ExtraData.Split(new[] { '\r', '\n' }).FirstOrDefault();

                    using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.SetQuery("UPDATE `users` SET `prefix_name` = @data WHERE `id` = @id");
                        dbClient.AddParameter("data", PrefixSplitted);
                        dbClient.AddParameter("id", Session.GetHabbo().Id);
                        dbClient.RunQuery();
                    }

I've tested this and work! Thank you so much @Westyy . You're awesome! :)
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top