我为plug.dj脚本编写了这个函数,如果答案是肯定的,它会添加聊天消息,但如果答案为否,我将无法结束该函数。我不是专业程序员。
代码:
f_votelggr: function (obj){
if (nScript.mehShow) {
if (obj.vote != 1) {
prompt(obj.user.username + " didn't liked this song! Do you want to alert the users?")
if ("yes");
API.sendChat(obj.user.username + "didn't like this song!");
} else {
return
};
},
答案 0 :(得分:0)
您应该收到来自用户的提示输入
var input = prompt(obj.user.username + " didn't liked this song! Do you want
to alert the users?")
if (input == "yes"){
API.sendChat(obj.user.username + "didn't like this song!");
}
else{
return;
};
你也有
if ("yes");
如果马上就会终止你。删除;
并使用{}
只是为了避免混淆和错误。
答案 1 :(得分:0)
试试这个:
if ("no"){
return null;
}
我想这就是你要找的东西。它会离开这个功能。
编辑:
var input = prompt(obj.user.username + " didn't liked this song! Do you want
to alert the users?")
if (input == "yes"){
API.sendChat(obj.user.username + "didn't like this song!");
}
else if{
(input == "no"){
// do stuff here
return null;
} else {
return}
};
答案 2 :(得分:0)
var input = prompt(obj.user.username + " didn't liked this song! Do you want to alert the users?");
input = input.toLowercase();
if (input === "yes") {
API.sendChat(obj.user.username + "didn't like this song!");
} else {
return false;
};