View Single Post
  #5  
Old 05-27-2019, 02:28 PM
Sturm
Hill Giant
 
Join Date: Dec 2015
Posts: 116
Default

I get what you're saying about the rounding, but you can only turn in platinum to the NPC he will hand you back anything else, so that doesn't become an issue.

Code:
if ($playerdice == $dealerroll) {
				# push - cards are the same. Return bet.
				plugin::Whisper("You rolled a $playerdice. It's a draw. Returning your wager. Thanks for playing.");
				my $cash = $qglobals{"bet"};
				$copper	= ($cash % 10);
				$silver	= (int ($cash / 20) % 10);
				$gold = (int ($cash / 200) % 10);
				$platinum = int ($cash / 2000);
				quest::givecash($copper, $silver, $gold, $platinum); #Give money back
				CleanUP();
			}
It's dividing the bet in half here on the push. Probably not the best way to do it, but it worked. I am definitely not an expert coder, I just dabble and play around with stuff.
This was just something simple I created and thought I'd share it for those wanting a simple gambling mechanic for their server.
Was kinda hoping this sparked an idea in someone and they'd post some other fun little game for everyone to play with.

__________________
Developer of the Imperium Server.
https://imperium-eq.com/
Reply With Quote