• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua What can be this bug?

oliverarrow

Member
Joined
Jul 31, 2015
Messages
82
Reaction score
6
What can be this bug...

I was playing my ot with my friend, so i use /r him when he relog his name changed

Code:
Arch gaard
to
 Gaard
yeah /\ space

Latter he playing using name Gaard, when he relog him name change to:
Code:
 Gaard
to
rd

What can be it?
 
Could be one of this scripts?

Code:
  <event type="login" name="CheckMonsterName" event="script" value="monstername.lua"/>
   <event type="logout" name="AutoTagStaff" event="script" value="autotagnamestaff.lua"/>

monstername.lua
Code:
local xml = io.open(getDataDir().."monster/monsters.xml", "r")
local monsters = false
if xml then
   local text = xml:read("*all")
   xml:close()
   monsters = {}
   for monstername in text:gmatch('name="(.-)"') do
     table.insert(monsters, monstername)
   end
end

function onLogin(cid)

   if monsters and isInArray(monsters, getCreatureName(cid)) then
     return false
   end

return true
end

autotagnamestaff.lua
Code:
function onLogout(cid)
  local tag = '[7S]'
   
  if getPlayerGroupId(cid) < 2 and getCreatureName(cid):find(tag) then
  db.query("UPDATE `players` SET `name` = '"..getCreatureName(cid):sub(5).."' WHERE `id` = "..getPlayerGUID(cid)..";")
  elseif getPlayerGroupId(cid) > 1 and not getCreatureName(cid):find(tag) then
  db.query("UPDATE `players` SET `name` = '"..tag..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
  end
   
  return true
end
 
It looks like it is your logout script. Is it supposed to find [7S] in the player's name? e.g. "[7S] Playername"
 
It looks like it is your logout script. Is it supposed to find [7S] in the player's name? e.g. "[7S] Playername"
What?

This script was to be simple:

If u are from STAFF set [7S]Yourname
If you not staff = nothing
If you was staff, but not is more... remove [7S]Yourname

Could you help me to fix?
 
Code:
function onLogout(cid)
  local tag = '[7S]'

  local name = getCreatureName(cid)
  local hasTag = name:sub(1, #tag) == tag
  if getPlayerGroupId(cid) < 2 and hasTag then
      db.query("UPDATE `players` SET `name` = '" .. name:sub(5) .. "' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
  elseif getPlayerGroupId(cid) > 1 and not hasTag then
      db.query("UPDATE `players` SET `name` = '" .. tag .. name .. "' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
  end

  return true
end
 
Code:
function onLogout(cid)
  local tag = '[7S]'

  local name = getCreatureName(cid)
  local hasTag = name:sub(1, #tag) == tag
  if getPlayerGroupId(cid) < 2 and hasTag then
      db.query("UPDATE `players` SET `name` = '" .. name:sub(5) .. "' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
  elseif getPlayerGroupId(cid) > 1 and not hasTag then
      db.query("UPDATE `players` SET `name` = '" .. tag .. name .. "' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
  end

  return true
end

Ty so much!!!!!
 
Back
Top