Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. @@Blackjack
  2.  
  3. @name Blackjack
  4. @inputs
  5. @outputs Status:string Dealer You
  6. @persist Player:entity Session Bet
  7. @trigger
  8.  
  9. runOnChat(1)
  10. if(Session==0&chatClk()&lastSaid():lower()=="register"){
  11. Player=lastSpoke()
  12. Session=1
  13. Status="Playing"
  14. }
  15. if(Session==1&chatClk()&lastSaid():lower():left(4)=="bet$"&lastSpoke()==Player){
  16. Bet=clamp(int(lastSaid():right(lastSaid():length()-4):toNumber()),10,20000)
  17. askForMoney(lastSpoke(),Bet, "Blackjack Macheen!")
  18. }
  19. if(Session==1&deductClk()){
  20. Dealer=0
  21. Bet=deductAmount()
  22. Session=2
  23. Card1=randint(1,13)
  24. if(Card1>10){
  25. Status="Picture Card"
  26. } else {
  27. Status="You got a " + Card1:toString()
  28. }
  29. You=clamp(Card1,1,10)
  30. }
  31. if(Session==1&chatClk()&lastSaid():lower()=="leave"&(lastSpoke()==Player|lastSpoke()==owner())){
  32. Session=0
  33. Status="Open"
  34. }
  35. if(Session==2&chatClk()&lastSaid():lower()=="hit me"&lastSpoke()==Player){
  36. Card=randint(1,13)
  37. You=You+clamp(Card,1,10)
  38. if(Card>10){
  39. Status="Picture Card"
  40. } else {
  41. Status="You got a " + Card:toString()
  42. }
  43. if(You>21){
  44. Status="You got a " + Card:toString() + " and Bust"
  45. Session=1
  46. }
  47. }
  48. if(Session==2&chatClk()&lastSaid():lower()=="fold"&lastSpoke()==Player){
  49. Session=1
  50. Status="Playing"
  51. }
  52. if(Session==2&chatClk()&lastSaid():lower()=="sit"&lastSpoke()==Player){
  53. Dealer=randint(17,23)
  54. if(Dealer>21){
  55. Status="Dealer Bust"
  56. giveMoney(Player,Bet*2)
  57. Session=1
  58. exit()
  59. }
  60. if(You>Dealer){
  61. giveMoney(Player,Bet*2)
  62. Status="You Win!"
  63. if(You==21){
  64. giveMoney(Player,Bet*2)
  65. Status="You got 21!"
  66. }
  67. Session=1
  68. } else{
  69. Status="Dealer wins"
  70. Session=1
  71. }
  72. }
  73.  
  74.  
  75. @@Lottery
  76.  
  77. @name Lottery
  78. @inputs Value CS:wirelink Play:entity Draw
  79. @outputs Players:array Values:array Jackpot Sum
  80. @persist WinChk Winner:entity
  81. @trigger
  82.  
  83. if(deductClk()){
  84. Index=Players:count()+1
  85. Amount=deductAmount()
  86. Players[Index,entity]=deductPlayer()
  87. Values[Index,number]=Amount
  88. }
  89. if(Play:isPlayer()&Value>10){
  90. askForMoney(Play,Value)
  91. }
  92. X=0
  93. while(X<Players:count()){
  94. X++
  95. Name=Players:entity(X):name():left(23)
  96. CS:writeString(Name + ":$" + Values:number(X):toString(),0,X)
  97. }
  98. Sum=0
  99. X=0
  100. while(X<Players:count()){
  101. X++
  102. Sum=Sum+Values:number(X)
  103. }
  104. Jackpot=Sum
  105. if(Draw==1){
  106. X=0
  107. WinnerInt=randint(0,Sum)
  108. Sum=0
  109. while(X<Players:count()){
  110. X++
  111. if(WinnerInt>Sum&WinnerInt<(Sum+Values:number(X))){
  112. Winner=Players:entity(X)
  113. WinChk=1
  114. }
  115. Sum=Sum+Values:number(X)
  116. }
  117. }
  118. if(WinChk==1){
  119. CS:writeString(Winner:name():left(20) + " HAS WON",0,7,944,633,1)
  120. giveMoney(Winner,Jackpot)
  121. timer("reset",3000)
  122. WinChk=0
  123. }
  124.  
  125. if(clk("reset")){
  126. Jackpot=0
  127. WinChk=0
  128. Players=array()
  129. Values=array()
  130. }
  131.  
  132.  
  133. @@Slotspinner
  134.  
  135. @name SlotsSpinner
  136. @inputs Player:entity Go
  137. @outputs TxtClk Screen1:string Screen2:string Screen3:string
  138. @persist Gone SC1 SC2 SC3 ActivePlayer:entity
  139. @trigger
  140.  
  141. TxtClk=1
  142. if(clk("go")){
  143. if(SC1-Gone<65){
  144. Screen1=toChar(91+(SC1-Gone-65))
  145. } else {
  146. Screen1=toChar(SC1-Gone)
  147. }
  148. if(SC2-Gone<65){
  149. Screen2=toChar(91+(SC2-Gone-65))
  150. } else {
  151. Screen2=toChar(SC2-Gone)
  152. }
  153. if(SC3-Gone<65){
  154. Screen3=toChar(91+(SC3-Gone-65))
  155. } else {
  156. Screen3=toChar(SC3-Gone)
  157. }
  158. Gone=Gone-1
  159. if(Gone>0){
  160. timer("go",600-(Gone*100))
  161. } else {
  162. Done=1
  163. }
  164. }
  165. if(deductClk()){
  166. SC1=randint(66,91)
  167. SC2=randint(66,91)
  168. SC3=randint(66,91)
  169. timer("go",100)
  170. Gone=5
  171. }
  172. if(Done==1){
  173. if(SC1==91&SC2==91&SC3==91){
  174. giveMoney(ActivePlayer,5000)
  175. }
  176. elseif(SC1==SC2&SC2==SC3){
  177. giveMoney(ActivePlayer,1000)
  178. }
  179. elseif(SC1==SC2|SC2==SC3|SC1==SC3){
  180. giveMoney(ActivePlayer,50)
  181. }
  182. }
  183. if(Go==1&Player:isPlayer()){
  184. askForMoney(Player,10, "Slots Machine!")
  185. ActivePlayer=Player
  186. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement