Postado Maio 28, 2013 12 anos Eae galera blza? Preciso de uma ajudinha rapidinha aqui, sei que vocês são so caras do script. então, possuo um script de npc que faz trocas de Tokens por alguns items, porém, o npc não está perguntando para o player se ele deseja realmente trocar, quando o player fala o nome do item, o npc já troca na hora, sem ao mesmo informar ao player a quantidade de tokens necessarios para a troca Gostaria que o procedimento seja assim: NPC: Eu vendo demon helmet, boots of haste Player: boots of haste NPC: O item boots of haste custa 10 tokens, deseja trocar? Player: Yes NPC: Troca efetuada! ( e então entregar o item, avá) NOTA: Se o player não tiver a quantidade de tokens necessária, informar ao player e não realizar a troca. Aguardo, obrigado! codigo: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 local t = { tokens = 5468, -- id of tokens items = { [1] = {"boots of haste", 10, 2195}, [2] = {"demon helmet", 10, 2493}, [3] = {"frozen starlight", 10, 2361}, [4] = {"spellbook of dark mysteries", 10, 8918}, [5] = {"royal crossbow", 10, 8851} } } function creatureSayCallback(cid, type, msg) imsexyandiknowit,s = 0, "" for i = 1, #t.items do imsexyandiknowit = imsexyandiknowit + 1 s = s .. "{" ..t.items[i][1].. "}" b = i == #t.items and "." or i == (#t.items-1) and " and " or ", " s = s .. b end if msgcontains(msg, 'trade') then npcHandler:say("You can change your tokens for: " .. s .."", cid) end for i = 1, #t.items do if msgcontains(msg, t.items[i][1]) then if doPlayerRemoveItem(cid, t.tokens, t.items[i][2]) then doPlayerAddItem(cid, t.items[i][3], 1) npcHandler:say("Aqui tienes tu " .. t.items[i][1] .. "!", cid) else npcHandler:say("You don't have enough tokens!", cid) end end end return true end npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) http://www.foxots.com
Postado Maio 28, 2013 12 anos Fiz correndo aqui no trampo, q jah ta quase na hora de eu pegar minhas mercedes para ir para casa... testa ae!! além do mais estou meio enferrunado na linguagem e o cara q fez este script fez com algumas coisas diferentes q costumo usar!! porém eu tentei ... mais qqr coisa apenas retorne ae que eu arrumo!! ajudei? REP +... local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 local t = { tokens = 5468, -- id of tokens items = { [1] = {"boots of haste", 10, 2195}, [2] = {"demon helmet", 10, 2493}, [3] = {"frozen starlight", 10, 2361}, [4] = {"spellbook of dark mysteries", 10, 8918}, [5] = {"royal crossbow", 10, 8851} } } function creatureSayCallback(cid, type, msg) imsexyandiknowit,s = 0, "" for i = 1, #t.items do imsexyandiknowit = imsexyandiknowit + 1 s = s .. "{" ..t.items[i][1].. "}" b = i == #t.items and "." or i == (#t.items-1) and " and " or ", " s = s .. b end if msgcontains(msg, 'trade') then npcHandler:say("You can change your tokens for: " .. s .."", cid) end for i = 1, #t.items do if msgcontains(msg, t.items[i][1]) then npcHandler:say("Este item custa " .. t.items[i][2] .."tokens, deseja trocar?", cid) if msgcontains(mag, 'yes') then if doPlayerRemoveItem(cid, t.tokens, t.items[i][2]) then doPlayerAddItem(cid, t.items[i][3], 1) npcHandler:say("Aqui tienes tu " .. t.items[i][1] .. "!", cid) else npcHandler:say("You don't have enough tokens!", cid) end else npcHandler:say("Nao?, Okay muito obrigado", cid) end end return true end npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Maio 28, 2013 12 anos por Carinhah (veja o histórico de edições)
Postado Maio 28, 2013 12 anos Autor Fail, ele não responde nem o "Hi" agora o.O http://www.foxots.com
Postado Maio 28, 2013 12 anos Editado Maio 28, 2013 12 anos por Carinhah (veja o histórico de edições)
Postado Maio 28, 2013 12 anos Removido! Editado Maio 28, 2013 12 anos por GiovaniRodrigo (veja o histórico de edições) Spoiler local config = { delrey = getPlayerCarValue(cid, DELREY), cigarro = getPlayerCancer(cid, DERBY), prostituta = getPlayerAIDS(cid, cracuda), tresOitao = getPlayerRevorvi(cid, 38) } if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS") end
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.