View Single Post
  #1  
Old 12-08-2012, 06:24 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Question box script

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(titlequestion) {
  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;
    
1093;
    
646;

    new 
GuiButtonCtrl("QUESTION_YES") {
      
profile GuiBlueButtonProfile;
      
text "Yes";
      
width 116;
      
69;
    }
    new 
GuiButtonCtrl("QUESTION_NO") {
      
profile GuiBlueButtonProfile;
      
text "No";
      
width 107;
      
115;
      
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.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote