tglogo.png

Downloading File

Filename: Advertising System
dialog ads {
  title "Ad Setup"
  size -1 -1 432 166
  option dbu
  edit "", 1, 6 12 414 12, autohs
  box "Ad 1", 2, 2 2 424 46
  edit "Status Ad1", 3, 6 28 80 12, disable center
  button "Enable/Save", 4, 90 28 37 12, flat
  button "Disable", 5, 132 28 37 12, flat
  edit "Display Ad1 Time", 6, 236 30 100 12, disable center
  text "Display Ad Every:", 7, 170 32 63 8, right
  button "+Hr", 8, 340 30 19 12, flat
  button "-Hr", 9, 360 30 19 12, flat
  button "+Min", 10, 382 30 19 12, flat
  button "-Min", 11, 402 30 19 12, flat
  box "Ad 2", 12, 4 52 424 46
  edit "", 13, 8 62 414 12, autohs
  text "Display Ad Every:", 14, 172 82 63 8, right
  edit "Display Time", 15, 238 80 100 12, disable center
  edit "Status", 16, 8 78 82 12, disable center
  button "Enable/Save", 17, 92 78 37 12, flat
  button "Disable", 18, 134 78 37 12, flat
  button "-Min", 19, 404 80 19 12, flat
  button "+Min", 20, 384 80 19 12, flat
  button "-Hr", 21, 362 80 19 12, flat
  button "+Hr", 22, 342 80 19 12, flat
  box "Ad 3", 23, 6 102 424 46
  text "Display Ad Every:", 24, 174 132 63 8, right
  button "-Min", 25, 406 130 19 12, flat
  button "+Min", 26, 386 130 19 12, flat
  button "-Hr", 27, 364 130 19 12, flat
  button "+Hr", 28, 344 130 19 12, flat
  button "Enable/Save", 29, 96 128 37 12, flat
  button "Disable", 30, 136 128 37 12, flat
  edit "Display Time", 31, 240 130 100 12, disable center
  edit "Status ", 32, 10 128 82 12, disable center
  edit "", 33, 10 112 414 12, autohs
  button "Close", 34, 390 152 37 10, flat ok cancel
}
on *:DIALOG:ads:init:*: {
  var %table, %file, %ad, %time, %status, %pan, %stat, %t, %a, %l
  %table = ads | %file = ads.dat
  if (!$hget(%table)) { .hmake %table | if ($isfile(%file)) .hload %table %file }
  %a = 1 | %pan = 1 13 33 | %t = 6 15 31 | %stat = 3 16 32
  while (%a < 4) {
    %ad = $hget(%table,$+(ad,%a)) | if (!%ad) %ad = Unset
    %time = $hget(%table,$+(time,%a)) | if (!%time) %time = $calc(60 * 60)
    %status = $hget(%table,$+(state,%a)) | if (!%status) %status = Disabled
    .did -ra $dname $gettok(%pan,%a,32) %ad | .did -ra $dname $gettok(%stat,%a,32) $+(Status,$chr(58),$chr(32),%status) | .did -ra $dname $gettok(%t,%a,32) $duration(%time)
    inc %a
  }
}
on *:DIALOG:ads:sclick:*: {
  var %table, %file, %ad, %time, %status, %pan, %stat, %t, %a, %b, %l
  %table = ads | %file = ads.dat
  if (!$hget(%table)) { .hmake %table | if ($isfile(%file)) .hload %table %file }
  %pan = 1 13 33 | %t = 6 15 31 | %stat = 3 16 32 
  if ($istok(4 17 29,$did,32)) {
    if ($did == 4) %b = 1  | elseif ($did == 17) %b = 2 | elseif ($did == 29) %b = 3  
    if (!%b) goto end
    if ($did($dname,$gettok(%pan,%b,32)).text == Unset) || (!$did($dname,$gettok(%pan,%b,32)).text) { .hadd %table $+(ad,%b) Unset | .hadd %table $+(state,%b) Disabled | .dialog -c $dname $dname | %a = $$input(Error: You Need To Pick Advertisement Text,o,Error,Error) | .dialog -mdo ads ads | .timerad $+ %b off | .hsave %table %file | goto end }
    hadd %table $+(ad,%b) $$iif($did($dname,$gettok(%pan,%b,32)).text, $v1, Unset)
    %time = $hget(%table,$+(time,%b)) | if (!%time) %time = $calc(60 * 60)
    hadd %table $+(time,%b) %time | hadd %table $+(state,%b) Enabled | .did -ra $dname $gettok(%stat,%b,32) $+(Status,$chr(58),$chr(32),Enabled)
    goto save
  }

  if ($istok(5 18 30,$did,32)) {
    if ($did == 5) %b = 1 | elseif ($did == 18) %b = 2 | elseif ($did == 30) %b = 3  
    if (!%b) goto end
    .timerad $+ %b off | .did -ra $dname $gettok(%stat,%b,32) $+(Status,$chr(58),$chr(32),Disabled) | .hadd %table $+(state,%b) Disabled
    goto save
  }
  if ($istok(8 22 28,$did,32)) {
    if ($did == 8) %b = 1 | elseif ($did == 22) %b = 2 | elseif ($did == 28) %b = 3  
    if (!%b) goto end
    %time = $hget(%table,$+(time,%b)) | if (!%time) %time = $calc(60 * 60)
    inc %time $calc(60 * 60) | goto time
  }
  if ($istok(9 21 27,$did,32)) {
    if ($did == 9) %b = 1 | elseif ($did == 21) %b = 2 | elseif ($did == 27) %b = 3  
    if (!%b) goto end
    %time = $hget(%table,$+(time,%b)) | if (!%time) %time = $calc(60 * 60)
    dec %time $calc(60 * 60) | goto time
  }
  if ($istok(10 20 26,$did,32)) {
    if ($did == 10) %b = 1 | elseif ($did == 20) %b = 2 | elseif ($did == 26) %b = 3  
    if (!%b) goto end
    %time = $hget(%table,$+(time,%b)) | if (!%time) %time = $calc(60 * 60)
    inc %time 60 | goto time
  }
  if ($istok(11 19 25,$did,32)) {
    if ($did == 11) %b = 1 | elseif ($did == 19) %b = 2 | elseif ($did == 25) %b = 3  
    if (!%b) goto end
    %time = $hget(%table,$+(time,%b)) | if (!%time) %time = $calc(60 * 60)
    dec %time 60 | goto time
  }
  goto end
  :time
  if (%time < $calc(60 * 10)) %time = $calc(60 * 10)
  hadd %table $+(time,%b) %time | .did -ra $dname $gettok(%t,%b,32) $duration(%time)
  :save
  .hsave %table %file | .noop $adstart(%b) 
  :end
}

alias adstart {
  var %table, %file, %a, %b,  %l
  %table = ads | %file = ads.dat
  if (!$hget(%table)) { .hmake %table | if ($isfile(%file)) .hload %table %file }
  if ($1 isnum 1-3) {
    %b = $1
    %ad = $hget(%table,$+(ad,%b)) | if (!%ad) || (%ad == Unset) { .hadd %table $+(state,%b) Disabled | .timerad $+ %b off | return }
    %time = $hget(%table,$+(time,%b)) | if (!%time) %time = $calc(60 * 60)
    %status = $hget(%table,$+(state,%b)) | if (%status == Disabled) return
    .timerad $+ %b -co 0 %time doad %ad 
    return
  }
  %a = 1
  while (%a < 4) {
    %ad = $hget(%table,$+(ad,%a)) | if (!%ad) || (%ad == Unset) { .hadd %table $+(state,%a) Disabled | .timerad $+ %a off | goto skip }
    %time = $hget(%table,$+(time,%a)) | if (!%time) %time = $calc(60 * 60)
    %status = $hget(%table,$+(state,%a)) | if (%status != Enabled) goto skip
    .timerad $+ %a -co 0 %time doad %ad
    :skip
    inc %a
  }
} 
alias doad {
  var %table, %file, %a, %b, %c, %d, %e, %timer, %l
  %table = ads | %file = ads.dat
  if ($1 == Unset) return  
  if (!$hget(%table)) { .hmake %table | if ($isfile(%file)) .hload %table %file }
  %a = $chan(0) | %b = $hget(%table,channels)
  if (!%b) {  .echo -s 4 $+ $timestamp >> Advert Attempt >> No Channels Set >> $1- | return } 
  else {
    %c = 0 | %d = 0 | %timer = 
    while (%a > 0) { if ($istok(%b,$chan(%a),32)) { inc %d | if (%d > 5) { %d = 0 | inc %e } | if (%e isnum 1-) %timer = .timer -cmo 1 $calc(%e * 2200) |  %timer .raw $$iif($me isop $chan(%a), NOTICE $chan(%a) $chan(%a) $+($chr(58),[,br,]), PRIVMSG $chan(%a) $chr(58)) $+ $+($chr(160),[,style) ff:Arial co:#688A08;b;] $+ $1- | inc %c } | dec %a } 
    if (%c > 0) { .echo -s 3 $+ $timestamp >> Advert Sent To %c $$iif(%c > 1, Channels, Channel) >> $1- }  | else { .echo -s 4 $+ $timestamp >> Advert Attempt >> No Channels Set From Channels Your Currently On  >> $1- }
  }
  return
} 

menu channel {
  -
  Advert Control
  .Setup Adverts:.dialog -mdo ads ads
  .-
  .$$iif($timer(ad1), **Click Activation Time Below To Send Ad Now**, $$iif($timer(ad2), **Click Activation Time Below To Send Ad Now**, $$iif($timer(ad3), **Click Activation Time Below To Send Ad Now**))):.halt
  .$$iif($timer(ad1).secs, $+(Advert,$chr(32),One,$chr(32),Activates,$chr(32),In,$chr(58),$chr(32),$duration($v1))):  { var %a, %b, %l | %b = 1 |  %a = $timer($+(ad,%b)).com | %a | .noop $adstart(%b) }
  .$$iif($timer(ad2).secs, $+(Advert,$chr(32),Two,$chr(32),Activates,$chr(32),In,$chr(58),$chr(32),$duration($v1))):  { var %a, %b, %l | %b = 2 |  %a = $timer($+(ad,%b)).com | %a | .noop $adstart(%b) }
  .$$iif($timer(ad3).secs, $+(Advert,$chr(32),Three,$chr(32),Activates,$chr(32),In,$chr(58),$chr(32),$duration($v1))): { var %a, %b, %l | %b = 3 |  %a = $timer($+(ad,%b)).com | %a | .noop $adstart(%b) }
  -
  $$iif($istok($hget(ads,channels),$active,32), $style(1) Display, Display) Advert In $+(",$active,"): {
    var %table, %file,  %a, %l | %table = ads | %file = ads.dat
    if (!$hget(%table)) { .hmake %table | if ($isfile(%file)) .hload %table %file }
    %a = $hget(%table,channels)
    if ($istok(%a,$active,32)) { if ($numtok(%a,32) > 1) .hadd %table channels $remtok(%a,$active,32) | else .hdel %table channels }
    else .hadd %table channels $addtok(%a,$active,32)
    .hsave %table %file
  }  
}
on *:START: .noop $adstart 
on *:JOIN:*: { var %table, %a, %l | %table = ads
  if (!$hget(%table)) { .noop $adstart } 
  else { %a = 1 | while (%a < 4) { if ($hget(%table,$+(state,%a)) == Enabled) && (!$timer($+(ad,%a))) .noop $adstart(%a) | inc %a } }
}

Related Files

by TheGeekLord
by NIGathan
by Kurdish_Assass1n

Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand