OTServ I have a system that when buying a vip player automatically changes its name to [VIP] Name.
So that when the ends and the player's VIP system will remove the name of this error if someone created an equal interval.
How do I do not chars player with the old name of the VIP?
vipname.lua
So that when the ends and the player's VIP system will remove the name of this error if someone created an equal interval.
How do I do not chars player with the old name of the VIP?
vipname.lua
Lua:
function pegarNome(name)
return string.sub(name, 7)
end
function onLogin(cid)
local name = getCreatureName(cid)
local nome = getPlayerGUID(cid)
if isVip(cid) then
if string.sub(name, 1,6) == "[VIP] " then
return true
else
db.query("UPDATE `players` SET `name` = '[VIP] "..name.."' WHERE `id`= " .. nome .. ";")
doPlayerSendTextMessage(cid,19,"You go kicked in 10 seconds for update you name.")
addEvent(doRemoveCreature,10000,cid)
end
else
if string.sub(name, 1,6) == "[VIP] " then
db.query("UPDATE `players` SET `name` = '"..pegarNome(getCreatureName(cid)).."' WHERE `id`= " .. nome .. ";")
doPlayerSendTextMessage(cid,19,"You go kicked in 10 seconds for update you name.")
addEvent(doRemoveCreature,10000,cid)
end
end
return true
end