Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. enum pInfo
  2. {
  3. pDice,
  4. };
  5.  
  6. new BlackJackOffer[MAX_PLAYERS];
  7. new BlackJackAmount[MAX_PLAYERS];
  8.  
  9. CMD:blackjack(playerid, params[])
  10. {
  11.  
  12. new string[128], giveplayerid, offerAmount;
  13.  
  14. if(sscanf(params, "u", giveplayerid, offerAmount))
  15. return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /blackjack [playerid/partofname] [amount]");
  16. }
  17. else if(!IsPlayerConnected(giveplayerid)) {
  18. SendClientMessage(playerid, COLOR_GRAY, "Invalid player specified.");
  19. }
  20. if(IsPlayerConnected(BlackJackOffer[playerid])) {
  21. if(GetPlayerCash(playerid) > offerAmount[playerid]) {
  22. if(playerid == giveplayerid)
  23. {
  24. SendClientMessage(playerid, COLOR_GREY, "You can't use this command on yourself.");
  25. return 1;
  26. }
  27. if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "Player is currently not connected to the server.");
  28. if(ProxDetectorS(8.0, playerid, giveplayerid))
  29. {
  30. BlackJackOffer[giveplayerid] = playerid;
  31. BlackJackAmount[giveplayerid] = offerAmount;
  32. format(string, sizeof(string), "* You offered %s in blackjack at $%d.", GetPlayerNameEx(giveplayerid), offerAmount);
  33. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  34. format(string, sizeof(string), "* %s has offered you %s in blackjack, (type /acceptblackjack) to buy.", GetPlayerNameEx(playerid), price);
  35. SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
  36. return 1;
  37. }
  38. else
  39. {
  40. SendClientMessage(playerid, COLOR_GREY, "That player is not near you.");
  41. return 1;
  42. }
  43. }
  44. }
  45. return;
  46. }
  47.  
  48.  
  49.  
  50. CMD:acceptblackjack(playerid, params[])
  51. {
  52.  
  53. new string[128];
  54. new aBJdice = random(6)+1;
  55. new aBJdice1 = random(6)+1;
  56. new aBJdice2 = random(6)+1;
  57. new oBJdice = random(6)+1;
  58. new oBJdice1 = random(6)+1;
  59. new oBJdice2 = random(6)+1;
  60. new sendername[MAX_PLAYER_NAME];
  61. new giveplayer[MAX_PLAYER_NAME];
  62.  
  63. if(BlackJackOffer[playerid] < 999) {
  64. if(PlayerInfo[playerid][pDice])
  65. {
  66. format(string, sizeof(string), "* %s rolls a dice that lands on %d.", GetPlayerNameEx(playerid),aBJdice);
  67. format(string, sizeof(string), "* rolls again, dice that lands on %d.", GetPlayerNameEx(playerid),aBJdice1);
  68. format(string, sizeof(string), "* rolls again, dice that lands on %d.", GetPlayerNameEx(playerid),aBJdice2);
  69. format(string, sizeof(string), "* %s rolls a dice that lands on %d.", GetPlayerNameEx(playerid),oBJdice);
  70. format(string, sizeof(string), "* rolls again, dice that lands on %d.", GetPlayerNameEx(playerid),oBJdice1);
  71. format(string, sizeof(string), "* rolls again, dice that lands on %d.", GetPlayerNameEx(playerid),oBJdice2);
  72. ProxDetector(5.0, playerid, string, COLOR_DICEROLL,COLOR_DICEROLL,COLOR_DICEROLL,COLOR_DICEROLL,COLOR_DICEROLL);
  73. aHighestDice = aBJdice + aBJdice1 + aBJdice2;
  74. oHighestDice = oBJdice + oBJdice1 + oBJdice2;
  75. if(aHighestDice > 21){
  76. SendClientMessage(playerid, COLOR_WHITE, "You bust, offerer wins.");
  77. GivePlayerCash(playerid,-BlackJackAmount[playerid]);
  78. return 1;
  79. }
  80. else if(oHighestDice > 21){
  81. SendClientMessage(playerid, COLOR_WHITE, "The offerer bust, you win.");
  82. GivePlayerCash(giveplayerid,-BlackJackAmount[playerid]);
  83. return 1;
  84. }
  85.  
  86. }
  87. else
  88. {
  89. SendClientMessage(playerid, COLOR_GRAY, "You don't have a dice.");
  90. return 1;
  91. }
  92. else
  93. {
  94. SendClientMessage(playerid, COLOR_GREY, "Nobody offered you blackjack.");
  95. return 1;
  96. }
  97. return 1;
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement