不要按我的意愿工作

时间:2013-11-18 02:44:44

标签: if-statement lua

现在他们都被处决了。我做错了什么?

if ismsg("talk", msg) then
Say("I do not want to talk about it.")
topic = 1
end

if ismsg("talk", msg) and topic == 1 then
Say("Ok. Get lost!")
idle()
end

我只希望在第二次发送通话时触发第二个if条件。

1 个答案:

答案 0 :(得分:2)

第二个if语句总是被触发,因为你在第一个if语句中将topic设置为1。

试试这个:

if ismsg("talk", msg) and topic == 1 then
    Say("Ok. Get lost!")
    idle()
elseif ismsg("talk", msg) then
    Say("I do not want to talk about it.")
    topic = 1
end