• 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+ Rename Doll did not work

Haskys

Member
Joined
Jul 19, 2019
Messages
97
Reaction score
8
Location
Poland
Hello,

The script below works correctly on TFS 1.2 however on TFS 1.3 it doesn't. Probably the functions have changed, could anyone check?

Lua:
local config = {
    newNameLength = {4, 20},
    itemid = 2112
}

local array = {"-","1","2","3","4","5","6","7","8","9","0","<",">","/","|","~","!","@","#","$","%","^","&","*","(",")","_","=",",","."}

function setPlayerName(cid, currentName, newName)
  if not isPlayer(cid) then return false end
  doRemoveCreature(cid)
  db.query(string.format('UPDATE [ICODE]players[/ICODE] SET [ICODE]name[/ICODE] = %s WHERE name = %s;', db.escapeString(newName), db.escapeString(currentName)))
  return true
end

function onSay(cid, words, param, channel)
  if (param == '') then
    doPlayerSendCancel(cid, 'Command requires param')
    return true
  end
  if getPlayerItemCount(cid,2112) < 1 then
        doPlayerSendCancel(cid,"You Dont Have Change Name Item")
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        return true
    end

  if not param then
    doPlayerSendCancel(cid, string.format('Use: %s  <newname>', words))
    return true
  end
    if string.find(param,"1") or string.find(param,"2") or string.find(param,"1") or string.find(param,"3") or string.find(param,"4") or string.find(param,"5") or
        string.find(param,"6") or string.find(param,"7") or string.find(param,"8") or string.find(param,"9") or string.find(param,"0") or string.find(param,"-") or
        string.find(param,"=") or string.find(param,"<") or string.find(param,">") or string.find(param,"/") or string.find(param,"&") or string.find(param,"@") then
        doPlayerSendCancel(cid, "This Name Is Invalid")
        return true
    end
  local length = string.len(param)
  if math.min(math.max(length, config.newNameLength[1]), config.newNameLength[2]) ~= length then
    doPlayerSendCancel(cid, string.format('New name has to be between %i and %i characters long.', config.newNameLength[1], config.newNameLength[2]))
    return true
  end
  doPlayerRemoveItem(cid,2112,1)
  setPlayerName(cid, getPlayerName(cid),param)
  return true
end
 
Last edited:
When I have an item in my backpack and I type !rename the message "Command requires param" is displayed
And when he types:
!rename "test
!rename test
!rename "test"
!rename 'test
!rename 'test'

nothing is displayed and the name doesn't change
 
I am sorry but the problem is solved. Change in actions.xml file.
From:
<talkaction words="!rename" script="rename.lua" />
To:
<talkaction words="!rename" separator=" " script="rename.lua" />
 
Back
Top