Thread: Reset GUI
View Single Post
  #8  
Old 08-18-2008, 06:14 PM
TheStan TheStan is offline
Stan?
Join Date: May 2008
Location: U.S.
Posts: 100
TheStan is on a distinguished road
Send a message via AIM to TheStan Send a message via MSN to TheStan
PHP Code:
//Scripted by Switch
function onActionServerSide() {
  if (
params[0] == "reset") {
    
temp.text = (params[1] == null)? (player.account @ " has been reset.") : (player.account @ " has been reset because: " @ params[1]);
    
sendToRC("/reset " @player.account);
    
savelog2("reset.txt", temp.text);
  }
}

//#CLIENTSIDE
function onCreated() {
  
this.beg = { "iA", "Pq", "oa", "cQ", "Vu", "zC", "Gd", "jE",
    
"aT", "fg", "io", "mv" };
  
this.mid = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
  
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";
      
x = 250;
      
y = 250;
      
width = 350;
      
height = 250;
      
      new 
GuiMLTextCtrl("Reset_Info") {
        
profile = GuiBlueMLTextProfile;
        
x = 25;
        
y = 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;
        
x = 25;
        
y = 170;
        
width = 70;
        
height = 20;
      }
      
      new 
GuiTextEditCtrl("Reset_Reason") {
        
profile = GuiBlueTextEditProfile;
        
x = 100;
        
y = 170;
        
width = 220;
        
height = 20;
      }
      
      new 
GuiButtonCtrl("Reset_Button") {
        
profile = GuiBlueButtonProfile;
        
x = 100;
        
y = 200;
        
width = 150;
        
height = 40;
        
text = "Reset Me!";
      }
    }
  }
}

function 
Reset_Button.onAction() {
  if (
Reset_ConfCodeEnter.text == this.confCode) {
    
triggerserver("gui",name,"reset",Reset_Reason.text);
  }
  else {
    
Reset_Button.text = "Wrong Confirmation Code!";
    
sleep(3);
    
Reset_Button.text = "Reset Me!";
  }
} 
Bit bored so I trimmed a lil bit off just for the hell of it. It wasn't necessary for you to have both of those "reset#" arguments when you could have had just a condition.
Reply With Quote