daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Sep 20th, 2016 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function tables()
  2.     --Where the passwords given for each username is, don't edit
  3.     user = {  }
  4.     hashcode={'1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f','A','B','C','D','E','F'}
  5.     password = ''
  6. end
  7.  
  8. function main()
  9.     --Shows the block and the write value
  10.     ui.addTextArea(0,"",name,0,0,800,400,0x1C3C41,0x1C3C41,700,true)
  11.     ui.addPopup(0,2,"Username:",name,300,200,200,true)
  12.     system.disableChatCommandDisplay("id",true)
  13. end
  14.  
  15. function eventNewPlayer(name)
  16.     --Generate a password for each username
  17.     if not user[name] then
  18.         user[name] = {
  19.             password = ''..hashcode[math.random(#hashcode)]..''..hashcode[math.random(#hashcode)]..''..hashcode[math.random(#hashcode)]..''..hashcode[math.random(#hashcode)]..''..hashcode[math.random(#hashcode)]..''..hashcode[math.random(#hashcode)]..''..hashcode[math.random(#hashcode)]..''..hashcode[math.random(#hashcode)]..''
  20.         }
  21.     end
  22.     --And blocks his screen
  23.     ui.addTextArea(0,"",name,0,0,800,400,0x1C3C41,0x1C3C41,700,true)
  24.     ui.addPopup(0,2,"Username:",name,300,200,200,true)
  25. end
  26.  
  27. function eventChatCommand(name,command)
  28.     --Gives you the password of your name
  29.     if command=="id" then
  30.         ui.addPopup(3,0,'Nick: '..name..' Password: '..user[name].password,name,300,130,250,true)
  31.     end
  32. end
  33.  
  34. function eventPopupAnswer(id,name,answer)
  35.     --If the name is well
  36.     if id==0 and answer==name then
  37.         ui.addPopup(2,0,"Name exists",name,300,290,200,true)
  38.         ui.addPopup(1,2,"Password:",name,300,200,200,true)
  39.     --If it failed, error
  40.     elseif id==0 and answer~=name then
  41.         ui.addPopup(2,0,"Invalid name",name,300,290,200,true)
  42.         ui.addPopup(0,2,"Username",name,300,200,200,true)
  43.     --If you're done, block deleted
  44.     elseif id==1 and answer==user[name].password then
  45.         ui.addPopup(2,0,"Login sucess",name,300,290,200,true)
  46.         ui.removeTextArea(0,name)
  47.     --But if you fail again, you need to write the password
  48.     elseif id==1 and answer~=user[name].password then
  49.         ui.addPopup(2,0,"Invalid password",name,300,290,200,true)
  50.         ui.addPopup(1,2,"Password:",name,300,200,200,true)
  51.     end
  52. end
  53.  
  54. tables()
  55.  
  56. --Important, don't delete
  57. for name in pairs(tfm.get.room.playerList) do
  58.     eventNewPlayer(name)
  59. end
  60.  
  61. main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top