2014-06-25 68 views
0

代碼;mIRC - 暫停散列表

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 
    } 
} 

這一切都很好。我只需要能夠暫停抽獎,但不能擺脫條目,然後能夠恢復抽獎。在代碼中的註釋解釋

+0

爲「暫停」比賽,當OP類型「卷」您可以使用這樣的事情 INC -u10%暫停 如果(!%暫停){} comamand 這樣,您將創建10秒設定,然後取消設置本身 –

+0

您可以發佈它作爲我的代碼的變量,請? – user3764992

回答

0

這是一部分,你要

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

謝謝!當我測試它時,會讓你知道。有一點與我如何設置限制無關。那麼一個人只能買十個票? – user3764992

+0

給我你的網絡地址,所以我可以連接它 –

+0

網絡地址? :/ – user3764992