Blacklist Name

How to blacklist a name in Gta V FiveM. The purpose of this code is to make it easier for you to blacklist stubborn players/citizens (Cheaters) on your server.

local blacklistednames= {"", "script"}
local x = {}

AddEventHandler("playerConnecting", function(playerName, setKickReason)
   playerName = (string.gsub(string.gsub(string.gsub(playerName,  "-", ""), ",", ""), " ", ""):lower())
        for k, v in pairs(blacklistednames) do
          local g, f = playerName:find(string.lower(v))
          if g or f  then
            table.insert (x, v)
            local blresult = table.concat(x, " ")
              setKickReason('You have been kicked because you are a stupid cheater!')
              CancelEvent()
              for key in pairs (x) do
                x [key] = nil
          end
       end
    end
end)

Last updated