Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on *:JOIN:#: {
- if ($nick == ramos_online) {
- // This timer sets the $switchBankheistOn alias every 15 minutes.
- // The $ is not used for the alias when inside a timer command
- timerSwitchBankheist 0 600 switchBankheistOn $chan %bankheistIsOn
- }
- on *:TEXT:!start:#: {
- timerSwitchBankheist 0 600 switchBankheistOn $chan %bankheistIsOn
- }
- }
- // Format: !shave [amount]
- // This command goes through several checks before finally adding the player to the list %bankheistFile, an .ini file.
- on *:text:!shave*:#: {
- if (%bankheistIsOn == $false) {
- msg $chan /me The furfrous are sill awake!
- }
- else {
- var %section = $+(#, ., $nick)
- var %currentPoints = $readini(points.ini, %section, points)
- if (%currentPoints == 0 || %currentPoints == $null) {
- msg $chan /me $nick you have no cotton.
- }
- elseif ($0 == 1 || $2 !isnum) {
- msg $chan $nick you must enter an amount from your current cotton bolls.
- }
- elseif ($2 > %currentPoints || $2 == 0) {
- msg $chan $nick you must enter a bet you can afford and is not 0 [Points available: $+(%currentpoints, ]).
- }
- else {
- var %ID = $findID(%bankheistFile, $ini(%bankheistFile, 0), $nick)
- if (%ID != 0) {
- var %bet = $readini(%bankheistFile, %ID, bet)
- msg $chan $nick you have already betted %bet cotton bolls
- return
- }
- // msg $chan /me Now adding $nick to the shaving crew list...
- writeini -n %bankheistFile $calc(%bankheistID + 1) name $nick
- writeini -n %bankheistFile $calc(%bankheistID + 1) bet $2
- inc %bankheistID
- }
- }
- }
- alias -l switchBankheistOn {
- %bankheistIsOn = $true
- write -c %bankheistFile
- 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.
- timerBankheistDuration 1 60 processBankheist $1
- }
- alias -l processBankheist {
- if ($ini(%bankheistFile, 0) == 0) {
- %bankheistIsOn = $false
- msg $1 /me No one joined the shave heist! The furfrous are safe for now.
- return
- }
- else {
- %bankheistIsOn = $false
- msg $1 /me The shave heist is now starting! Good luck!
- var %people = $ini(%bankheistFile, 0)
- var %chances = 0
- var %winningsRatio = 1
- if (%people >= 31) {
- %chances = 66
- %winningsRatio = 1
- }
- elseif (%people < 31 && %people >= 20) {
- %chances = $calc(35 + %people)
- %winningsRatio = 1
- }
- else {
- %chances = $calc(35 + %people)
- if (%people < 20 && %people >= 10) {
- %winningsRatio = 2
- }
- elseif (%people < 10) {
- %winningsRatio = 3
- }
- }
- msg $1 /me the current chances of succeding: $+(%chances, %)
- var %winnersList = The winners of this shave heist are:
- var %winnersListEmpty = $true
- var %i = 1
- msg $1 /me number of people in the bankheist: %people
- while (%i <= %people) {
- // Chooses a random number between 1 and 100. If the number is within our chances, then the bankheist will be a success.
- var %name = $readini(%bankheistFile, %i, name)
- var %bet = $readini(%bankheistFile, %i, bet)
- var %currentPoints = $readini(points.ini, $+($1, ., %name), points)
- var %randomNum = $rand(1, 100)
- if (%randomNum <= %chances) {
- writeini -n points.ini $+($1, ., %name) points $calc(%currentPoints + %winningsRatio * %bet)
- %winnersList = $+(%winnersList, $chr(32), %name)
- %winnersListEmpty = $false
- }
- else {
- writeini -n points.ini $+($1, ., %name) points $calc(%currentPoints - %bet)
- }
- inc %i
- }
- if (%winnersListEmpty == $true) {
- msg $1 /me No one survived, the furfrous are just OP!
- }
- else {
- msg $1 /me %winnersList
- }
- %bankheistID = 0
- }
- }
- // Format: $findID([file], [fileID], [user])
- // Returns the ID of the user in the specified file, or 0 if the user is not in that file
- alias -l findID {
- var %file = $1
- var %ID = $2
- var %user = $3
- var %i = 1
- while (%i <= %ID) {
- if ($readini(%file, %i, name) == %user) {
- return %i
- }
- inc %i
- }
- return 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement