Hey, i'm trying to make a question prompt that basically pops up with a question, this is in a class. So then if I want to ask the player a question I just join the NPC or weapon to the class and call the method.
I can't figure out how to get the answer back. In C# you do something like this. Here is the NPC.
PHP Code:
function onCreated(){
temp.qu = AskQuestion("This is a title", "This is a question");
if(qu){
this.chat = "It's true!";
}else{
this.chat = "It's not true!";
}
}
Here is the class.
PHP Code:
//#CLIENTSIDE
function AskQuestion(title, question) {
new GuiWindowCtrl("QUESTION_WINDOW") {
profile = GuiBlueWindowProfile;
clientrelative = true;
clientextent = "222,99";
canclose = false;
canmaximize = false;
canminimize = false;
canmove = true;
canresize = true;
closequery = false;
destroyonhide = false;
text = title;
x = 1093;
y = 646;
new GuiButtonCtrl("QUESTION_YES") {
profile = GuiBlueButtonProfile;
text = "Yes";
width = 116;
y = 69;
}
new GuiButtonCtrl("QUESTION_NO") {
profile = GuiBlueButtonProfile;
text = "No";
width = 107;
x = 115;
y = 69;
}
new GuiScrollCtrl("QUESTION_SCROLL") {
profile = GuiBlueScrollProfile;
height = 68;
hscrollbar = "dynamic";
vscrollbar = "dynamic";
width = 225;
new GuiMLTextCtrl("QUESTION_MULTILINE") {
profile = GuiBlueMLTextProfile;
height = 34;
horizsizing = "width";
text = question;
width = 200;
}
}
}
}
function QUESTION_YES.onAction() {
QUESTION_WINDOW.destroy();
return true;
}
function QUESTION_NO.onAction() {
QUESTION_WINDOW.destroy();
return false;
}
Cheers.