Ir para conteúdo

Featured Replies

Postado

Olá Estou precisando uma ajuda nesse npc... 

 

Meu objetivo é fazer com que el retire os storages value do player cada vez que ele pagar uma contia em dinheiro.

 

Esse aqui não ta funcionando, algum palpite ?

 

 

 

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, 'reset') then
	 
	 if getPlayerStorageValue(cid,3917) == 1 and getPlayerStorageValue(cid,3918) == 1 and getPlayerStorageValue(cid,3919) == 1 and getPlayerStorageValue(cid,3920) == 1 and getPlayerStorageValue(cid,3921) >= 1 and getPlayerStorageValue(cid,3922) == 1 and getPlayerStorageValue(cid,3923) >= 1 and getPlayerStorageValue(cid,3924) == 1 then


							 selfSay('Agora voce pode repetir os gduelos nos gyms.', cid)

							 setPlayerStorageValue(cid,3917,0)
							 setPlayerStorageValue(cid,3918,0)
							 setPlayerStorageValue(cid,3919,0)
							 setPlayerStorageValue(cid,3920,0)
							 setPlayerStorageValue(cid,3921,0)
							 setPlayerStorageValue(cid,3922,0)
							 setPlayerStorageValue(cid,3923,0)
							 setPlayerStorageValue(cid,3924,0)

					 else

							 selfSay('Voce ja resetou os gyms.', cid)

					 end

	 end

	 return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Postado

MMHUCMQ.png  Esta é uma mensagem automática, este tópico foi movido para a área correta.
  Regras do fórum: http://www.tibiaking.com/forum/topic/1281-regras-gerais/#comment-7680

Este tópico foi movido:
De: Scripting OTServ > OTServ > Monsters e NPCs
Para: Suporte OTServ > OTServ > Suporte de Scripts

Tente isso..

 

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)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "reset") then
		local str = getPlayerStorageValue(cid, quest)
		if(srt(cid,3917) == 1 and srt(cid,3918) == 1 and srt(cid,3919) == 1 and srt(cid,3920) == 1 and srt(cid,3921) >= 1 and srt(cid,3922) == 1 and srt(cid,3923) >= 1 and srt(cid,3924) == 1 then) then
			npcHandler:say("Agora voce pode repetir os gduelos nos gyms.", cid) 
			setPlayerStorageValue(cid,3917,0)
			setPlayerStorageValue(cid,3918,0)
			setPlayerStorageValue(cid,3919,0)
			setPlayerStorageValue(cid,3920,0)
			setPlayerStorageValue(cid,3921,0)
			setPlayerStorageValue(cid,3922,0)
			setPlayerStorageValue(cid,3923,0)
			setPlayerStorageValue(cid,3924,0)
			talkState[talkUser] = 0
		else
			npcHandler:say("Agora voce pode repetir os gduelos nos gyms.", cid) 
			Voce ja resetou os gyms.
			talkState[talkUser] = 0
		end
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule)

 

discord.pngDiscord: vankk #7765

Precisando de ajuda? Entre em contato comigo via Discord.

 

Muitos vêm seus muitos dias de glória, mas poucos vêm seus muitos dias de luta.

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo