Thread: Reset GUI
View Single Post
  #1  
Old 08-18-2008, 02:30 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Reset GUI

Just a simple reset GUI I made.
This was what I needed help with for the random strings
PHP Code:
//Scripted by Switch
function onActionServerSide() {
  if (
params[0] == "reset1") {
    
sendToRC("/reset " @player.account);
    
savelog2("reset.txt"player.account" has reset.");
  }
  if (
params[0] == "reset2") {
    
sendToRC("/reset " @player.account);
    
savelog2("reset.txt"player.account" has reset because:
@params[1]);
  }
}

//#CLIENTSIDE
function onCreated() {
  
this.beg = { "iA""Pq""oa""cQ""Vu""zC""Gd""jE",
    
"aT""fg""io""mv" };
  
this.mid = { 123456789};
  
this.end = { "io""vb""cH""pA""oA""nb""ua""Ac",
    
"iA""Co""Op""In" };
  
this.confCode null;
}

function 
onPlayerChats() {
  if (
player.chat == "/reset") {
    
this.confCode randomString(this.beg) @ randomString(this.mid) @ randomString(this.end);
          
    new 
GuiWindowCtrl("Reset_Window") {
      
profile GuiBlueWindowProfile;
      
canClose true;
      
canMaximize false;
      
canMinimize false;
      
canResize false;
      
canMove true;
      
closeQuery false;
      
destroyOnHide true;
      
text "Reset Window";
      
250;
      
250;
      
width 350;
      
height 250;
      
      new 
GuiMLTextCtrl("Reset_Info") {
        
profile GuiBlueMLTextProfile;
        
25;
        
25;
        
width 300;
        
text "<center>If you really wish to be reset, fill in the text box below with the confirmation code in the left text box and click the 'Reset Me!' button. You can also fill out a reason as to why you're reseting if you want to in the right text box.
If not, just close this window.

<b><u>CONFIRMATION CODE:</u></b>
@thiso.confCode"</center>";
      }
      
      new 
GuiTextEditCtrl("Reset_ConfCodeEnter") {
        
profile GuiBlueTextEditProfile;
        
25;
        
170;
        
width 70;
        
height 20;
      }
      
      new 
GuiTextEditCtrl("Reset_Reason") {
        
profile GuiBlueTextEditProfile;
        
100;
        
170;
        
width 220;
        
height 20;
      }
      
      new 
GuiButtonCtrl("Reset_Button") {
        
profile GuiBlueButtonProfile;
        
100;
        
200;
        
width 150;
        
height 40;
        
text "Reset Me!";
      }
    }
  }
}

function 
Reset_Button.onAction() {
  if (
Reset_ConfCodeEnter.text == this.confCode) {
    if (
Reset_Reason.text == null)
      
triggerserver("gui",name,"reset1");
    else
      
triggerserver("gui",name,"reset2",Reset_Reason.text);
  }
  else {
    
Reset_Button.text "Wrong Confirmation Code!";
    
sleep(3);
    
Reset_Button.text "Reset Me!";
  }

You can add as many strings in this.beg, this.mid, and this.end
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.

Last edited by Switch; 08-18-2008 at 05:28 AM..
Reply With Quote