Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bad_names = {
- con = true,
- prn = true,
- aux = true,
- nul = true,
- }
- for i=1,9 do
- bad_names["com" .. tostring(i)] = true
- bad_names["lpt" .. tostring(i)] = true
- end
- local bad_characters = { "<", ">", ":", "\"", "/", "\\", "|", "?", "*" }
- local function has_bad_character(name)
- for _, char in ipairs(bad_characters) do
- if name:find(char, 1, true) then
- return true
- end
- end
- return false
- end
- local function is_bad_name(name)
- return bad_names[string.lower(name)] or has_bad_character(name)
- end
- minetest.register_on_prejoinplayer(function(name)
- if is_bad_name(name) then
- return "No meme names allowed"
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement