--script by smallg local length = {} local letter = {} local state = {} local pressed = 0 local correct = {} local guess = {} local letter_number = 0 local x = 30 local y = 80 local low_count = 0 local getout = 0 function m2_keypass_init(e) --input password here letter[1] = "7" letter[2] = "2" --letter[3] = "c" --letter[4] = "d" --letter[5] = "e" --letter[6] = "f" etc --set the length of the password here length[e] = 2 correct[e] = 0 state[e] = "start" end function m2_keypass_main(e) if GetPlayerDistance(e) <= 100 and getout == 1 then Prompt("Your access has been approved") end if GetPlayerDistance(e) <= 100 and getout == 0 then if state[e] == "start" then Prompt("You need approval to pass this point - press enter key ") if GetScancode() == 28 then state[e] = "input" FreezePlayer() pressed = 1 Prompt("Enter access code") end elseif state[e] == "input" then if pressed == 0 then if GetInKey() ~= "" then letter_number = letter_number + 1 guess[letter_number] = GetInKey() pressed = 1 end end if letter_number > 0 then local lx = 55 for a = letter_number, 1, -1 do lx = lx - 1 TextCenterOnX(lx,97,1,guess[a]) end end if letter_number >= length[e] then for a = 1, length[e] do if guess[a] == letter[a] then correct[e] = correct[e] + 1 else for a = 1, length[e] do guess[a] = "" end correct[e] = 0 letter_number = 0 UnFreezePlayer() state[e] = "start" getout = 0 --Prompt("This could be the problem") end end end elseif state[e] == "correct" then --insert any code here to determine what happens once password is correctly entered --SetRotation(e,90,0,45) --RotateX(e,90) --RotateY(e,90) --RotateZ(e,90) --open a door/ box etc Prompt("correct! I need to return screen back to the player") letter_number = 0 for a = 1, length[e] do guess[a] = "" end correct[e] = 0 letter_number = 0 UnFreezePlayer() state[e] = "start" pressed = 1 getout = 1 end end if GetScancode() == 0 then pressed = 0 end if correct[e] == length[e] then state[e] = "correct" end --Prompt(GetInKey()) end --main