首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mIRC -暂停哈希表

mIRC -暂停哈希表
EN

Stack Overflow用户
提问于 2014-06-25 15:46:14
回答 1查看 153关注 0票数 0

(B)编码;

代码语言:javascript
复制
on *:text:!ticket *:#:{
 var %hash $+(ticket.,#) 
  if $istok(%owner,$nick,32) && $2 == on && !$hget(%hash) { 
    hmake %hash 
    msg # Ticket now is open. Use !ticket <point> to join.
  }
  elseif $2 isnum && $2 > 0 && $hget(%hash) {
    var %topic $+(#,.,$nick), %point $readini(points.ini,%topic,points)
    if %point >= $2 {
      var %p $calc(%point - $2)
      writeini points.ini %topic points %p 
      var %i $hget(%hash,0).item, %t $calc(%i + $2) 
      while %i < %t { inc %i | hadd %hash %i $nick }
      msg # $nick $+ , You bought $2 ticket, you now have %p points
   }
    else { msg # $nick Sorry, you only have %point points }
  }
  elseif ($nick isop #) && $2 == roll && $hget(%hash) {
    var %i $rand(1,$hget(%hash,0).data)
    msg # The winner is $hget(%hash,%i).data $+ . 
    //I want to pause the raffle here so no more people can buy tickets but it sill keeps the entrys
  }
   elseif ($nick isop #) && $2 == over && $hget(%hash) {
        hfree %hash
  }
    elseif ($nick isop #) && $2 == go && $hget(%hash) {
            //I want people to be allowed to by more tickets and have the old tickets still count
  }
}

一切都很好。我只需要能够暂停抽奖,但不能摆脱条目,然后能够恢复抽奖。代码中的注释以解释

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-06-27 00:46:55

这是你想要的部分

代码语言:javascript
复制
on *:text:!ticket *:#:{
var %hash $+(ticket.,#) 
if $istok(%owner,$nick,32) && $2 == on && !$hget(%hash) { 
hmake %hash 
msg # Ticket now is open. Use !ticket <point> to join.
}
elseif $2 isnum && $2 > 0 && $hget(%hash) {
var %topic $+(#,.,$nick), %point $readini(points.ini,%topic,points)
if %point >= $2 && !%pause {
// here script will check if %pause is not set, so script will run normal, if yes, it wont work
  var %p $calc(%point - $2)
  writeini points.ini %topic points %p 
  var %i $hget(%hash,0).item, %t $calc(%i + $2) 
  while %i < %t { inc %i | hadd %hash %i $nick }
  msg # $nick $+ , You bought $2 ticket, you now have %p points
 }
else { msg # $nick Sorry, you only have %point points }
}
elseif ($nick isop #) && $2 == roll && $hget(%hash) {
var %i $rand(1,$hget(%hash,0).data)
msg # The winner is $hget(%hash,%i).data $+ . 
inc -u10 %pause
//10 is time in seconds you can choose whatever time you want, so in this way, no one  can buy tickets for 10 seconds
}
elseif ($nick isop #) && $2 == over && $hget(%hash) {
hfree %hash
}
elseif ($nick isop #) && $2 == go && $hget(%hash) {
unset %pause
// if someone typed "roll" and then you want to buy more tickes, typing "go" will just unset %pause
// you can set %pause for more time, or just an unlimmited time
}
}

我还没试过

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24413171

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档