Egekan Posted July 10, 2016 Share Posted July 10, 2016 Hello, I'm a newbie scripter and I'm trying to script somethings for fun. I have a private scripting server. I have an accesspanel gui, there are some dev. access codes(passwords) to login as a scripter. Is is possible to use allow some poeple login with their own codes? First one checks if the code which is in the editbox is exists or not. As you see if it does, the person will be able to click the button. function devenable() local acscodes = {"1234", "1231"} if guiGetText(accesscode.edit) == acscodes then -- Checks if the code is valid or not. guiSetEnabled(connect.button, true) else guiSetEnabled(connect.button, false) end end setTimer(devenable, 1000,0) function devaccess() if guiGetEnabled(connect.button,true) then guiSetVisible(ServAccess.window, false) showCursor(false) end if guiGetText(accesscode.edit) == acscodes[1] then outputChatBox("Hello, Egekan. Developer Mode is enabled!", 0, 200, 0) elseif guiGetText(accesscode.edit) == acscodes[2] then outputChatBox("Hello, AnyPerson. Developer Mode is enabled!", 0, 200, 0) end end addEventHandler("onClientGUIClick", connect.button, devaccess) it's fine if I use this one instead, which means the script is good enough local acscodes = 1234 Thank you for helping Link to comment
Tails Posted July 10, 2016 Share Posted July 10, 2016 (edited) You've put the table locally in your devenable function. Put it above the function or remove local then devaccess function should work. Edited July 10, 2016 by Guest Link to comment
Walid Posted July 10, 2016 Share Posted July 10, 2016 use this: local acscodes = {"1234", "1231"} local passwordEntred = guiGetText(accesscode.edit) if passwordEntred ~= "" then for _,password in pairs (acscodes) do if passwordEntred == password then -- your code here end end end Link to comment
Tails Posted July 10, 2016 Share Posted July 10, 2016 Take Walid's example and use this outputChatBox("Hello, "..getPlayerName(localPlayer)..". Developer Mode is enabled!", 0, 200, 0) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now