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 Releases
Server Releases
Plus Emulator Slot Machine Interaction
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="Hypothesis" data-source="post: 442765" data-attributes="member: 83881"><p>Hi there <strong>DevBest</strong>, today I will be releasing a slot machine interaction type. The way I had it at my hotel was it set an amount based on a command called :gamble, and when you would set an amount then interact with the interact-able furniture item, which just so happen to be slot machines as that was the concept, anyways basically it would randomize your odds and divide those odds by 2, and determine a set amount of cards, each card sequence had a different percentage added to the amount you'd bet. Basically you'd have a chance to increase your credits just by gambling, I know a hotel by the name of <em>RageRP</em> had this function in the casinos, same with <em>HoloRP</em> and <em>NGH</em>, I believe <em>Habboon</em> has this function as well. I did not fully create this interactor on my own, I had quite a bit of help with the randomization of the odds,<u> the person who helped me with the sequence knows who they are</u>. Anyways, here's the release.</p><p>Create a new CS file called <strong>InteractorSlots.cs</strong> in your <strong>Interactor</strong> folder and paste this into it and save</p><p>[CODE=csharp]using System;</p><p></p><p>using Plus.HabboHotel.Rooms;</p><p>using Plus.HabboHotel.GameClients;</p><p>using Plus.Communication.Packets.Outgoing.Inventory.Purse;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Chat;</p><p></p><p>namespace Plus.HabboHotel.Items.Interactor</p><p>{</p><p> public class InteractorSlots : IFurniInteractor</p><p> {</p><p> public void OnPlace(GameClient Session, Item Item)</p><p> {</p><p> Item.ExtraData = "0";</p><p> Item.InteractingUser = 0;</p><p> }</p><p></p><p> public void OnRemove(GameClient Session, Item Item)</p><p> {</p><p> Item.ExtraData = "0";</p><p> Item.InteractingUser = 0;</p><p> }</p><p></p><p> public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights)</p><p> {</p><p> if (Session == null)</p><p> return;</p><p></p><p> RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p></p><p> if (User == null)</p><p> return;</p><p></p><p> if (Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y))</p><p> {</p><p> if (Session.GetHabbo().SlotsInteractation == 0)</p><p> {</p><p> Session.SendWhisper("There was an error with your amount.", 3);</p><p> return;</p><p> }</p><p> if (Session.GetHabbo().SlotLastSpun != 0)</p><p> {</p><p> if (Session.GetHabbo().SlotLastSpun > PlusEnvironment.Now())</p><p> {</p><p> Session.SendWhisper("Betting Cooldown!", 3);</p><p> return;</p><p> }</p><p> }</p><p> if (Session.GetHabbo().Credits >= Session.GetHabbo().SlotsInteractation)</p><p> {</p><p> Item.ExtraData = "1";</p><p> Item.UpdateState();</p><p> Item.RequestUpdate(4, true);</p><p> Session.GetHabbo().SlotLastSpun = PlusEnvironment.Now() + 1000;</p><p> //13 options Min: 0 Max: 13 (0-12)</p><p> String[] slotOptions = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "King", "Queen" };</p><p></p><p> Random randCard = new Random();</p><p> int Card1 = randCard.Next(0, 13);</p><p> int Card2 = randCard.Next(0, 13);</p><p> int Card3 = randCard.Next(0, 13);</p><p></p><p> String SlotCard1 = slotOptions[Card1];</p><p> String SlotCard2 = slotOptions[Card2];</p><p> String SlotCard3 = slotOptions[Card3];</p><p></p><p> int CreditsWon = 0;</p><p></p><p> if (Card1 == Card2 && Card2 == Card3 && Card3 == Card1)</p><p> {</p><p> CreditsWon = randCard.Next(Session.GetHabbo().SlotsInteractation, (Session.GetHabbo().SlotsInteractation * 2));</p><p> }</p><p> else if (Card1 == Card2 || Card2 == Card3 || Card1 == Card3)</p><p> {</p><p> CreditsWon = randCard.Next(Session.GetHabbo().SlotsInteractation, (Session.GetHabbo().SlotsInteractation + (Session.GetHabbo().SlotsInteractation / 2)));</p><p> }</p><p> else</p><p> {</p><p> CreditsWon = 0;</p><p> }</p><p> Session.SendWhisper("SLOT MACHINE: " + SlotCard1 + " " + SlotCard2 + " " + SlotCard3 + " You have won: " + CreditsWon + " credits!");</p><p> Session.GetHabbo().Credits = Session.GetHabbo().Credits - Session.GetHabbo().SlotsInteractation;</p><p> Session.GetHabbo().Credits = Session.GetHabbo().Credits + CreditsWon;</p><p> Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));</p><p> }</p><p> else</p><p> {</p><p> Session.SendWhisper("Your credit amount is too large.", 3);</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> User.MoveTo(Item.SquareInFront);</p><p> }</p><p> </p><p> }</p><p></p><p> public void OnWiredTrigger(Item Item)</p><p> {</p><p> }</p><p> }</p><p>}[/CODE]</p><p>After that, add this to <strong>Item.cs </strong>under the other cases</p><p>[CODE]case InteractionType.SLOTS:</p><p> return new InteractorSlots();[/CODE]</p><p>Next, you want to open your <strong>Habbo.cs</strong>, and add these two to the top along with the other lines that look fairly similar.</p><p>[CODE=csharp]private int integerSlot = 0;</p><p>private long lastSpun = 0;[/CODE]</p><p>After that, go down until you see your properties, and paste these two.</p><p>[CODE=csharp]public int SlotsInteractation</p><p> {</p><p> get { return this.integerSlot; }</p><p> set { this.integerSlot = value; }</p><p>}</p><p></p><p>public long SlotLastSpun</p><p> {</p><p> get { return this.lastSpun; }</p><p> set { this.lastSpun = value; }</p><p> }[/CODE]</p><p>After this, you wanna go to your <strong>InteractionType.cs</strong>, then add another enum to the end of the function, and call it <strong>SLOTS</strong></p><p>after you have that, go to the very last interaction type, in my case in FX_Provider, so before the default type, add this.</p><p>[CODE=csharp] case "slots":</p><p> return InteractionType.SLOTS;[/CODE]</p><p>Lastly is adding your command, i'll just give the one I use to save you the hassle of coding one.</p><p>[CODE=csharp]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p>using Plus.Database.Interfaces;</p><p>using Plus.Database.Adapter;</p><p>using Plus.HabboHotel.Users.UserDataManagement;</p><p>using Plus.HabboHotel.Rooms;</p><p>using Plus.HabboHotel.Items;</p><p>using Plus.Communication.Packets.Outgoing.Inventory.Purse;</p><p>using Plus.Communication.Packets.Outgoing.Notifications;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Notifications;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Session;</p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.User</p><p>{</p><p> class GambleCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_enable"; }</p><p> }</p><p></p><p> public string Parameters</p><p> {</p><p> get { return ""; }</p><p> }</p><p></p><p> public string Description</p><p> {</p><p> get { return "Gamble with the slot machine"; }</p><p> }</p><p></p><p> public void Execute(GameClients.GameClient Session, Rooms.Room CurrentRoom, string[] Params)</p><p> {</p><p> if (Session == null)</p><p> return;</p><p></p><p> int Bet = 0;</p><p></p><p> try</p><p> {</p><p> Bet = int.Parse(Params[1]);</p><p> }</p><p> catch</p><p> {</p><p> Session.SendWhisper("The amount you entered is invalid.", 3);</p><p> return;</p><p> }</p><p> if(Bet < 1 || Bet > 500000)</p><p> {</p><p> Session.SendWhisper("You can bet anything from 1 credit to 500000 credits.", 3);</p><p> return;</p><p> }</p><p></p><p> if (Session.GetHabbo().Credits < Bet)</p><p> {</p><p> Session.SendWhisper("You do not have enough credits to proceed with this bet.", 3);</p><p> return;</p><p> }</p><p></p><p> Session.GetHabbo().SlotsInteractation = Bet;</p><p> Session.SendWhisper("You have set your slot bet to " + Bet + " credits, double-click the slot to gamble.");</p><p> }</p><p> }</p><p>}[/CODE]</p><p>To get it working basically just go into your furniture table and choose a furniture you like, then make the interaction type <em>SLOTS </em>after that you should be good, if your table has the column set to use ENUM, then just open your structure and add SLOTS to your enum options.</p><p><strong>Thanks for reading, I hope this was helpful, if you have any issues, make a comment, I'll gladly help you or maybe someone else might be able to.</strong></p></blockquote><p></p>
[QUOTE="Hypothesis, post: 442765, member: 83881"] Hi there [B]DevBest[/B], today I will be releasing a slot machine interaction type. The way I had it at my hotel was it set an amount based on a command called :gamble, and when you would set an amount then interact with the interact-able furniture item, which just so happen to be slot machines as that was the concept, anyways basically it would randomize your odds and divide those odds by 2, and determine a set amount of cards, each card sequence had a different percentage added to the amount you'd bet. Basically you'd have a chance to increase your credits just by gambling, I know a hotel by the name of [I]RageRP[/I] had this function in the casinos, same with [I]HoloRP[/I] and [I]NGH[/I], I believe [I]Habboon[/I] has this function as well. I did not fully create this interactor on my own, I had quite a bit of help with the randomization of the odds,[U] the person who helped me with the sequence knows who they are[/U]. Anyways, here's the release. Create a new CS file called [B]InteractorSlots.cs[/B] in your [B]Interactor[/B] folder and paste this into it and save [CODE=csharp]using System; using Plus.HabboHotel.Rooms; using Plus.HabboHotel.GameClients; using Plus.Communication.Packets.Outgoing.Inventory.Purse; using Plus.Communication.Packets.Outgoing.Rooms.Chat; namespace Plus.HabboHotel.Items.Interactor { public class InteractorSlots : IFurniInteractor { public void OnPlace(GameClient Session, Item Item) { Item.ExtraData = "0"; Item.InteractingUser = 0; } public void OnRemove(GameClient Session, Item Item) { Item.ExtraData = "0"; Item.InteractingUser = 0; } public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights) { if (Session == null) return; RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) return; if (Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y)) { if (Session.GetHabbo().SlotsInteractation == 0) { Session.SendWhisper("There was an error with your amount.", 3); return; } if (Session.GetHabbo().SlotLastSpun != 0) { if (Session.GetHabbo().SlotLastSpun > PlusEnvironment.Now()) { Session.SendWhisper("Betting Cooldown!", 3); return; } } if (Session.GetHabbo().Credits >= Session.GetHabbo().SlotsInteractation) { Item.ExtraData = "1"; Item.UpdateState(); Item.RequestUpdate(4, true); Session.GetHabbo().SlotLastSpun = PlusEnvironment.Now() + 1000; //13 options Min: 0 Max: 13 (0-12) String[] slotOptions = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "King", "Queen" }; Random randCard = new Random(); int Card1 = randCard.Next(0, 13); int Card2 = randCard.Next(0, 13); int Card3 = randCard.Next(0, 13); String SlotCard1 = slotOptions[Card1]; String SlotCard2 = slotOptions[Card2]; String SlotCard3 = slotOptions[Card3]; int CreditsWon = 0; if (Card1 == Card2 && Card2 == Card3 && Card3 == Card1) { CreditsWon = randCard.Next(Session.GetHabbo().SlotsInteractation, (Session.GetHabbo().SlotsInteractation * 2)); } else if (Card1 == Card2 || Card2 == Card3 || Card1 == Card3) { CreditsWon = randCard.Next(Session.GetHabbo().SlotsInteractation, (Session.GetHabbo().SlotsInteractation + (Session.GetHabbo().SlotsInteractation / 2))); } else { CreditsWon = 0; } Session.SendWhisper("SLOT MACHINE: " + SlotCard1 + " " + SlotCard2 + " " + SlotCard3 + " You have won: " + CreditsWon + " credits!"); Session.GetHabbo().Credits = Session.GetHabbo().Credits - Session.GetHabbo().SlotsInteractation; Session.GetHabbo().Credits = Session.GetHabbo().Credits + CreditsWon; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } else { Session.SendWhisper("Your credit amount is too large.", 3); return; } } else { User.MoveTo(Item.SquareInFront); } } public void OnWiredTrigger(Item Item) { } } }[/CODE] After that, add this to [B]Item.cs [/B]under the other cases [CODE]case InteractionType.SLOTS: return new InteractorSlots();[/CODE] Next, you want to open your [B]Habbo.cs[/B], and add these two to the top along with the other lines that look fairly similar. [CODE=csharp]private int integerSlot = 0; private long lastSpun = 0;[/CODE] After that, go down until you see your properties, and paste these two. [CODE=csharp]public int SlotsInteractation { get { return this.integerSlot; } set { this.integerSlot = value; } } public long SlotLastSpun { get { return this.lastSpun; } set { this.lastSpun = value; } }[/CODE] After this, you wanna go to your [B]InteractionType.cs[/B], then add another enum to the end of the function, and call it [B]SLOTS[/B] after you have that, go to the very last interaction type, in my case in FX_Provider, so before the default type, add this. [CODE=csharp] case "slots": return InteractionType.SLOTS;[/CODE] Lastly is adding your command, i'll just give the one I use to save you the hassle of coding one. [CODE=csharp]using System; using System.Linq; using System.Text; using System.Collections.Generic; using Plus.Database.Interfaces; using Plus.Database.Adapter; using Plus.HabboHotel.Users.UserDataManagement; using Plus.HabboHotel.Rooms; using Plus.HabboHotel.Items; using Plus.Communication.Packets.Outgoing.Inventory.Purse; using Plus.Communication.Packets.Outgoing.Notifications; using Plus.Communication.Packets.Outgoing.Rooms.Notifications; using Plus.Communication.Packets.Outgoing.Rooms.Session; namespace Plus.HabboHotel.Rooms.Chat.Commands.User { class GambleCommand : IChatCommand { public string PermissionRequired { get { return "command_enable"; } } public string Parameters { get { return ""; } } public string Description { get { return "Gamble with the slot machine"; } } public void Execute(GameClients.GameClient Session, Rooms.Room CurrentRoom, string[] Params) { if (Session == null) return; int Bet = 0; try { Bet = int.Parse(Params[1]); } catch { Session.SendWhisper("The amount you entered is invalid.", 3); return; } if(Bet < 1 || Bet > 500000) { Session.SendWhisper("You can bet anything from 1 credit to 500000 credits.", 3); return; } if (Session.GetHabbo().Credits < Bet) { Session.SendWhisper("You do not have enough credits to proceed with this bet.", 3); return; } Session.GetHabbo().SlotsInteractation = Bet; Session.SendWhisper("You have set your slot bet to " + Bet + " credits, double-click the slot to gamble."); } } }[/CODE] To get it working basically just go into your furniture table and choose a furniture you like, then make the interaction type [I]SLOTS [/I]after that you should be good, if your table has the column set to use ENUM, then just open your structure and add SLOTS to your enum options. [B]Thanks for reading, I hope this was helpful, if you have any issues, make a comment, I'll gladly help you or maybe someone else might be able to.[/B] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
Plus Emulator Slot Machine Interaction
Top