Author Topic: Slot Game  (Read 1566 times)

Offline Pug307

  • Level 21
  • *
  • Posts: 244
  • Reputation: +6/-1
    • View Profile
Slot Game
« on: November 13, 2006, 07:35:05 PM »
I have a slot game for the casino of my game. I have noticed a problem though. There are 4 reels and you can only get 2 in a row from the last 2 reels.

The code is
Code: [Select]
elseif ($roll3 == $roll4){
How would I add the other 2 reels so that you can win 2 in a row from all 4 reels?

ie...

elseif ($roll1 == $roll2){
elseif ($roll2 == $roll3){
elseif ($roll3 == $roll4){



Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: Slot Game
« Reply #1 on: November 14, 2006, 03:50:20 AM »
Try this:
Code: [Select]
<?php
if ($roll1 == $roll2 && $roll2 == $roll3 && $roll3 == $roll4)
{
echo 
"Jackpot";
}
?>


Offline Pug307

  • Level 21
  • *
  • Posts: 244
  • Reputation: +6/-1
    • View Profile
Re: Slot Game
« Reply #2 on: November 14, 2006, 09:25:35 AM »
The code for the jackpot is already there Zeg, I am trying to change the two in a row so that can you win from the middle 2 reels and the first 2 reels as at the moment you can only win two in a row from the last 2 reels.

Thanks



Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: Slot Game
« Reply #3 on: November 14, 2006, 09:48:37 AM »
Then what you wrote in the beginning is correct, the code should work :)

Offline Pug307

  • Level 21
  • *
  • Posts: 244
  • Reputation: +6/-1
    • View Profile
Re: Slot Game
« Reply #4 on: November 14, 2006, 12:18:46 PM »
It don' work and comes up with an error which I didn't make note of as I needed to quickly add the original file back into the game. I will try it again and get the error and then post it here for you to see  :ah:



Offline Pug307

  • Level 21
  • *
  • Posts: 244
  • Reputation: +6/-1
    • View Profile
Re: Slot Game
« Reply #5 on: November 16, 2006, 06:57:36 AM »
After trying to get the error again I remember that this did not give any errors but won't load the page at all and gives a blank white screen. Any ideas why and how it can be fixed?



Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: Slot Game
« Reply #6 on: November 16, 2006, 10:43:01 AM »
Could you show me the code?
I'm not really sure what the problem is either...

Offline Pug307

  • Level 21
  • *
  • Posts: 244
  • Reputation: +6/-1
    • View Profile
Re: Slot Game
« Reply #7 on: November 16, 2006, 12:27:31 PM »
Its all in a foreign language but the part of the code I am trying to edit is...

Code: [Select]
          }
         
          elseif ($roll2 == $roll3 && $roll3 == $roll4){
          $gain = ($gok * 5);
         
          $bericht .= "<font color=\"12c000\">You got 3 in a row and won <b>$gain</b> pound</font>";
          mysql_query("UPDATE $tab[pimp] SET cash=cash+$gain, turn=turn-5 where id='$id'AND rid='$rid';");
          }
         
          elseif ($roll3 == $roll4){
          $gain = ($gok * 2.2);
         
          $bericht .= "<font color=\"12c000\">You got 2 in a row and won <b>$gain</b> pound</font>";
          mysql_query("UPDATE $tab[pimp] SET cash=cash+$gain, turn=turn-5 where id='$id'AND rid='$rid';");
          }

The 3 in a row only lets the user win from the last 3 reels, the 2 in a row only lets the user win from the last 2 reels. I want it to use all 4 reels



Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: Slot Game
« Reply #8 on: November 16, 2006, 01:29:36 PM »
Code: [Select]
<?php
elseif ($roll1 == $roll2 XOR $roll2 == $roll3 XOR $roll3 == $roll4){
          
$gain = ($gok 2.2);
          
          
$bericht .= "<font color=\"12c000\">You got 2 in a row and won <b>$gain</b> pound</font>";
          
mysql_query("UPDATE $tab[pimp] SET cash=cash+$gain, turn=turn-5 where id='$id'AND rid='$rid';");
          }
?>

That would check if they got 2 in a row on any of the four, and make sure that they didn't get more than two in a row. Replace your last lines from your posted code with the one I posted here.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal