为ptokax脚本在lua中的表中添加变量值
最近我将我的ptokax更新为0.5.3,从那以后,我的votekick脚本停止工作,因为在我的脚本中,其他在线用户的输入为1或2,表示接受或拒绝用户被踢,但现在每当用户输入1或2,脚本就停止接受输入,并将其插入表中,我怀疑这可能是由于某些原因语法改变。请看一下我的剧本并提出建议为ptokax脚本在lua中的表中添加变量值,lua,lua-5.1,ptokax,Lua,Lua 5.1,Ptokax,最近我将我的ptokax更新为0.5.3,从那以后,我的votekick脚本停止工作,因为在我的脚本中,其他在线用户的输入为1或2,表示接受或拒绝用户被踢,但现在每当用户输入1或2,脚本就停止接受输入,并将其插入表中,我怀疑这可能是由于某些原因语法改变。请看一下我的剧本并提出建议 data = " <Nick> 2" -- this is the way script takes input frm dc chat s,e,vote= strin
data = " <Nick> 2" -- this is the way script takes input frm dc chat
s,e,vote= string.find(data,"%b<>%s(.+)")
if vote == "1" then
table.insert(votesPlus,user.sNick)
Core.SendToAll("*--"..user.sNick.." accepts--")
if #votesPlus == votes or # votesMinus == votes then
stop(nTimerId)
end
return true
elseif vote == "2" then
table.insert(votesMinus,user.sNick)
Core.SendToAll("*--"..user.sNick.." denies--")
if #votesPlus == votes or # votesMinus == votes then
stop(nTimerId)
end
return true
else
-- the user is not voting even when poll active
end
data=“2”--这是脚本获取输入frm dc chat的方式
s、 e,vote=string.find(数据,“%b%s(+)”)
如果投票==“1”,则
表.insert(votesPlus,user.sNick)
Core.SendToAll(“*-->.user.sNick..”接受--”)
如果#votesPlus==票数或#votesPlus==票数,则
停止(n数字)
结束
返回真值
如果投票结果为“2”,则
table.insert(votesMinus,user.sNick)
Core.SendToAll(“*-->.user.sNick..”拒绝--“)
如果#votesPlus==票数或#votesPlus==票数,则
停止(n数字)
结束
返回真值
其他的
--即使轮询处于活动状态,用户也没有投票
结束
<Nick> the message|
PS:我想你也应该检查一下同一个用户是否投了两次票!此外,您还可以输入以下代码:
if #votesPlus == votes or #votesMinus == votes then
stop( nTimerId )
end
在调用
OnTimer
函数时。我正在使用ptokax for lua 5.1.5,但如果脚本看起来很好,我就不明白为什么不接受用户的输入来踢播放器。@warl0ck你能把整个脚本放到你的问题中吗?如果可能,我可以把它寄给你?@warl0ck当然,我的github档案中提到了电子邮件地址,请更准确地说出您想要得到什么,自上次工作以来发生了什么变化,以及您现在遇到了什么问题。在更新ptokax之前,此脚本工作正常,但此后,由于某种原因,此部分已停止工作,因为它本应将输入作为1或2,但由于某种原因,现在它不接受输入。
if #votesPlus == votes or #votesMinus == votes then
stop( nTimerId )
end