Ir para conteúdo
  • 0

[PEDIDO NPC] Verifica e remove storage


felipenchagas

Pergunta

3 respostass a esta questão

Posts Recomendados

  • 0

Sabe fazer o .xml?

 

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
local storagesDuel = {52480, 52481, 52482, 52482, 52483, 52484, 52485, 6598754}
local t = {}
    if msgcontains(msg:lower(), "storage") or msgcontains(msg:lower(), "remove") then
        for storage = 1, #storagesDuel do
            if getPlayerStorageValue(cid, storagesDuel[storage]) > -1 then
                table.insert(t, storagesDuel[storage])
            end
        end
        if #t < 1 then
            selfSay("O valor de todas as storages de Duel no seu personagem é -1.", cid)
            talkState[talkUser] = 0
            return true
        else
            selfSay("Storages removidas.", cid)
            for i = 1, #t do
                setPlayerStorageValue(cid, t[i], -1)
            end
            talkState[talkUser] = 0
            return true
        end
    end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...