• CheckPassword Hook Name Prefixes
    7 replies, posted
Hey Facepunch, i have a question. Im using the checkpassword hook to kick players that are in one steamgroup with http.fetch. I made a steamid64 whitelist, too for it. But now im thinking about making NamePrefix not joining aswell. What i mean is this: the CheckPassword hook need to check of the Name for p.e. the Usersname is Sodak its fine he can join. Is the Name LG | Sodak or =LG= Sodak or =LG= OtherNameThenSodak or [LG] and so on he could not be able to join. So it has to look for the first 4 or 5 letters of each name and if they are == the user cannot join. hook.Add("CheckPassword", "BadGuys", function(sid) if not GroupPlayers[sid] and !Whitelist[sid] then return false, "No No Little Boy" end end) Thanks alot.
Why would you even want to do this?
The prefixing is used for people that are wearing a bad tag like [A***] mostly in the beginning of their names i could use string.sub or string.startwith i guess.. to make the check
From gmod wiki: GM:CheckPassword( string steamID64, string ipAddress, stringsvPassword, string clPassword, string name ) You just do hook.Add("CheckPassword", "BadNameFilter", function(steamid64, ip, sv_password, cl_password, name) if name:match("badword") then return false, "You have a bad word in your name!" end end)
yeah i could but if the name would be KevLGas for example it works i need the first part of a nickname. but thanks anyway
name:match("^[=]*LG[=]*")
Ok i made it so: thank you local DeniedNamePrefix = { "^[=%[]*LG[=%]]*", "^[=%[]*☜LG☞[=%]]*", "^[=%[]*[LG][=%]]*", "^[=%[]*LG|[=%]]*", "^[=%[]*LG |[=%]]*", "^[=%[]*LG| [=%]]*", "^[=%[]*LG | [=%]]*", } for _,word in pairs (DeniedNamePrefix) do if name:match(word) then  return false, "You have a bad word in your name!"  end end
here's a single lua-regex pattern that covers all of the entries in your names table "^[=%[%]|]*%s*LG[^%w]+"
Sorry, you need to Log In to post a reply to this thread.