Ir para conteúdo

Mikethekingsz

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Obrigado
    Mikethekingsz deu reputação a Imperius em ESTOQUE DE ITEM   
    Veja se é isso o que você está procurando. TFS 0.4:
     
    em data > npc > Testador.xml:
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="Testador" script="data/npc/scripts/Testador.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="160" head="77" body="79" legs="56" feet="115" addons="0"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|! Deseja {comprar} alguma coisa?"/> </parameters> </npc>  
     
    data > npc > scripts > Testador.lua:
     
    -- Imperius ~ Alecrim 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:lower()) end function onThink() npcHandler:onThink() end local talkState = {} local configNPC = { storage = 40004400, estoque = 10, -- Quantas vezes o player poderá comprar este item? itemID = 2400, -- ID do item que será vendido pelo NPC moedaID = 6500, -- ID da moeda de troca customizada. valor = 45, -- Quantas moedas o player precisará ter para comprar o item? } function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if getPlayerStorageValue(cid, configNPC.storage) < 0 then setPlayerStorageValue(cid, configNPC.storage, configNPC.estoque) end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) local itemName = getItemNameById(configNPC.itemID) local moedaName = getItemNameById(configNPC.moedaID) if isInArray({"comprar", "buy"}, msg) then if getPlayerStorageValue(cid, configNPC.storage) < 1 then selfSay("Voce já comprou todo o meu estoque.", cid) npcHandler:releaseFocus(cid) else selfSay("Voce quer trocar 1x {"..itemName.."} por "..configNPC.valor.."x {"..moedaName.."}?", cid) talkState[talkUser] = 1 end end if isInArray({"sim", "yes"}, msg) and talkState[talkUser] == 1 then talkState[talkUser] = 0 if getPlayerItemCount(cid, configNPC.moedaID) >= configNPC.valor then setPlayerStorageValue(cid, configNPC.storage, getPlayerStorageValue(cid, configNPC.storage) - 1) -- Atualiza o estoque do player doPlayerRemoveItem(cid, configNPC.moedaID, configNPC.valor) -- Remove as moedas do player doPlayerAddItemEx(cid, doCreateItemEx(configNPC.itemID, 1)) -- Da o item ao player doSendMagicEffect(getThingPos(cid), 13) -- Da um efeitinho no player selfSay("Certo! Troca realizada.", cid) else selfSay("Você não tem a quantidade de "..moedaName.." o suficiente", cid) npcHandler:releaseFocus(cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
     
     
  2. Haha
    Mikethekingsz recebeu reputação de Nother em BUG SKILL   
    @NotherStage mano, mas acho que resolvi, não tava alterando a stage quando passava de um certo ponto porque eu tinha esquecido de adicionar no xml uma linha do stageadvanced kkk, vlw aí
  3. Curtir
    Mikethekingsz deu reputação a Movie em !pvp on/off   
    Sim, é possivel!
  4. Obrigado
    Mikethekingsz deu reputação a 139 em SPELL ATTACK   
    local chance = 50 local condition = createConditionObject(CONDITION_MUTED) setConditionParam(condition, CONDITION_PARAM_TICKS, 5000) function onCastSpell(cid, var)     if not isPlayer(cid) then          return false      end     if math.random(1,100) > chance then          doSendAnimatedText(getCreaturePosition(cid), "Miss!", 215)             return false      end     if exhaustion.check(cid, 13117) == true then         doPlayerSendCancel(cid, "Podera usar novamente dentro de 15 segundos.")         doSendMagicEffect(getCreaturePosition(cid), 2)         return false     end     local tar = variantToNumber(var)     if hasCondition(tar, CONDITION_MUTED) == true then         return false     else         if isPlayer(tar) == true then             doAddCondition(tar, condition)             doSendAnimatedText(getCreaturePosition(tar), "Silenced!", 215)         else             doPlayerSendCancel(cid, "Silence can be cast only on other players.")             return false         end     end     exhaustion.set(cid, 13117, 15.0)     return true end  

Informação Importante

Confirmação de Termo