Ir para conteúdo

Featured Replies

Postado
local ChangeName = ID DO ITEM AQUI

function onSay(cid, words, param, channel)local p = string.explode(param, ',')
if(getPlayerItemCount(cid, ChangeName) <= 1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have donate coins.")
end
if(getPlayerItemCount(cid, ChangeName) > 1) then
if(param == "") then
doPlayerSendCancel(cid, "Command requires param.")
return true
end
if(words == "/name") then
if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then
return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.")
elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then
return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.")
elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then
return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.")
end
doPlayerRemoveItem(cid, ChangeName, 2)
return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".")
end
end
end

Tenta aí.

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

  • Respostas 14
  • Visualizações 702
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local ChangeName = ID DO ITEM AQUI function onSay(cid, words, param, channel)local p = string.explode(param, ',') if(getPlayerItemCount(cid, ChangeName) == 0) then doPlayerSendTextMessage(cid, MESSAG

Postado

Ah pera, vi agr o seu edit la. Mas ñ entendi a parte da msg. Vc qr que qual msg ñ apareça??

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Postado
local ChangeName = ID DO ITEM AQUI

function onSay(cid, words, param, channel)local p = string.explode(param, ',')
if(getPlayerItemCount(cid, ChangeName) == 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have donate coins.")
end
if(getPlayerItemCount(cid, ChangeName) == 1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have sufficient donate coins.")
end
if(getPlayerItemCount(cid, ChangeName) > 1) then
if(param == "") then
doPlayerSendCancel(cid, "Command requires param.")
return true
end
if(words == "/name") then
if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then
return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.")
elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then
return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.")
elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then
return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.")
end
doPlayerRemoveItem(cid, ChangeName, 2)
return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".")
end
end
end

Vê se é assim que vc qr. Eu botei 3 tipos de msg, uma pra quando o player ñ tiver, outra pra qnd tiver 1 item, e a pra quando o player conseguir executar o comando pq tem 2 itens no minimo.

Editado por danihcv (veja o histórico de edições)

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.1k

Informação Importante

Confirmação de Termo