Advertisement
Guest User

For ramos_online

a guest
Mar 30th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. on *:JOIN:#: {
  2. if ($nick == ramos_online) {
  3. // This timer sets the $switchBankheistOn alias every 15 minutes.
  4. // The $ is not used for the alias when inside a timer command
  5. timerSwitchBankheist 0 600 switchBankheistOn $chan %bankheistIsOn
  6. }
  7.  
  8. on *:TEXT:!start:#: {
  9. timerSwitchBankheist 0 600 switchBankheistOn $chan %bankheistIsOn
  10. }
  11.  
  12. }
  13.  
  14. // Format: !shave [amount]
  15. // This command goes through several checks before finally adding the player to the list %bankheistFile, an .ini file.
  16. on *:text:!shave*:#: {
  17. if (%bankheistIsOn == $false) {
  18. msg $chan /me The furfrous are sill awake!
  19. }
  20. else {
  21. var %section = $+(#, ., $nick)
  22. var %currentPoints = $readini(points.ini, %section, points)
  23. if (%currentPoints == 0 || %currentPoints == $null) {
  24. msg $chan /me $nick you have no cotton.
  25. }
  26. elseif ($0 == 1 || $2 !isnum) {
  27. msg $chan $nick you must enter an amount from your current cotton bolls.
  28. }
  29. elseif ($2 > %currentPoints || $2 == 0) {
  30. msg $chan $nick you must enter a bet you can afford and is not 0 [Points available: $+(%currentpoints, ]).
  31. }
  32. else {
  33. var %ID = $findID(%bankheistFile, $ini(%bankheistFile, 0), $nick)
  34. if (%ID != 0) {
  35. var %bet = $readini(%bankheistFile, %ID, bet)
  36. msg $chan $nick you have already betted %bet cotton bolls
  37. return
  38. }
  39. // msg $chan /me Now adding $nick to the shaving crew list...
  40. writeini -n %bankheistFile $calc(%bankheistID + 1) name $nick
  41. writeini -n %bankheistFile $calc(%bankheistID + 1) bet $2
  42. inc %bankheistID
  43. }
  44. }
  45. }
  46.  
  47. alias -l switchBankheistOn {
  48. %bankheistIsOn = $true
  49. write -c %bankheistFile
  50. msg $1 Come one, come all! The furfrous are asleep, get ready to shave some of their fur! Use !shave [points] to bet. 60 seconds remaining to join.
  51. timerBankheistDuration 1 60 processBankheist $1
  52. }
  53.  
  54.  
  55. alias -l processBankheist {
  56. if ($ini(%bankheistFile, 0) == 0) {
  57. %bankheistIsOn = $false
  58. msg $1 /me No one joined the shave heist! The furfrous are safe for now.
  59. return
  60. }
  61. else {
  62. %bankheistIsOn = $false
  63. msg $1 /me The shave heist is now starting! Good luck!
  64.  
  65. var %people = $ini(%bankheistFile, 0)
  66. var %chances = 0
  67. var %winningsRatio = 1
  68. if (%people >= 31) {
  69. %chances = 66
  70. %winningsRatio = 1
  71. }
  72. elseif (%people < 31 && %people >= 20) {
  73. %chances = $calc(35 + %people)
  74. %winningsRatio = 1
  75. }
  76. else {
  77. %chances = $calc(35 + %people)
  78. if (%people < 20 && %people >= 10) {
  79. %winningsRatio = 2
  80. }
  81. elseif (%people < 10) {
  82. %winningsRatio = 3
  83. }
  84. }
  85. msg $1 /me the current chances of succeding: $+(%chances, %)
  86. var %winnersList = The winners of this shave heist are:
  87. var %winnersListEmpty = $true
  88. var %i = 1
  89. msg $1 /me number of people in the bankheist: %people
  90. while (%i <= %people) {
  91. // Chooses a random number between 1 and 100. If the number is within our chances, then the bankheist will be a success.
  92. var %name = $readini(%bankheistFile, %i, name)
  93. var %bet = $readini(%bankheistFile, %i, bet)
  94.  
  95. var %currentPoints = $readini(points.ini, $+($1, ., %name), points)
  96. var %randomNum = $rand(1, 100)
  97. if (%randomNum <= %chances) {
  98. writeini -n points.ini $+($1, ., %name) points $calc(%currentPoints + %winningsRatio * %bet)
  99. %winnersList = $+(%winnersList, $chr(32), %name)
  100. %winnersListEmpty = $false
  101. }
  102. else {
  103. writeini -n points.ini $+($1, ., %name) points $calc(%currentPoints - %bet)
  104. }
  105. inc %i
  106. }
  107. if (%winnersListEmpty == $true) {
  108. msg $1 /me No one survived, the furfrous are just OP!
  109. }
  110. else {
  111. msg $1 /me %winnersList
  112. }
  113. %bankheistID = 0
  114. }
  115. }
  116.  
  117. // Format: $findID([file], [fileID], [user])
  118. // Returns the ID of the user in the specified file, or 0 if the user is not in that file
  119. alias -l findID {
  120. var %file = $1
  121. var %ID = $2
  122. var %user = $3
  123. var %i = 1
  124.  
  125. while (%i <= %ID) {
  126. if ($readini(%file, %i, name) == %user) {
  127. return %i
  128. }
  129. inc %i
  130. }
  131. return 0
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement