Postado Abril 3, 2016 9 anos Opa, tudo bem? Então, eu peguei o script do Dalk da base que eu uso (Pokemon Dash Advanced (1.0)) e tentei dar uma adaptada para o jeito que eu queria. Se alguém puder me ajudar, ficarei extremamente grato. Eu sou novo em lua, estou recém aprendendo, mas estou precisando desse NPC por agora. Eu gostaria que ele trocasse o nome dos players por 3 diamonds (eu peguei um código que fazia por name_lock e tentei adaptar no meu código, mas quando eu digo "yes", não acontece nada). De preferência, trocar o nome falando com o NPC mesmo, não por name_lock, exemplo: hi/change name/yes/nome que eu quero/yes. Ai o player reloga e o nome é trocado. Mas se não tiver como e o único jeito for por name_lock mesmo, sem problemas. E a opção de trocar de cidade natal. Erro depois de dar "change name", "yes": (sou burro e não sei inserir imagem) http://prntscr.com/anp4f0 Thanks boyz dalk.lua: Spoiler 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 msg = string.lower(msg) --------- local configs = { diamondsID = 2145, --id do diamond no items.xml/otb... (achu q vais ter q criar, ou pegar algum item q ja tenha ae...) VIP = {days = 30, cost = 10}, --days = qnts dias de VIP o player compra por vez.... cost = custo para virar VIP... SEX = {cost = 3}, --cost = custo para trocar de sexo... NAME = {cost = 3}, TOWN = {cost = 3}, } if (msgcontains(msg, 'diamond account') or msgcontains(msg, 'diamond')) then selfSay("You want to buy a diamond account and be VIP for "..configs.VIP.days.." days? It will cost "..configs.VIP.cost.." diamonds!", cid) talkState[talkUser] = 2 return true elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then if getPlayerItemCount(cid, configs.diamondsID) >= configs.VIP.cost then selfSay("Ok then, now you have "..configs.VIP.days.." days of VIP! Enjoy!", cid) doPlayerAddPremiumDays(cid, configs.VIP.days) doPlayerRemoveItem(cid, configs.diamondsID, configs.VIP.cost) talkState[talkUser] = 0 return true else selfSay("You need atleast "..configs.VIP.cost.." diamonds to do that!", cid) talkState[talkUser] = 0 return true end elseif (msgcontains(msg, 'sex change') or msgcontains(msg, 'sex')) then selfSay("So you want to change of sex? It will cost "..configs.SEX.cost.." diamonds", cid) talkState[talkUser] = 3 return true elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then if getPlayerItemCount(cid, configs.diamondsID) >= configs.SEX.cost then local sex = getPlayerSex(cid) selfSay("Ok then, now you are of the sex "..(sex == 1 and "female" or "male")..". Enjoy!", cid) doPlayerSetSex(cid, (sex == 1 and 0 or 1)) doPlayerRemoveItem(cid, configs.diamondsID, configs.SEX.cost) talkState[talkUser] = 0 return true else selfSay("You need atleast "..configs.SEX.cost.." diamonds to do that!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'change name') then selfSay("So you want to change your name? It will cost "..configs.NAME.cost.." diamonds", cid) talkState[talkUser] = 4 return true elseif msgcontains (msg, 'yes') and talkState[talkUser] == 4 then if getPlayerItemCount(cid, config.diamondsID) >= config.NAME.cost then doPlayerRemoveItem(cid, configs.diamondsID, configs.NAME.cost) npcHandler:releaseFocus(cid) doAddPlayerBanishment(getPlayerGUID(cid), PLAYERBAN_LOCK) doRemoveCreature(cid) talkState[talkUser] = 0 return true else selfSay("You need atleast "..configs.NAME.cost.." diamonds to do that!", cid) talkState[talkUser] = 0 return true end elseif (msgcontains(msg, 'change town') or msgcontains(msg, 'sex')) then selfSay("So you want to change your hometown? It will cost "..configs.TOWN.cost.." diamonds", cid) talkState[talkUser] = 5 return true elseif msgcontains(msg, 'yes') and talkState[talkUser] == 5 then selfSay("Ok then, tell me what city do you want?", cid) talkState[talkUser] = 6 return true elseif places[msg] and talkState[talkUser] == 6 then if getPlayerItemCount(cid, configs.diamondsID) >= configs.TOWN.cost then selfSay("Done, enjoy your new city!", cid) doPlayerSetTown(cid, places[msg]) doPlayerRemoveItem(cid, configs.diamondsID, configs.TOWN.cost) talkState[talkUser] = 0 return true else selfSay("You need atleast "..configs.TOWN.cost.." diamonds to do that!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'no') then selfSay("Ok then, tell me again what you want...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) .Dalk.xml: Spoiler <?xml version="1.0" encoding="UTF-8"?> <npc name="Dalk" script="dalk.lua" walkinterval="3000" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="1419" head="114" body="119" legs="114" feet="114" corpse="2212"/> <parameters> <parameter key="message_greet" value="Welcome |PLAYERNAME|, I can sell to you: {Diamond Account}, {Sex Change}, {Change Name}, {Change Town} what you want?"/> </parameters> </npc> Editado Abril 3, 2016 9 anos por Talesigorvr (veja o histórico de edições) Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
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.