PlusEMU :removebadge

Dec 17, 2017
151
19
Hi Devbest, I have a problem with the :removebadge of my emulator (base Plus)

This is code of TakeBadgeCommand.cs
PHP:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Quasar.Communication.Packets.Outgoing.Rooms.Notifications;

using Quasar.HabboHotel.GameClients;

namespace Quasar.HabboHotel.Rooms.Chat.Commands.Personeel
{
    class TakeBadgeCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_removebadge"; }
        }

        public string Parameters
        {
            get { return "+ username + codice"; }
        }

        public string Description
        {
            get { return "Rimuovi un badge ad un utente"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length != 3)
            {
                Session.SendWhisper("Inserisci il nome dell'utente a cui vuoi rimuovere l'username e il codice del badge!");
                return;
            }

            GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient != null)
            {
                if (!TargetClient.GetHabbo().GetBadgeComponent().HasBadge(Params[2]))
                {
                    TargetClient.GetHabbo().GetBadgeComponent().RemoveBadge(Params[2]);
                    if (TargetClient.GetHabbo().Id != Session.GetHabbo().Id)
                        TargetClient.SendWhisper("Ti è stato rimosso il badge " + Params[2] + "!");
                    else
                        Session.SendWhisper("Hai rimosso correttamente il badge " + Params[2] + " a " + Params[1] + "!");
                }
                else
                    Session.SendWhisper("Questo utente non ha il distintivo " + Params[2] +"");
                return;
            }
            else
            {
                Session.SendWhisper("Utente non trovato!");
                return;
            }
        }
    }
}

the problem is that when I try to remove a badge it says "This user does not have this badge" but this is not true.
Where is a problem? Thanks! :)
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Hi Devbest, I have a problem with the :removebadge of my emulator (base Plus)

This is code of TakeBadgeCommand.cs
PHP:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Quasar.Communication.Packets.Outgoing.Rooms.Notifications;

using Quasar.HabboHotel.GameClients;

namespace Quasar.HabboHotel.Rooms.Chat.Commands.Personeel
{
    class TakeBadgeCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_removebadge"; }
        }

        public string Parameters
        {
            get { return "+ username + codice"; }
        }

        public string Description
        {
            get { return "Rimuovi un badge ad un utente"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length != 3)
            {
                Session.SendWhisper("Inserisci il nome dell'utente a cui vuoi rimuovere l'username e il codice del badge!");
                return;
            }

            GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient != null)
            {
                if (!TargetClient.GetHabbo().GetBadgeComponent().HasBadge(Params[2]))
                {
                    TargetClient.GetHabbo().GetBadgeComponent().RemoveBadge(Params[2]);
                    if (TargetClient.GetHabbo().Id != Session.GetHabbo().Id)
                        TargetClient.SendWhisper("Ti è stato rimosso il badge " + Params[2] + "!");
                    else
                        Session.SendWhisper("Hai rimosso correttamente il badge " + Params[2] + " a " + Params[1] + "!");
                }
                else
                    Session.SendWhisper("Questo utente non ha il distintivo " + Params[2] +"");
                return;
            }
            else
            {
                Session.SendWhisper("Utente non trovato!");
                return;
            }
        }
    }
}

the problem is that when I try to remove a badge it says "This user does not have this badge" but this is not true.
Where is a problem? Thanks! :)
if (!TargetClient.GetHabbo().GetBadgeComponent().HasBadge(Params[2]))

Remove the exclamation mark off this if statement. It's saying if they don't have it then remove the badge. It's backwards
 
May 1, 2015
470
154
if (!TargetClient.GetHabbo().GetBadgeComponent().HasBadge(Params[2]))

Remove the exclamation mark off this if statement. It's saying if they don't have it then remove the badge. It's backwards
Strange because I didn't include this line in my code when I made mine a couple months ago.
It doesn't want to remove it until they reload - which I can't figure out for some reason.
 

Users who are viewing this thread

Top