Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Draw script by Sashy and ruanmed
- ;Sashy sucks
- ;January 4th, 2014
- ;---------------------------------------------
- ;1.Intructions
- ;1.1.- Commands
- ;1.1.To generate tickets use the command !draw.
- ;1.1.After everyone gets their ticket you can pick the winner with the command !pick.
- ;---------------------------------------------
- ;2.Setting up
- ;2.1.- Channel
- ;2.1.Set up the channel with a right click on channel window or /drawchannel #channel
- ;2.2.E.G: /drawchannel #Draw - Will set the game channel to #Draw
- ;2.2.- Spam protection
- ;2.2.Set up the amount of time you want the spam protection to be with a right click
- ;2.2.on channel window or /drawspamtime [amount_of_seconds]
- ;2.2.E.G: /drawspamtime 30 - Will set the spam protection for 30 seconds.
- ;2.2.Default time is 60 seconds.
- ;---------------------------------------------
- ;---------------------------------------------
- ;~Have fun
- ;---------------------------------------------
- ;Dialogs and menus
- ;---------------------------------------------
- ;---------------------------------------------
- ;Aliases
- ;---------------------------------------------
- alias drawchannel { ;Alias to set the variable %draw.channel and output confirmation message.
- set %draw.channel $$1
- echo -a 0,1 The Draw Game channel was successfully set to $$1 $+ !
- }
- alias drawspamtime { ;Alias to set the variable %draw.spamtime and output confirmation message.
- set %draw.spamtime $$1
- echo -a 0,1 The spam protection time was successfully set to $$1 seconds!
- }
- ;---------------------------------------------
- ;On/Off switcher
- ;---------------------------------------------
- on *:text:!draw *:%draw.channel: {
- if ($nick isop %draw.channel) {
- if ($$2 == on) {
- enable #draw
- msg $chan The Draw Game script by Sashy and ruanmed was 9enabled!
- }
- if ($$2 == off) {
- disable #draw
- msg $chan The Draw Game script by Sashy and ruanmed was 4disabled!
- }
- }
- }
- ;---------------------------------------------
- ;Actions
- ;---------------------------------------------
- #draw off
- on *:text:!draw:%draw.channel: {
- if (%draw. [ $+ [ $nick ] ] == 1) { ;Protection against spammers!
- notice $nick $nick stop being greedy you already got your ticket.
- }
- else { ;Generating dem numbers
- var %n1 = $r(1,10)
- var %n2 = $r(1,10)
- while (%n2 == %n1) {
- var %n2 = $r(1,10)
- }
- var %n3 = $r(1,10)
- while (%n3 == %n2 || %n3 == %n1) {
- var %n3 = $r(1,10)
- }
- var %n4 = $r(1,10)
- while (%n4 == %n3 || %n4 == %n2 || %n4 == %n1) {
- var %n4 = $r(1,10)
- }
- var %n5 = $r(1,10)
- while (%n5 == %n4 || %n5 == %n3 || %n5 == %n2 || %n5 == %n1) {
- var %n5 = $r(1,10)
- }
- var %n6 = $r(1,10)
- while (%n6 == %n5 || %n6 == %n4 || %n6 == %n3 || %n6 == %n2 || %n6 == %n1) {
- var %n6 = $r(1,10)
- }
- ;Generating the ticket number
- inc %ticketn
- ;Now let's write the info into the tickets.dat file
- writeini -n tickets.dat %ticketn player $nick
- writeini -n tickets.dat %ticketn n1 %n1
- writeini -n tickets.dat %ticketn n2 %n2
- writeini -n tickets.dat %ticketn n3 %n3
- writeini -n tickets.dat %ticketn n4 %n4
- writeini -n tickets.dat %ticketn n5 %n5
- writeini -n tickets.dat %ticketn n6 %n6
- ;Sending the message to the channel, so that the socker knows his numbers :<
- msg #Sashy $nick $+ $chr(44) thank you for participating, your numbers are $chr(91) $+ %n1 $+ $chr(93) $chr(91) $+ %n2 $+ $chr(93) $chr(91) $+ %n3 $+ $chr(93) $chr(91) $+ %n4 $+ $chr(93) $chr(91) $+ %n5 $+ $chr(93) $chr(91) $+ %n6 $+ $chr(93) $+ $chr(46) Ticket $chr(35) $+ %ticketn $+ $chr(46)
- ;dat spam protection only is in effect because of the following line
- set -u60 %draw. $+ $nick 1
- }
- }
- on *:text:!pick:%draw.channel: {
- if ($nick isop %draw.channel) {
- if (%ticketn != 0) {
- msg $chan Drawing the winning ticket...
- ;Generating the winner
- set %ticket $r(1,%ticketn)
- set %winner $readini(tickets.dat,%ticket,player)
- ;Timed message to the channel
- timer 1 5 /msg $chan And our lucky winner is %winner $+ $chr(44) with the ticket $chr(35) $+ %ticket $+ $chr(46)
- ;Reseting the ticket count and cleaning the tickets file
- set %ticketn 0
- write -c tickets.dat
- }
- else { ;Message to be sent if there's no tickets
- msg $chan There's currently no tickets registered!
- }
- }
- }
- #draw end
- ;---------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement