Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-02-2011, 10:07 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Feedback System

Before anyone posts this.
Yes you could ordinarily do it with buttons and alot easier too.
BUT i chose to tempt it with a checkbox as a challenge for my self.
anyway here is what i have done, feel free to use as you wish.
Feedback on the script or improvements are welcomed
PHP Code:
function onActionServerSide( cmd ){
  if ( 
cmd == "SendFeedback" ) {
  
clientr.feedbacked=1;
  if(
server.checkbox == 1){
  echo(
"Feedback: "@player.nick@" Likes The Server!");
  
server.feedback.yes += 1;
  
server.feedback.votes += 1;
  }
  if(
server.checkbox == 0){
  echo(
"Feedback: "@player.nick@" Doesnt Like The Server!");
  
server.feedback.no +=1;
  
server.feedback.votes += 1;
  }
  }
    if ( 
cmd == "Setcheckbox1Yes" ) {
    
server.checkbox=1;
  }
      if ( 
cmd == "Setcheckbox1No" ) {
    
server.checkbox=0;
  }
  }
//#CLIENTSIDE
function onCreated() {
sleep 100;
if(
clientr.feedbacked == 1){
return;
}
  new 
GuiWindowCtrl("Feedback_Test_Window2") {
    
profile = GuiBlueWindowProfile;
    
clientrelative = true;
    
clientextent = "172,53";

    
canclose = false;
    
canmaximize = false;
    
canminimize = false;
    
canmove = false;
    
canresize = true;
    
closequery = false;
    
destroyonhide = false;
    
text = "             Feedback";
    
x = 610;
    
y = 261;

    new 
GuiCheckBoxCtrl("Feedback_Test_CheckBox1") {
      
profile = GuiBlueCheckBoxProfile;
      
height = 20;
      
width = 100;
      
x = 5;
      
y = 5;
      
checked = false;
    }
    new 
GuiTextCtrl("Feedback_Test_Text1") {
      
profile = GuiBlueTextProfile;
      
height = 20;
      
text = "Do You Like This Server?";
      
width = 225;
      
x = 23;
      
y = 5;
    }
    new 
GuiButtonCtrl("Feedback_Test_Button1") {
      
profile = GuiBlueButtonProfile;
      
height = 24;
      
text = "Done";
      
width = 57;
      
x = 116;
      
y = 30;
    }
    new 
GuiButtonCtrl("Feedback_Test_Button2") {
      
profile = GuiBlueButtonProfile;
      
height = 24;
      
text = "Cancel";
      
width = 57;
      
y = 30;
    }
  }
}

function 
Feedback_Test_Button1.onAction() {
Feedback_Test_Window2.hide();
Feedback_Test_CheckBox1.hide();
Feedback_Test_Text1.hide();
Feedback_Test_Text2.hide();
Feedback_Test_Text3.hide();
Feedback_Test_Button1.hide();
Feedback_Test_Button2.hide();
say2("Thankyou For Your Feedback!");
if(
Feedback_Test_CheckBox1.checked == true){
triggerserver( "gui", name, "Setcheckbox1Yes" );
triggerserver( "gui", name, "SendFeedback" );
}
if(
Feedback_Test_CheckBox1.checked == false){
triggerserver( "gui", name, "Setcheckbox1No" );
triggerserver( "gui", name, "SendFeedback" );
}
}
function 
Feedback_Test_Button2.onAction() {
Feedback_Test_Window2.hide();
Feedback_Test_CheckBox1.hide();
Feedback_Test_Text1.hide();
Feedback_Test_Text2.hide();
Feedback_Test_Text3.hide();
Feedback_Test_Button1.hide();
Feedback_Test_Button2.hide();
} 
__________________

Gund for president.

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

Last edited by Gunderak; 08-02-2011 at 10:19 AM.. Reason: Fixed error in the script.
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.