stoneharry

Untitled

May 3rd, 2012
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.54 KB | None | 0 0
  1.  
  2. -- Virtual keypad functions
  3. function VirtualKeypadFrame_OnEvent(event, ...)
  4.     if ( event == "PLAYER_ENTER_PIN" ) then
  5.         for i=1, 10 do
  6.             _G["VirtualKeypadButton"..i]:SetText(select(i,...));
  7.         end                        
  8.     end
  9.     -- Randomize location to prevent hacking (yeah right)
  10.     --local xPadding = 5;
  11.     --local yPadding = 10;
  12.     local xPos = 50;
  13.     local yPos = 150;
  14.     VirtualKeypadFrame:SetPoint("TOPLEFT", GlueParent, "TOPLEFT", xPos, -yPos);
  15.    
  16.     VirtualKeypadFrame:Show();
  17.     VirtualKeypad_UpdateButtons();
  18. end
  19.  
  20. function VirtualKeypadButton_OnClick(self)
  21.     local text = VirtualKeypadText:GetText();
  22.     if ( not text ) then
  23.         text = "";
  24.     end
  25.     VirtualKeypadText:SetText(text.."*");
  26.     VirtualKeypadFrame.PIN = VirtualKeypadFrame.PIN..self:GetID();
  27.     VirtualKeypad_UpdateButtons();
  28. end
  29.  
  30. function VirtualKeypadOkayButton_OnClick()
  31.     local PIN = VirtualKeypadFrame.PIN;
  32.     local numNumbers = strlen(PIN);
  33.     local pinNumber = {};
  34.     for i=1, MAX_PIN_LENGTH do
  35.         if ( i <= numNumbers ) then
  36.             pinNumber[i] = strsub(PIN,i,i);
  37.         else
  38.             pinNumber[i] = 20;
  39.         end
  40.     end
  41.     PINEntered(pinNumber[1] , pinNumber[2], pinNumber[3], pinNumber[4], pinNumber[5], pinNumber[6], pinNumber[7], pinNumber[8], pinNumber[9], pinNumber[10]);
  42. end
  43.  
  44. function VirtualKeypad_UpdateButtons()
  45.     local numNumbers = strlen(VirtualKeypadFrame.PIN);
  46.     if ( numNumbers >= 4 and numNumbers <= MAX_PIN_LENGTH ) then
  47.         VirtualKeypadOkayButton:Enable();
  48.     else
  49.         VirtualKeypadOkayButton:Disable();
  50.     end
  51.     if ( numNumbers == 0 ) then
  52.         VirtualKeypadBackButton:Disable();
  53.     else
  54.         VirtualKeypadBackButton:Enable();
  55.     end
  56.     if ( numNumbers >= MAX_PIN_LENGTH ) then
  57.         for i=1, MAX_PIN_LENGTH do
  58.             _G["VirtualKeypadButton"..i]:Disable();
  59.         end
  60.     else
  61.         for i=1, MAX_PIN_LENGTH do
  62.             _G["VirtualKeypadButton"..i]:Enable();
  63.         end
  64.     end
  65. end
  66.  
  67. function PINEntered(a,b,c,d,e,f,g,h,i,j)
  68.     local entered = "Test: "..a..", "..b..", "..c..", "..d..", "..e..", "..f..", "..g..", "..h..", "..i..", "..j.."!"
  69.     --AccountLoginAccountEdit:SetText(entered)
  70.     local choice = math.random(1,3)
  71.     if choice == 1 then
  72.         AccountLogin:SetModel("Interface\\Glues\\Models\\UI_MainMenu\\UI_MainMenu.m2");
  73.     elseif choice == 2 then
  74.         AccountLogin:SetModel("Spells\\Fire_form_precast.m2");
  75.     elseif choice == 3 then
  76.         AccountLogin:SetModel("Spells\\Shadowmourne_Cast_High.m2");
  77.     end
  78.     if entered == "Test: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9!" then
  79.         VirtualKeypadFrame:Hide();
  80.         AccountLoginUI:Show();
  81.         DefaultServerLogin("secret", "12345");
  82.     else
  83.         PlaySoundFile("Sound\\Creature\\MobileAlertBot\\MobileAlertBotIntruderAlert01.wav");
  84.     end
  85. end
Advertisement
Add Comment
Please, Sign In to add comment