Jump to content

DisableCharacters


itHyperoX

Recommended Posts

Hi, what's the problem?

local disabledKey = {
    ["!"] = true,
    ['"'] = true,
    ["£"] = true,
    ["$"] = true,
    ["%"] = true,
    ["^"] = true,
    ["&"] = true,
    ["*"] = true,
    ["("] = true,
    [")"] = true,
    ["_"] = true,
    ["+"] = true,
    ["="] = true,
    ["-"] = true,
    ["["] = true,
    ["]"] = true,
    ["{"] = true,
    ["}"] = true,
    [";"] = true,
    [":"] = true,
    ["'"] = true,
    ["@"] = true,
    ["#"] = true,
    ["~"] = true,
    [","] = true,
    ["<"] = true,
    ["."] = true,
    [">"] = true,
    ["/"] = true,
    ["?"] = true,
    ["/"] = true,
}



        local username =  guiGetText(gui["username"])
        local pw = guiGetText(gui["username"])
        
        if string.find(username, disabledKey[username]) then return outputDebugString("blocked:username") end
        if string.find(pw, disabledKey[pw]) then return outputDebugString("blocked:pw") end

 

Link to comment

Because there's no disabledKey[username] nor disabledKey[pw], good way of doing this would be using regular expressions, it would look like this:
 

local regex = "[!\"£\$%\^&\*(\)_\+=\-\[\]\{\};\:\'@\#~\,<\.>\/?\\\`]"

local username =  guiGetText(gui["username"])
local pw = guiGetText(gui["username"])

if pregFind(username, regex) then return outputDebugString("blocked:username") end
if pregFind(pw, regex) then return outputDebugString("blocked:pw") end

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...