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();
}