Postado Fevereiro 25, 2021 4 anos Ola, eu estive pedindo ajuda no Discord do TK, pra q o NPC somente remova o item se o item for o verdadeiro, ou seja, se voce tiver dois itens do mesmo ID na bag e, um for o veradeiro e o outro falso, ele so remove se o item verdadeiro estiver no slot 1 da bag. Entao eu desejo q ele remova o item verdadeiro independete se tem dois ou mais itens do mesmo ID, mas que remova o que estiver com a descriçao X. Este é NPC quem eu estive tentando fazer pra q remova somente se o item tiver X decriçao. Spoiler local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureSay(cid,type,msg) npcHandler:onCreatureSay(cid, type, msg) if isInArray({"poem", "ps"}, msg) then npcHandler:say("Do you want to exchange this Poem for a {beach backpack}?", cid) talkState = 1 local item = getPlayerItemCount(cid,6119) >= 1 elseif msgcontains(msg, 'yes') and talkState == 1 then if item then doPlayerRemoveItem(cid,6119,1, getItemAttribute(item.uid, "description") == "test") doPlayerAddItem(cid,5949,1) npcHandler:say("here's your item", cid) else npcHandler:say("You don't have the item", cid) end end end npcHandler:addModule(FocusModule:new()) @Breno Alves
Postado Fevereiro 26, 2021 4 anos Tenta assim local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureSay(cid,type,msg) npcHandler:onCreatureSay(cid, type, msg) if isInArray({"poem", "ps"}, msg) then npcHandler:say("Do you want to exchange this Poem for a {beach backpack}?", cid) talkState = 1 elseif msgcontains(msg, 'yes') and talkState == 1 then item = getPlayerItemCount(cid,6119) >= 1 if item then if getItemAttribute(item.uid, "description") == "teste" then doPlayerRemoveItem(cid,6119,1) doPlayerAddItem(cid,5949,1) npcHandler:say("here's your item", cid) end else npcHandler:say("You don't have the item", cid) end end end npcHandler:addModule(FocusModule:new()) Baiak Thunder New TFS Downgrade [TFS 1.5 - 8.60] Gesior Ferobra Downgrade Evento Monster Hunt [TFS 1.X] Evento SafeZone [TFS 1.X] Online Bonus System [TFS 1.X] Dodge & Critical [TFS 1.X] Nova moeda, funcionando com NPCs [TFS 1.X] Square System [TFS 1.X] Loot Channel [TFS 1.X] Gerenciador de Quests [All TFS] NPCs comprando vial/flasks por storage [TFS 1.X] AntiBot [TFS 1.X] Como compilar TFS 0.X
Postado Fevereiro 26, 2021 4 anos Autor 19 minutos atrás, Breno Alves disse: Tenta assim local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureSay(cid,type,msg) npcHandler:onCreatureSay(cid, type, msg) if isInArray({"poem", "ps"}, msg) then npcHandler:say("Do you want to exchange this Poem for a {beach backpack}?", cid) talkState = 1 elseif msgcontains(msg, 'yes') and talkState == 1 then item = getPlayerItemCount(cid,6119) >= 1 if item then if getItemAttribute(item.uid, "description") == "teste" then doPlayerRemoveItem(cid,6119,1) doPlayerAddItem(cid,5949,1) npcHandler:say("here's your item", cid) end else npcHandler:say("You don't have the item", cid) end end end npcHandler:addModule(FocusModule:new()) Alterei getPlayerItemCount(cid,6119) >= 1 por getPlayerItemById(cid, true, 6119) nao gerou erro mas tbm nao removeu o item Editado Fevereiro 26, 2021 4 anos por Backa (veja o histórico de edições)
Postado Fevereiro 26, 2021 4 anos 14 horas atrás, Backa disse: Ola, eu estive pedindo ajuda no Discord do TK, pra q o NPC somente remova o item se o item for o verdadeiro, ou seja, se voce tiver dois itens do mesmo ID na bag e, um for o veradeiro e o outro falso, ele so remove se o item verdadeiro estiver no slot 1 da bag. Entao eu desejo q ele remova o item verdadeiro independete se tem dois ou mais itens do mesmo ID, mas que remova o que estiver com a descriçao X. Este é NPC quem eu estive tentando fazer pra q remova somente se o item tiver X decriçao. Mostrar conteúdo oculto local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureSay(cid,type,msg) npcHandler:onCreatureSay(cid, type, msg) if isInArray({"poem", "ps"}, msg) then npcHandler:say("Do you want to exchange this Poem for a {beach backpack}?", cid) talkState = 1 local item = getPlayerItemCount(cid,6119) >= 1 elseif msgcontains(msg, 'yes') and talkState == 1 then if item then doPlayerRemoveItem(cid,6119,1, getItemAttribute(item.uid, "description") == "test") doPlayerAddItem(cid,5949,1) npcHandler:say("here's your item", cid) else npcHandler:say("You don't have the item", cid) end end end npcHandler:addModule(FocusModule:new()) @Breno Alves É pra checar se existe um ITEMID X com a descrição X no SLOT 1 e caso sim, remover? Se não for isso reformule a sua ideia.
Postado Fevereiro 26, 2021 4 anos Autor 3 horas atrás, 139 disse: É pra checar se existe um ITEMID X com a descrição X no SLOT 1 e caso sim, remover? Se não for isso reformule a sua ideia. o item verde é quem esta com a descriçao, e o vermelho, é o normal. Entao ele vai checar se o Player tem o item verde e vai remover somente o verde. Que no caso com a descriçao. Porem, se tiver 2 itens do mesmo ID como a imagem mostra, ele so remove se o item verde for, o primeiro do slot da bag ou seja, se ele estiver lugar do item vermelho. Ou se o item verde for o unico item na bag. entao eu gostaria que ele removesse somente o item verde idependete de qual slot esteja e quantos outros itens do mesmo ID tenha.
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.