Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on *:TEXT:!buyticket &:#:{
- if (%open == 1) {
- if ($isfile(Raffle.txt)) {
- filter -ff Raffle.txt NUL $nick
- }
- if ($filtered == 10) {
- msg # Sorry, $nick $+ , but you cannot buy any more tickets.
- }
- elseif ($calc($v1 + $2) > 10) {
- msg # $nick $+ , you cannot buy that many tickets!
- }
- else {
- var %i = 0
- var %count = $2
- var %topic = $+(#,.,$nick)
- var %user = $readini(Points.ini,%topic,Points)
- var %final = 10 * %count
- var %remove = %user - %final
- if (%remove >= 0) {
- writeini -n Points.ini %topic Points %remove
- while (%i < %count) {
- write Raffle.txt $nick
- %i = %i + 1
- }
- msg $chan $nick $+ , has bought %count tickets spending %final points!
- }
- else {
- msg $chan Sorry $nick but you don't have enough points to buy %count tickets!
- }
- }
- }
- }
- on *:TEXT:!chances:#:{
- if (%open == 1) && ($isfile(Raffle.txt)) {
- filter -ff Raffle.txt NUL $nick
- var %chance = $calc($filtered / $lines(Raffle.txt)) * 100
- msg # $nick $+ , You have a %chance $+ % chance of winning the raffle!
- if (%chance == 0) msg # Why don't you buy some tickets? !buyticket NUMBER_OF_TICKETS
- }
- }
- on *:TEXT:*:#:{
- if ($nick isop #) {
- if ($1 == !raffle) {
- if ($2 == open) {
- msg $chan /me [RAFFLE STARTED]
- set %open 1
- write -c Raffle.txt
- echo -a Raffle Started
- }
- elseif ($2 == close) {
- msg $chan /me [RAFFLE CLOSED]
- set %open 0
- write -c Raffle.txt
- echo -a Raffle Closed
- }
- elseif ($2 == cancel) && ($isfile(Raffle.txt)) {
- set %open 0
- window -hls @raffle
- var %matches, %topic
- loadbuf @raffle Raffle.txt
- while ($line(@raffle, 1) != $null) {
- %matches = $fline(@raffle, $v1, 0)
- %topic = $+(#,.,$v1)
- writeini -n points.ini %topic points $calc(%matches * 10 + $readini(points.ini, n, %topic, points))
- dline @raffle 1- $+ %matches
- }
- describe # The raffle has been cancelled by $nick $+ ; all points have been refunded.
- write -c Raffle.txt
- close -@ @raffle
- }
- }
- elseif ($1 == !draw) {
- if (%open == 1) {
- var %user = $read(Raffle.txt,n)
- write -c Raffle.txt
- set %open 0
- msg $chan /me And the winner is... %user $+ !!! Well Done!
- echo -a Raffle Closed
- }
- }
- }
- if ($1 == !tickets) {
- if (%open == 1) {
- msg $chan There are currently $lines(Raffle.txt) tickets entered into the raffle!
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement