Advertisement
Guest User

Untitled

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