• Name Blacklist [string.find error]
    5 replies, posted
I am creating a blacklisted of characters that can be found in your name. If it is found, you are kicked from the server. [lua]local nameblacklist = { "%", } for _,v in pairs(nameblacklist) do if string.find(string.lower(ply:Nick()), v) then --line 83 ply:Kick("Blacklisted character in name : "..v..".") end end [/lua] Error [code]Hook 'InitialSpawnStuff' Failed: [@gamemodes\b\gamemode\init.lua:83] malformed pattern (ends with '%')[/code] Any help would be appericiated to solving the error.
One thing I see is that your table has 1 object in it but has a comma at the end, suggesting to Lua that there is additional objects. I'm not sure if that's because you cut things out or if it's just a silly mistake.
[QUOTE=InfernalCookie;36152506]One thing I see is that your table has 1 object in it but has a comma at the end, suggesting to Lua that there is additional objects. I'm not sure if that's because you cut things out or if it's just a silly mistake.[/QUOTE] Lua doesn't care about the comma at the end of your table.
O.o Really? I've gotten errors for that before... If so, I feel stupid now, lol.
I found a thread about this (on a different forum), apparently you have to use %% instead of %. (Though, both % and ~ characters are removed from a player's name, so you shouldn't ever have to search for either of those how you're doing it.)
[QUOTE=.\\Shadow};36152817]I found a thread about this (on a different forum), apparently you have to use %% instead of %. (Though, both % and ~ characters are removed from a player's name, so you shouldn't ever have to search for either of those how you're doing it.)[/QUOTE] The solution was "%%", but you're right, they're removed from Nick() anyway.
Sorry, you need to Log In to post a reply to this thread.