Crie um arquivo em npcs/script e renomeie para trocadenick
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "trocar nome") then
if getPlayerItemCount(cid, 2150) < 4 then -- (2150, id do item) ( < 4, Se o player não tiver esses 4 apareceré uma mensagem que não tem a quantidade necessária)
npcHandler:say("Você não tem a quantidade necessária para trocar seu nome!}", cid)
return TRUE
end
doPlayerRemoveItem(cid, 2150, 4) -- (2150 id do item) (4 numero de itens que precisa)
npcHandler:releaseFocus(cid)
doAddPlayerBanishment(getPlayerGUID(cid), PLAYERBAN_LOCK)
doRemoveCreature(cid)
return TRUE
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Agora crie um arquivo na pasta "npc" com o nome trocadenick e cole dentro
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Trocar Nome" script="trocadenick.lua" walkinterval="0" speed="0" floorchange="0">
<health now="100" max="100"/>
<look type="509"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|, eu posso {trocar nome} por 4 pontos!" /> -- Frase que aparecerá quando o player falar Hi
</parameters>
</npc>