j0ker
$client = socket_accept($sock);
- Dec 29, 2010
- 79
- 22
So I'm just dabbling into PlusEMU, im trying to make a simple mp5 command with a time delay between each room.sendmessage, any suggestions? heres the code im using:
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Pathfinding;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;
namespace Plus.HabboHotel.Rooms.Chat.Commands.User
{
class mp5Command : IChatCommand
{
public string PermissionRequired
{
get { return "command_mp5"; }
}
public string Parameters
{
get { return "%name%"; }
}
public string Description
{
get { return "Shoot a user"; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
if (Params.Length == 1)
{
Session.SendWhisper("Choose a user");
return;
}
if (!Room.PushEnabled && !Session.GetHabbo().GetPermissions().HasRight("room_override_custom_config"))
{
Session.SendWhisper("Room owner disabled shooting.");
return;
}
GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
if (TargetClient == null)
{
Session.SendWhisper("User doesnt exist!");
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;
}
if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
{
Session.SendWhisper("You cant shoot yourself!");
return;
}
if (TargetUser.TeleportEnabled)
{
Session.SendWhisper("Oops, this person disabled violence!");
return;
}
RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (ThisUser == null)
return;
ThisUser.ApplyEffect(499);
Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "* Pulls out MP5 *", 1, ThisUser.LastBubble));
Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "* takes aim at " + Params[1] + " *", 1, ThisUser.LastBubble));
TargetUser.ApplyEffect(93);
Room.SendMessage(new ChatComposer(TargetUser.VirtualId, "* has died from a fatal gunshot wound *", 1, ThisUser.LastBubble));
ThisUser.ApplyEffect(0);
TargetUser.ApplyEffect(0);
}
}
}