[PLUSEMU] VIP Alert

MasterJiq

Member
Jul 8, 2016
385
23
Hello,

this is my second command that I make it by my own, so who have rank same to '2' or above '2' will receive this message as Hotel Alert. This is easy to code but I am not gonna wasting my time by doing the things that will make nothing to me.

VipAlertCommand.cs:
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Plus.Communication.Packets.Outgoing.Moderation;

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

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

        public string Description
        {
            get { return "Send a message to all users who has VIP."; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter a message to send.");
                return;
            }

            if (Session.GetHabbo().Rank < 2)
            {
                Session.SendWhisper("Seems like you're not VIP. Please buy VIP before using special commands.");
                return;
            }

            if (Session.GetHabbo().Rank >= 2)
            {
                string Message = CommandManager.MergeParams(Params, 1);
                PlusEnvironment.GetGame().GetClientManager().SendMessage(new BroadcastMessageAlertComposer(Message + "\r\n" + "- " + Session.GetHabbo().Username));

                return;
            }
        }
    }
}

Then go to CommandManager.cs and search for:
Code:
private void RegisterVIP() {
and below that add this:
Code:
this.Register("vipalert", VipAlertCommand());

After that run this SQL:
Code:
INSERT INTO `permissions_commands` VALUES ('command_vipalert', '2', '0');

Thanks.
 
I think in the last return would be 'return true;' ?
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
426
642
Terrible command, IMO. I'd add a cooldown or some way for users to disable getting messages. You're also sending to every user on the hotel, so have fun getting spammy messages all the time, and people advertising.

Code:
if (Session.GetHabbo().Rank >= 2)
This is also not needed at all, since you're already returning the command if the users rank is less than 2.

This is possibly the worst command I've ever seen released on here, I wouldn't recommend anyone using this. Good try though.
 

MasterJiq

Member
Jul 8, 2016
385
23
Lol, I've tried to make only users who have rank 2 and above get the message. But I am on rank 1 also get the message. Maybe bcs of my first time making command ? xD
 

Velaski

winner
Aug 4, 2015
562
165
It only shows to the "Session". You need to add a foreach so it shows to everyone ABOVE RANK 2..
 
if (Session.GetHabbo().Rank < 2) { Session.SendWhisper("Seems like you're not VIP. Please buy VIP before using special commands."); return; } if (Session.GetHabbo().Rank >= 2) { string Message = CommandManager.MergeParams(Params, 1); PlusEnvironment.GetGame().GetClientManager().SendMessage(new BroadcastMessageAlertComposer(Message + "\r\n" + "- " + Session.GetHabbo().Username)); return; }
As Damien said, You already returned if the "Session" is less than 2. After that you could add an else. So it would be:
PHP:
   if (Session.GetHabbo().Rank < 2)
            {
                Session.SendWhisper("Seems like you're not VIP. Please buy VIP before using special commands.");
                return;
            }
else
{
//do
}
We only learn from our mistakes!
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
426
642
It only shows to the "Session". You need to add a foreach so it shows to everyone ABOVE RANK 2..
 

As Damien said, You already returned if the "Session" is less than 2. After that you could add an else. So it would be:
PHP:
if (Session.GetHabbo().Rank < 2)
{
     Session.SendWhisper("Seems like you're not VIP. Please buy VIP before using special commands.");
     return;
}
else
{
      //do
}
We only learn from our mistakes!
The else is pointless too, since the command is being returned in the if. I should be either one of these two.

PHP:
if (Session.GetHabbo().Rank < 2)
{
     Session.SendWhisper("Seems like you're not VIP. Please buy VIP before using special commands.");
}
else
{
      //do
}
Or:
PHP:
if (Session.GetHabbo().Rank < 2)
{
     Session.SendWhisper("Seems like you're not VIP. Please buy VIP before using special commands.");
     return;
}
//do
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
The reason everyone will get the message is purely down to the fact you're sending a composer to everyone who's online without a check of their ranks and whatnot
Take a look at the staff alert command and how that works to give you an idea of what I'm on about so you know for future reference how to make stuff like this work properly
 

Users who are viewing this thread

Top