Zcraks Posted September 3, 2019 Share Posted September 3, 2019 How to check for signs and prohibit pressing the spacebar in guiCreateEdit ? Link to comment
XaskeL Posted September 3, 2019 Share Posted September 3, 2019 addEventHandler("onClientGUIChanged", (PASTE YOUR EDIT = VARIABLE), function() local changedStr = (PASTE YOUR EDIT = VARIABLE):getText() local str = changedStr:gsub(" ","") if str ~= changedStr then (PASTE YOUR EDIT = VARIABLE):setText(str) end end,false) -- enable <oop>true</oop> in meta.xml test it Link to comment
Hugos Posted September 4, 2019 Share Posted September 4, 2019 It is possible to make still so... edit = guiCreateEdit(x, y, width, heiht, "you text" ) --We set the name of a variable str = string.gsub(guiGetText(edit), " ", "") --Get text and replace spaces guiSetText(edit, str) --Let's replace with the ready text P.S: string.gsub (<s>, <Search pattern>, <Replacement template>, [n]) S is a string. Search pattern - what to search for or regular expression. Replacement template - what to replace. N - how many times can a replacement be made at most. Link to comment
Zcraks Posted September 4, 2019 Author Share Posted September 4, 2019 How add signs "A-a, ..., Z-z", "0-9",".", "_" , "@" for white list ? And check if login_edit then do not add "@" ? Link to comment
Rockyz Posted September 5, 2019 Share Posted September 5, 2019 function replaceText() local text = guiGetText(source) local replacedText = text:gsub("[^A-Za-z0-9%._@]", "") if text ~= replacedText then guiSetText(source, replacedText) end end addEventHandler("onClientGUIChanged", login_edit, replaceText, false) 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