1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
; Advert script by Teppuli & AndRew
on 9:text:!advert:#:{
notice $nick 0,1« 9:0:9:0,1 »0 Usage: $1 enable/disable/add/del/time/setmode/list/version/status 0,1« 9:0:9:0,1 »0
}
on 1:CONNECT:{
var %i = 1
while (%i <= $ini(advert.ini,0)) {
if ($readini(advert.ini,$ini(advert.ini,%i),status) == on) {
var %expr = $+(60,*,$readini(advert.ini,$ini(advert.ini,%i),time))
timeradvert [ $+ [ $ini(advert.ini,%i) ] ] 0 $calc(%expr) advertise $ini(advert.ini,%i)
}
inc %i
}
}
on 9:text:!advert *:#:{
if ($2 == time) {
if (!$3) { notice $nick 0,1« 9:0:9:0,1 »0 Usage: $1-2 <time in minutes> 0,1« 9:0:9:0,1 »0 | halt }
if ($3 !isnum 1-9999) { notice $nick 0,1« 9:0:9:0,1 »0 Error! 0,1« 9:0:9:0,1 »0 Specify <time> in minutes! 0,1« 9:0:9:0,1 »0 | halt }
writeini advert.ini $chan time $3
notice $nick 0,1« 9:0:9:0,1 »0 Done 0,1« 9:0:9:0,1 »0
timeradvert [ $+ [ $chan ] ] off
var %expr = $+(60,*,$3)
timeradvert [ $+ [ $chan ] ] 0 $calc(%expr) advertise $chan
halt
}
if ($2 == enable) {
if (!$readini(advert.ini,$chan,time)) { notice $nick 0,1« 9:0:9:0,1 »0 TIME not set. 0,1« 9:0:9:0,1 »0 Please type $1 to set it. 0,1« 9:0:9:0,1 »0 | halt }
var %expr = $+(60,*,$readini(advert.ini,$chan,time))
timeradvert [ $+ [ $chan ] ] 0 $calc(%expr) advertise $chan
writeini advert.ini $chan status on
notice $nick 0,1« 9:0:9:0,1 »0 Done. 0,1« 9:0:9:0,1 »0
halt
}
if ($2 == disable) {
timeradvert [ $+ [ $chan ] ] off
writeini advert.ini $chan status off
notice $nick 0,1« 9:0:9:0,1 »0 Done. 0,1« 9:0:9:0,1 »0
halt
}
if ($2 == status) {
notice $nick 0,1« 9:0:9:0,1 »0 Advert script status on this channel: $iif($timer(advert $+ $chan),ON,OFF) 0,1« 9:0:9:0,1 »0
if ($timer(advert $+ $chan) != 1) { halt }
notice $nick 0,1« 9:0:9:0,1 »0 Advert modes: $readini(advert.ini,$chan,modes) 0,1« 9:0:9:0,1 »0
notice $nick 0,1« 9:0:9:0,1 »0 Advert time: $readini(advert.ini,$chan,time) minute(s) 0,1« 9:0:9:0,1 »0
halt
}
if ($2 == version) {
msg $chan 0,1« 9:0:9:0,1 »0 MSL Advert script by Teppuli & AndRew (#teppuli & #AndRew @ QuakeNet) 0,1« 9:0:9:0,1 »0 Linecount: $lines($script) 0,1« 9:0:9:0,1 »0 Copyright (C) 2008 Teppuli & AndRew 0,1« 9:0:9:0,1 »0
halt
}
if ($2 == setmode) {
if (!$3) { notice $nick 0,1« 9:0:9:0,1 »0 Usage: $1-2 <Modes set when advertising. Example: +m-c> 0,1« 9:0:9:0,1 »0 | halt }
writeini advert.ini $chan modes $3
notice $nick 0,1« 9:0:9:0,1 »0 Done 0,1« 9:0:9:0,1 »0
halt
}
if ($2 == del) {
if (!$3) { notice $nick 0,1« 9:0:9:0,1 »0 Usage: $1-2 <advert id to remove> 0,1« 9:0:9:0,1 »0 | halt }
remini adverts.ini $chan $3
notice $nick 0,1« 9:0:9:0,1 »0 Done. 0,1« 9:0:9:0,1 »0
halr
}
if ($2 == list) {
if ($ini(adverts.ini,$chan) == 0) { notice $nick 0,1« 9:0:9:0,1 »0 No adverts on this channel. 0,1« 9:0:9:0,1 »0 | halt }
notice $nick 0,1« 9:0:9:0,1 »0 Advert list: 0,1« 9:0:9:0,1 »0
var %i = 1
while (%i <= $ini(adverts.ini,$chan,0)) {
var %id = $ini(adverts.ini,$chan,%i)
var %ad = $readini(adverts.ini,$chan,$ini(adverts.ini,$chan,%i))
notice $nick 0,1« 9:0:9:0,1 »0 ID: %id $+ . 0,1« 9:0:9:0,1 »0 Advert: %ad 0,1« 9:0:9:0,1 »0
inc %i
}
notice $nick 0,1« 9:0:9:0,1 »0 End of adverts list 0,1« 9:0:9:0,1 »0
halt
}
if ($2 == add) {
if (!$3) { notice $nick 0,1« 9:0:9:0,1 »0 Usage: $1-2 <advert> 0,1« 9:0:9:0,1 »0 | halt }
if (!$readini(adverts.ini,$chan,1)) { var %id = 1 }
if ($readini(adverts.ini,$chan,1)) { var %expr = $+($ini(adverts.ini,$chan,0),+,1) | var %id = $calc(%expr) }
writeini adverts.ini $chan %id $3-
notice $nick 0,1« 9:0:9:0,1 »0 Done 0,1« 9:0:9:0,1 »0
halt
}
notice $nick 0,1« 9:0:9:0,1 »0 Usage: $1 add/del/time/setmode/list/version/status 0,1« 9:0:9:0,1 »0
}
alias advertise {
if ($readini(advert.ini,$1,num) == $NULL) {
mode $1 $readini(advert.ini,$1,modes)
msg $1 $readini(adverts.ini,$1,$ini(adverts.ini,$1,1))
mode $1 $reverse($readini(advert.ini,$1,modes))
writeini advert.ini $1 num 1
halt
}
var %expr = $readini(advert.ini,$1,num) $+ + 1
if (!$readini(adverts.ini,$1,$ini(adverts.ini,$1,$calc(%expr)))) { var %expr = 1 }
mode $1 $readini(advert.ini,$1,modes)
msg $1 $readini(adverts.ini,$1,$ini(adverts.ini,$1,$calc(%expr)))
mode $1 $reverse($readini(advert.ini,$1,modes))
writeini advert.ini $1 num $calc(%expr)
}
alias -l reverse {
return $replace($replace($1,$chr(43),plus,$chr(45),minus),plus,$chr(45),minus,$chr(43))
}
|