• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ name blocker for change name tfs 1.5

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
928
Solutions
7
Reaction score
127
Location
Brazil
YouTube
caruniawikibr
hey guys, I would like to know if anyone would know what a function would be like to block some non-standard names in the game, as I would like the player not to make some non-standard names
here is a change name from my Store to my otc
tfs 1.5 OTV8

I would like to block names that use
1 symbols, except ' and -
there used to be names like Ot'land or Ot-land
then the ' could be freed. but symbols like !@#$%¨&¨&()_+={}{^~;.,><;:-+

2 the use of 2 capital letters together,

Initial with lowercase.

Repetition of letters like AAAAA.

well I don't know how a script of this level would be, I believe that on a website it would be easier. however, the system has already been added to the client

Lua:
function purchase()
  if not selectedOffer then
    displayInfoBox("Error", "Something went wrong, make sure to select category and offer.")
    return
  end

  hide()
    if string.find(selectedOffer.title, "Name") and string.find(selectedOffer.title, "Change") and modules.client_textedit then
      modules.client_textedit.singlelineEditor("Choose New Name", function(newName)
        selectedOffer.newName = newName
        if GetNumbers(newName) then
        displayInfoBox("Error", "The name you choosed isn't allowed.")
            buyCanceled()
          return
        end
        if string.len(newName) == 0 or string.len(newName) > 26 or string.len(newName) < 3 then
        displayInfoBox("Error", "The name you choosed isn't allowed.")
            buyCanceled()
          return
        end
        if string.find(newName:lower(), "account") or string.find(newName:lower(), "tutor") then
        displayInfoBox("Error", "The name you choosed isn't allowed.")
            buyCanceled()
          return
        end
        if string.find(newName:lower(), "admin") or string.find(newName:lower(), "god") or string.find(newName:lower(), "adm") then
        displayInfoBox("Error", "The name you choosed isn't allowed.")
            buyCanceled()
          return
        end
        if string.find(newName:lower(), "gm") or string.find(newName:lower(), "cm") or string.find(newName:lower(), "gamemaster") then
        displayInfoBox("Error", "The name you choosed isn't allowed.")
            buyCanceled()
          return
        end
        if string.find(newName:lower(), "ç") or string.find(newName:lower(), "manager") then
        displayInfoBox("Error", "The name you choosed isn't allowed.")
            buyCanceled()
          return
        end
        if string.find(newName:lower(), "@") or string.find(newName:lower(), "yes") then
        displayInfoBox("Error", "The name you choosed isn't allowed.")
            buyCanceled()
          return
        end
      local title = "Purchase Confirmation"
      local msg = "Do you want to change your name to ".. newName .." for " .. selectedOffer.price .. " points?"
      msgWindow =
        displayGeneralBox(
        title,
        msg,
        {
          {text = "Yes", callback = buyConfirmed},
          {text = "No", callback = buyCanceled},
          anchor = AnchorHorizontalCenter
        },
        buyConfirmed,
        buyCanceled
      )
  end)
    else
      local title = "Purchase Confirmation"
      local msg = "Do you want to buy " .. selectedOffer.title .. " for " .. selectedOffer.price .. " points?"
      msgWindow =
        displayGeneralBox(
        title,
        msg,
        {
          {text = "Yes", callback = buyConfirmed},
          {text = "No", callback = buyCanceled},
          anchor = AnchorHorizontalCenter
        },
        buyConfirmed,
        buyCanceled
      )
    end
end
 
Not sure if I missed something

Lua:
local name = ""

local patterns = {
    "[^a-zA-Z'%-%s]", -- name contains symbols / numbers
    "^[a-z'%-%s]", -- first letter is not valid (lowercase, ', - or space)
    "([A-Z])([A-Z])", -- name has repetetions "AA"
    "(%s)(%s)", -- name has more than one space in a row
    "([a-z])([A-Z])" -- name is malformed -> "aSas"
}

for i = 1, #patterns do
    if select(2, name:gsub(patterns[i], "")) > 0 then
        print("Name is malformed")
        break
    end
end
 
btw.
Please for the love of god, move those checks to server-side and do it neatly like it supposed to be done, "steps" :
1) Send typed string in client by player to server;
2) Validate in server received string from client;
3) Send back (return) - success or failed prompt to client;
Don't check those type of things in client is fragile behaviour when someone will decrypt your modules.
I know that exceptions could be some cases that wouldn't be allowed to be sent to server in string by client, but in general you should be checking everything in server-side first not in client, if you know what i mean.
However those checks can be left in client if you want BUT you should check it with same checks in server too for more security.
 
Last edited:
btw.
Please for the love of god, move those checks to server-side and do it neatly like it supposed to be done, "steps" :
1) Send typed string in client by player to server;
2) Validate in server received string from client;
3) Send back (return) - success or failed prompt to client;
Don't check those type of things in client is fragile behaviour when someone will decrypt your modules.
I know that exceptions could be some cases that wouldn't be allowed to be sent to server in string by client, but in general you should be checking everything in server-side first not in client, if you know what i mean.
However those checks can be left in client if you want BUT you should check it with same checks in server too for more security.

in this case, block these things directly at the source?
 
Back
Top