Postado Maio 18, 2014 11 anos 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... http://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'> Atenciosamente, Daniel. Abraços! Meus tutoriais: Programação: Resolvendo QUALQUER erro na data base. Scripts (system's, creaturescripts, mod's, NPC's, etc): (Sistema) GOD Ambient Light Full. Adicionando novas mounts ao servidor [NPC] Papai Noel que dá presente todo ano. Web-site: Resolvendo problema de caracteres especiais em PHP Formatando textos em PHP! Mudando a cor, tamanho, fonte, etc. Criando e configurando tabelas para paginas PHP
Postado Maio 18, 2014 11 anos Autor remove o item, mas ainda continua mostrando a mensagem e ainda dá pra trocar o nome dos outros players.. Ajudei? REP+ Spriter: |||||||||| 10%
Postado Maio 18, 2014 11 anos 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... http://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'> Atenciosamente, Daniel. Abraços! Meus tutoriais: Programação: Resolvendo QUALQUER erro na data base. Scripts (system's, creaturescripts, mod's, NPC's, etc): (Sistema) GOD Ambient Light Full. Adicionando novas mounts ao servidor [NPC] Papai Noel que dá presente todo ano. Web-site: Resolvendo problema de caracteres especiais em PHP Formatando textos em PHP! Mudando a cor, tamanho, fonte, etc. Criando e configurando tabelas para paginas PHP
Postado Maio 18, 2014 11 anos Autor Bom, o script está legal assim, só que quando o player não tiver o item apareça uma mensagem dizendo que ele não tem. Ajudei? REP+ Spriter: |||||||||| 10%
Postado Maio 18, 2014 11 anos 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 Maio 18, 2014 11 anos por danihcv (veja o histórico de edições) Te ajudei?? REP + e ficamos quites... http://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'> Atenciosamente, Daniel. Abraços! Meus tutoriais: Programação: Resolvendo QUALQUER erro na data base. Scripts (system's, creaturescripts, mod's, NPC's, etc): (Sistema) GOD Ambient Light Full. Adicionando novas mounts ao servidor [NPC] Papai Noel que dá presente todo ano. Web-site: Resolvendo problema de caracteres especiais em PHP Formatando textos em PHP! Mudando a cor, tamanho, fonte, etc. Criando e configurando tabelas para paginas PHP
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.