Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
PlusEmu - Command ONLY for Friends ???
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="uttmmmm5" data-source="post: 409060" data-attributes="member: 68424"><p>Hey there,</p><p>I have a question!</p><p>I start coding a few very very simple Commands.</p><p>Now I am coding a "shoot"-Command ... I know, nothing special and not even hard but this is my third command <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></p><p>My question now is: How I can do that this command can only be run if the target user is my friend?</p><p></p><p>Here the Code till now:</p><p>[CODE]using System;</p><p>using Plus.HabboHotel.Rooms;</p><p>using Plus.HabboHotel.GameClients;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Chat;</p><p></p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun</p><p>{</p><p> class Shoot : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_shoot"; }</p><p> }</p><p> public string Parameters</p><p> {</p><p> get { return "%username%"; }</p><p> }</p><p> public string Description</p><p> {</p><p> get { return "Erschieße einen anderen Hubba!"; }</p><p> }</p><p> public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</p><p> {</p><p> if (Params.Length == 1)</p><p> {</p><p> Session.SendWhisper("Gib den Usernamen des Hubba's an den du töten möchtest!");</p><p> return;</p><p> }</p><p></p><p> GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);</p><p> if (TargetClient == null)</p><p> {</p><p> Session.SendWhisper("Dieser Hubba konnte nicht gefunden werden. Vielleicht ist er nicht online.");</p><p> return;</p><p> }</p><p></p><p> RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);</p><p> if (User == null)</p><p> {</p><p> Session.SendWhisper("Dieser Hubba konnte nicht gefunden werden. Vielleicht ist er nicht online oder nicht im Raum.");</p><p> return;</p><p> }</p><p></p><p> RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);</p><p> if (TargetUser.ProtectEnabled)</p><p> {</p><p> Session.SendWhisper("Oops, du kannst keinen Hubba erschießen solange er den Protect-Befehl aktiviert hat.");</p><p> return;</p><p> }</p><p></p><p> RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p> if (ThisUser == null)</p><p> return;</p><p></p><p> if (!((Math.Abs(User.X - ThisUser.X) >= 2 && (Math.Abs(User.Y - ThisUser.Y) >= 2))))</p><p> {</p><p></p><p> Room.SendPacket(new ChatComposer(ThisUser.VirtualId, "*schießt " + TargetClient.GetHabbo().Username + " den Kopf weg*", 0, User.LastBubble));</p><p> User.ApplyEffect(93);</p><p> }</p><p> else</p><p> {</p><p> Session.SendWhisper("Dieser Hubba ist zu weit entfernt. Geh näher ran.");</p><p> return;</p><p> }</p><p> }</p><p> }</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="uttmmmm5, post: 409060, member: 68424"] Hey there, I have a question! I start coding a few very very simple Commands. Now I am coding a "shoot"-Command ... I know, nothing special and not even hard but this is my third command :) My question now is: How I can do that this command can only be run if the target user is my friend? Here the Code till now: [CODE]using System; using Plus.HabboHotel.Rooms; using Plus.HabboHotel.GameClients; using Plus.Communication.Packets.Outgoing.Rooms.Chat; namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun { class Shoot : IChatCommand { public string PermissionRequired { get { return "command_shoot"; } } public string Parameters { get { return "%username%"; } } public string Description { get { return "Erschieße einen anderen Hubba!"; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Gib den Usernamen des Hubba's an den du töten möchtest!"); return; } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("Dieser Hubba konnte nicht gefunden werden. Vielleicht ist er nicht online."); return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id); if (User == null) { Session.SendWhisper("Dieser Hubba konnte nicht gefunden werden. Vielleicht ist er nicht online oder nicht im Raum."); return; } RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id); if (TargetUser.ProtectEnabled) { Session.SendWhisper("Oops, du kannst keinen Hubba erschießen solange er den Protect-Befehl aktiviert hat."); return; } RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser == null) return; if (!((Math.Abs(User.X - ThisUser.X) >= 2 && (Math.Abs(User.Y - ThisUser.Y) >= 2)))) { Room.SendPacket(new ChatComposer(ThisUser.VirtualId, "*schießt " + TargetClient.GetHabbo().Username + " den Kopf weg*", 0, User.LastBubble)); User.ApplyEffect(93); } else { Session.SendWhisper("Dieser Hubba ist zu weit entfernt. Geh näher ran."); return; } } } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
PlusEmu - Command ONLY for Friends ???
Top