-- Created by Corno_1 -- Commercial and uncommercial use is allowed numberpad_pressed = 0 local password = {} keypadName={} local numberpadPressQuantity = {} local numberpadRemote = {} local whichKeyIsPressed ="" local namelenght ={} local initPassword = {} function keypad_init_name(e,name) keypadName[e] = name numberpadPressQuantity[e]=2 end function keypad_main(e) PlayerDist = GetPlayerDistance(e); if PlayerDist < 150 and numberpad_pressed==0 then keypadReaction(GetInKey(),e) end if numberpadPressQuantity[e] == numberpadRemote[e] then ActivateIfUsed(e) numberpadPressQuantity[e]=2 end if GetInKey() ~= whichKeyIsPressed then numberpad_pressed=0 end namelenght[e] = string.len(keypadName[e]) if initPassword[e] ~= 1 and namelenght[e] ~= nil then local nameNumber = {} nameNumber[e]=tonumber(keypadName[e]) password[e] = {} for i=2, namelenght[e]+1,1 do password[e][i] = tonumber(string.sub(keypadName[e],i-1,i-1)) end numberpadRemote[e]=string.len(keypadName[e])+2 initPassword[e]=1 end end function keypadReaction(key,e) whichKeyIsPressed = key if key ~= "#" and key ~= "*" and key ~= "0" then local keynumber = tonumber(key) if keynumber ~= nil then if password[e][numberpadPressQuantity[e]] == keynumber then numberpadPressQuantity[e] = numberpadPressQuantity[e] + 1 else numberpadPressQuantity[e] = 2 end SetAnimation(keynumber-1) PlayAnimation(e) end else keypadNoNumberPressed(key) PlayAnimation(e) end numberpad_pressed=1 end function keypadNoNumberPressed(key) if key == "#" then SetAnimation(11) end if key == "*" then SetAnimation(9) end if key == "0" then SetAnimation(10) end end