-Genocide- Posted March 2, 2007 Share Posted March 2, 2007 this is a simple black jack game that i converted to work with mccodes, i didnt add any querys for betting, i cant do all the work for you :P blackjack.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Black Jack"; if ($_SESSION['bj'] != ''){ for($i = 1; $i < 25; $i++) { $card[$i] = $_SESSION['card' . $i]; } } if (isset($_GET['start'])) { if ($_SESSION['bj'] != 1){ $i = 1; while ($i < 24){ $t = 0; $card[$i] = rand(1,48); for($a = 1; $a < 25; $a++) { if ($card[$i] != $card[$a]){ $t++; } } if ($t == 23) { $i++; } } $_SESSION['total_cards'] = 2; $_SESSION['bj'] = 1; for($i = 1; $i < 25; $i++) { $_SESSION['card' . $i] = $card[$i]; } } } if ($_SESSION['bj'] == 1){ if (isset($_GET['hit'])) { $_SESSION['total_cards'] = $_SESSION['total_cards'] + 1; } $total_cards = $_SESSION['total_cards']; for($i = 1; $i < ($total_cards + 1); $i++) { if ($card[$i] == 8 OR $card[$i] == 16 OR $card[$i] == 24 OR $card[$i] == 32){ $value = '11'; } else if ($card[$i] == 12 OR $card[$i] == 24 OR $card[$i] == 36 OR $card[$i] == 48){$value = '10'; } else if ($card[$i] == 11 OR $card[$i] == 23 OR $card[$i] == 35 OR $card[$i] == 47){$value = '10'; } else if ($card[$i] == 10 OR $card[$i] == 22 OR $card[$i] == 34 OR $card[$i] == 46){$value = '10'; } else if ($card[$i] == 9 OR $card[$i] == 21 OR $card[$i] == 33 OR $card[$i] == 45){$value = '10'; } else if ($card[$i] == 8 OR $card[$i] == 20 OR $card[$i] == 32 OR $card[$i] == 44){$value = '9'; } else if ($card[$i] == 7 OR $card[$i] == 19 OR $card[$i] == 31 OR $card[$i] == 43){$value = '8'; } else if ($card[$i] == 6 OR $card[$i] == 18 OR $card[$i] == 30 OR $card[$i] == 42){$value = '7'; } else if ($card[$i] == 5 OR $card[$i] == 17 OR $card[$i] == 29 OR $card[$i] == 41){$value = '6'; } else if ($card[$i] == 4 OR $card[$i] == 16 OR $card[$i] == 28 OR $card[$i] == 40){$value = '5'; } else if ($card[$i] == 3 OR $card[$i] == 15 OR $card[$i] == 27 OR $card[$i] == 39){$value = '4'; } else if ($card[$i] == 2 OR $card[$i] == 14 OR $card[$i] == 26 OR $card[$i] == 38){$value = '3'; } else if ($card[$i] == 1 OR $card[$i] == 13 OR $card[$i] == 25 OR $card[$i] == 37){$value = '2'; } $total_value = $total_value + $value; } echo $total_value; if ($total_value > 21){ for($i = 1; $i < ($total_cards + 1); $i++) { if ($card[$i] == 8 OR $card[$i] == 16 OR $card[$i] == 24 OR $card[$i] == 32){ $ace = $ace + 1; } } while ($total_value > 21 AND $ace > 0){ $ace = $ace - 1; $total_value = $total_value - 10; } } if ($total_cards == 2 AND $total_value == 21){ $_SESSION['bj'] = 6; } if ($total_value > 21){ $_SESSION['bj'] = 2; } if (isset($_GET['stand'])) { while ($comp_total_value < 17){ $ace = 0; $comp_total_cards = $comp_total_cards + 1; $i = $comp_total_cards + 12; if ($card[$i] == 8 OR $card[$i] == 16 OR $card[$i] == 24 OR $card[$i] == 32){ $value = '11'; } else if ($card[$i] == 12 OR $card[$i] == 24 OR $card[$i] == 36 OR $card[$i] == 48){$value = '10'; } else if ($card[$i] == 11 OR $card[$i] == 23 OR $card[$i] == 35 OR $card[$i] == 47){$value = '10'; } else if ($card[$i] == 10 OR $card[$i] == 22 OR $card[$i] == 34 OR $card[$i] == 46){$value = '10'; } else if ($card[$i] == 9 OR $card[$i] == 21 OR $card[$i] == 33 OR $card[$i] == 45){$value = '10'; } else if ($card[$i] == 8 OR $card[$i] == 20 OR $card[$i] == 32 OR $card[$i] == 44){$value = '9'; } else if ($card[$i] == 7 OR $card[$i] == 19 OR $card[$i] == 31 OR $card[$i] == 43){$value = '8'; } else if ($card[$i] == 6 OR $card[$i] == 18 OR $card[$i] == 30 OR $card[$i] == 42){$value = '7'; } else if ($card[$i] == 5 OR $card[$i] == 17 OR $card[$i] == 29 OR $card[$i] == 41){$value = '6'; } else if ($card[$i] == 4 OR $card[$i] == 16 OR $card[$i] == 28 OR $card[$i] == 40){$value = '5'; } else if ($card[$i] == 3 OR $card[$i] == 15 OR $card[$i] == 27 OR $card[$i] == 39){$value = '4'; } else if ($card[$i] == 2 OR $card[$i] == 14 OR $card[$i] == 26 OR $card[$i] == 38){$value = '3'; } else if ($card[$i] == 1 OR $card[$i] == 13 OR $card[$i] == 25 OR $card[$i] == 37){$value = '2'; } $comp_total_value = $comp_total_value + $value; if ($comp_total_value > 21){ for($i = 13; $i < ($comp_total_cards + 13); $i++) { if ($card[$i] == 8 OR $card[$i] == 16 OR $card[$i] == 24 OR $card[$i] == 32){ $ace = $ace + 1; } } while ($comp_total_value > 21 AND $ace > 0){ $ace = $ace - 1; $comp_total_value = $comp_total_value - 10; } } } echo "Player: $total_value Bank: $comp_total_value"; if ($total_value == $comp_total_value){ $_SESSION['bj'] = 5; } if ($total_value < $comp_total_value ){ $_SESSION['bj'] = 4; } if ($total_value > $comp_total_value OR $comp_total_value > 21){ $_SESSION['bj'] = 3; } //win } else { $comp_total_cards = 1; } echo "Player Dealer "; if ($_SESSION['total_cards'] >= $i){ display_card( $card[$i] ); } echo " "; if (isset($_GET['stand'])) { if ($comp_total_cards >= $i){ display_card( $card[$c] ); } } else { $p++; if($p == 1){ display_card( $card['13'] ); } else if ($p == 2){ if ($_SESSION['bj'] == 6){ display_card( $card['14'] ); } else { echo "[img=img/back.gif]"; } } } echo " "; } echo "[url="blackjack.php?hit"]Hit[/url] [url="blackjack.php?stand"]Stand[/url] download the card graphics from here: http://notoriousonline.net/img.zip if you use this, and add querys to it, let me know, i would like to see it.... Quote Link to comment Share on other sites More sharing options...
seanybob Posted March 2, 2007 Share Posted March 2, 2007 Re: Black Jack that... is hot Quote Link to comment Share on other sites More sharing options...
UCC Posted March 2, 2007 Share Posted March 2, 2007 Re: Black Jack I did a quick and dirty 2.0 mod to it and threw it up. It needs a little polish, and as you said, queries but otherwise it is very well done. Quote Link to comment Share on other sites More sharing options...
Vorlen Posted March 2, 2007 Share Posted March 2, 2007 Re: Black Jack Haha, it logs you out when you finish a round, it unsets the session. Also, if I try and add queries I get told it's not a proper mysql result resource thing, which I tried to fix by adding the global $c,$userid crap but yeah, LMFAO. Well, I'll muck about with it and see what comes of it. :) Quote Link to comment Share on other sites More sharing options...
UCC Posted March 2, 2007 Share Posted March 2, 2007 Re: Black Jack Yea I had to remove that session stuff. I use sessions throughout my game and can't have em getting blown out willie nillie. :) But this mod is a great start and I'm excited to work with it Quote Link to comment Share on other sites More sharing options...
-Genocide- Posted March 2, 2007 Author Share Posted March 2, 2007 Re: Black Jack Thanks for the compliments, I didn't originally write the mod for MCCodes, I wrote it to go along with another site I had (not a game) and just converted it to work with MCCodes, but I'm glad you all are getting some use out of it. Quote Link to comment Share on other sites More sharing options...
Arson Posted March 2, 2007 Share Posted March 2, 2007 Re: Black Jack Awesome contribution. I wont be using it on my mccodes game but I will definitely use it on Crews of LA. Thanks!! Quote Link to comment Share on other sites More sharing options...
-Genocide- Posted March 2, 2007 Author Share Posted March 2, 2007 Re: Black Jack Thanks Arson, It's good to see positive feedback for once lol Quote Link to comment Share on other sites More sharing options...
UCC Posted March 3, 2007 Share Posted March 3, 2007 Re: Black Jack I had a 9 and a 6. I hit Stay. The dealer had a Queen. The dealer beat me with a score of 17. The catch? Here is the cards the dealer showed: Queen, 3, Ace, Queen, Jack, 3. I'm not that great at math but I think that is 37. EDIT: Okay. It happened a second time. Me: 6, 3, 5, Stand. Dealer: 10, 5, Ace, 8, 10, 2, K, 8, J, 2, 7. I Lose. The only common thread is the Ace as the third card. The only time it doesnt error is when that 3rd Ace gives 21. Edit X2: Here's an interesting one. Dealer: 4, Ace, 7, Queen, 7 Game thinks dealer has 19: Here's some cariable counts after each card: The comp_total_value actually drops with the 7. $comp_total_value $total_value $value 0 8 2 4 8 4 15 8 11 12 8 7 12 8 10 Quote Link to comment Share on other sites More sharing options...
UCC Posted March 3, 2007 Share Posted March 3, 2007 Re: Black Jack The problem is in the three large blocks of code that assign values and images to the card numbers. The Aces are all jacked up and that gets all your other numbers off count. In the display pic portion, you also need to make changes to the Type code where it assigns suits. Took me about 20 minutes to make neccessary changes. Quote Link to comment Share on other sites More sharing options...
-Genocide- Posted March 3, 2007 Author Share Posted March 3, 2007 Re: Black Jack glad ya got it working, lets see it Quote Link to comment Share on other sites More sharing options...
UCC Posted March 3, 2007 Share Posted March 3, 2007 Re: Black Jack You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
UCC Posted March 4, 2007 Share Posted March 4, 2007 Re: Black Jack That code helped a lot but there is still a problem somewhere. My dealer currently shows: 8, 7, Ace, Queen, 2 And thinks the dealer has 18. It completely skiipped counting the Queen. Just so everyone knows. Quote Link to comment Share on other sites More sharing options...
~Spooky~ Posted April 18, 2007 Share Posted April 18, 2007 Re: [mccode] Black Jack I have been looking for Black Jack for while now. Thanks Geno! Quote Link to comment Share on other sites More sharing options...
SoulOfDeath Posted April 18, 2007 Share Posted April 18, 2007 Re: [mccode] Black Jack is this for the v1 or v2 codes lol i love everyone posting these :-P just not many state what version it is for lol Quote Link to comment Share on other sites More sharing options...
Z?v?? Posted April 18, 2007 Share Posted April 18, 2007 Re: [mccode] Black Jack It's for v1. Quote Link to comment Share on other sites More sharing options...
SoulOfDeath Posted April 18, 2007 Share Posted April 18, 2007 Re: [mccode] Black Jack thanks (or v1.1 as well lol) Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted July 17, 2007 Share Posted July 17, 2007 Re: [mccode] Black Jack is this for the v1 or v2 codes lol i love everyone posting these :-P just not many state what version it is for lol If a code has this in it: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then it is v1 That can also be found in generalpage.php If it has You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. instead of all that then it is v2! Quote Link to comment Share on other sites More sharing options...
HITMAN 17 Posted September 6, 2007 Share Posted September 6, 2007 Re: [mccode] Black Jack never tryed black jac but it to complicated for me lol Quote Link to comment Share on other sites More sharing options...
Doki` Posted September 9, 2007 Share Posted September 9, 2007 Re: [mccode] Black Jack Black jack isn't complicated at all.... Quote Link to comment Share on other sites More sharing options...
3XTR3M3 Posted September 10, 2007 Share Posted September 10, 2007 Re: [mccode] Black Jack good mod Quote Link to comment Share on other sites More sharing options...
hrabik1 Posted February 1, 2008 Share Posted February 1, 2008 Re: [mccode] Black Jack +1 Quote Link to comment Share on other sites More sharing options...
lordfire Posted February 28, 2008 Share Posted February 28, 2008 Re: [mccode] Black Jack images link is not working Quote Link to comment Share on other sites More sharing options...
ronhouston2 Posted March 18, 2008 Share Posted March 18, 2008 Re: [mccode] Black Jack i need images for my black jack game Quote Link to comment Share on other sites More sharing options...
Doki` Posted April 26, 2008 Share Posted April 26, 2008 Re: [mccode] Black Jack Http://www.google.com Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.