amine2 Posted June 25, 2022 Share Posted June 25, 2022 How to make remember me. i have a login panel resource and i need a tutorial about how i can make remember me checkbox. Link to comment
Vampire Posted June 25, 2022 Share Posted June 25, 2022 Hello @amine2 and welcome! Moving this to the Scripting section so you can get better assistance. It's also better if you can provide some of your code or what you've tried so far so people can help you. Link to comment
iwalidza Posted June 25, 2022 Share Posted June 25, 2022 Hello about your resource you use this functions and events onClientGUIClick -- use to check what gui click getElementType -- check if the source clicked is check box that is check box type "gui-checkbox" guiCheckBoxGetSelected -- to check if the check box is on or off fileExists -- to check if file save infos that is exists or no fileCreate -- to create file that will have the client user name and password fileWrite -- write the infos in the file toJSON -- to make the infos write with json fileClose -- don't forge to close the file -- now you need to check when login panel start if client is have remember me then turn it on again and use next function fileExists -- to check if file save infos that is exists or no fileOpen -- to open the file fileGetSize -- to get the file read size fileRead -- read the file fileClose -- don't forge to close the file fromJSON -- that to get json data guiSetText -- now you can set the username and password edit box text Link to comment
AngelAlpha Posted June 25, 2022 Share Posted June 25, 2022 4 hours ago, amine2 said: How to make remember me. i have a login panel resource and i need a tutorial about how i can make remember me checkbox. 1) save in local file (xml, json) 2) save in database 3 hours ago, Vampire said: Hello @amine2 and welcome! Moving this to the Scripting section so you can get better assistance. It's also better if you can provide some of your code or what you've tried so far so people can help you. local settingFile = "save.json" function saveData() local file = fileExists(settingFile) and fileOpen(settingFile) or fileCreate(settingFile) local login = guiGetText (edit.login) local pass = guiGetText (edit.pass) local data = { login = login, pass = pass, } fileWrite (file, toJSON(data, true)) fileClose (file) end function loadData () local file = fileExists(settingFile) and fileOpen(settingFile) or fileCreate(settingFile) local json = fromJSON(fileRead(settingFile, fileGetSize(settingFile))) if type(json) ~= "table" then return end guiSetText (edit.login, json.login) guiSetText (edit.pass, json.pass) end 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