Ir para conteúdo
  • Cadastre-se

GiovaniRodrigo

Membro
  • Total de itens

    431
  • Registro em

  • Última visita

  • Dias Ganhos

    15

Histórico de Curtidas

  1. Curtir
    GiovaniRodrigo recebeu reputação de Breniinx em [Resolvido] [PEDIDO] NPC Troca Item por outro Item   
    Crie um arquivo chamado Jax.lua na pasta data/npc/scripts e cole 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   local items = {           item1 = {2346, 2349}, -- item1 item que será pedido e que será dado na primeira troca           item2 = {2033, 15515} -- item2 item que será pedido e que será dado na segunda troca } local counts = {           count1 = {1, 1}, -- count1 quantidade que será pedido e que será dado na primeira troca           count2 = {10, 1} -- count2 quantidade que será pedido e que será dado na segunda troca }   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, 'blue note') then                     if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then                               doPlayerRemoveItem(cid, items.item1[1], counts.count1[1])                               doPlayerAddItem(cid, items.item1[2], counts.count1[2])                               selfSay('You just swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid)                     end           elseif msgcontains(msg, 'bar of gold') then                     if getPlayerItemCount(cid, items.item2[1]) >= counts.count2[1] then                               doPlayerRemoveItem(cid, items.item2[1], counts.count2[1])                               doPlayerAddItem(cid, items.item2[2], counts.count2[2])                               selfSay('You just swap '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..' for '.. counts.count2[2] ..' '.. getItemNameById(items.item2[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..'.', cid)                     end           end           return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
    Crie um arquivo chamado Jax.xml na pasta data/npc e cole isso
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="Jax" script="Jax.lua" walkinterval="2000" floorchange="0">           <health now="150" max="150" />           <look type="134" head="57" body="59" legs="40" feet="76" corpse="2212" />           <parameters>                     <parameter key="message_greet" value="Hello |PLAYERNAME|. Do not want to make an exchange? I have {blue note} and {bar of gold}." />                     <parameter key="message_farewell" value="Bye bye!" />           </parameters> </npc>  
    Testado e está 100% funcional
     
    Att.
    Giovani Rodrigo
  2. Obrigado
    GiovaniRodrigo recebeu reputação de koyotestark em [Resolvido] TILE POR STORAGE   
    Crie um arquivo chamado tilestorage.lua na pasta data/movements/scripts e cole isso

    function onStepIn(cid, item, position, fromPosition)           if getPlayerStorageValue(cid, 11138) <= 0 then                     doTeleportThing(cid, fromPosition, TRUE)                     doPlayerSendCancel(cid, "You don't have premission to pass.")           end           return TRUE end  
    Adicione a seguinte linha no arquivo movements.xml que se encontra na pasta data/movements

    <movevent type="StepIn" actionid="6587" event="script" value="tilestorage.lua"/>  
    No map editor coloque ActionID do tile 6587.
    Não testado.
    Dúvidas? Me avise.
     
    Att.
    Giovani Rodrigo
  3. Gostei
    GiovaniRodrigo recebeu reputação de iyagod em [Resolvido] TILE POR STORAGE   
    Crie um arquivo chamado tilestorage.lua na pasta data/movements/scripts e cole isso

    function onStepIn(cid, item, position, fromPosition)           if getPlayerStorageValue(cid, 11138) <= 0 then                     doTeleportThing(cid, fromPosition, TRUE)                     doPlayerSendCancel(cid, "You don't have premission to pass.")           end           return TRUE end  
    Adicione a seguinte linha no arquivo movements.xml que se encontra na pasta data/movements

    <movevent type="StepIn" actionid="6587" event="script" value="tilestorage.lua"/>  
    No map editor coloque ActionID do tile 6587.
    Não testado.
    Dúvidas? Me avise.
     
    Att.
    Giovani Rodrigo
  4. Gostei
    GiovaniRodrigo recebeu reputação de ADM Mayk on BaiakME em (Resolvido)da use em x item é receber a outfit   
    Ele funciona da seguinte maneira, o jogador usa o item de ID X para ganhar a OUTFIT X. Esse item só pode ser usado uma vez por jogador.
     
    Na pasta data/actions/scripts crie um arquivo itemOutfit.lua e coloque esse código:
    local config = { tableItem = { -- [Id do item] = {storage = Não mexa, outfitFemale = lookType do outfit feminino, outfitMale = lookType do outfit masculino} [2018] = {storage = 200201, outfitFemale = 371, outfitMale = 370}, [2019] = {storage = 200202, outfitFemale = 373, outfitMale = 372}, [2020] = {storage = 200203, outfitFemale = 375, outfitMale = 374}, [2021] = {storage = 200204, outfitFemale = 377, outfitMale = 376}, [2022] = {storage = 200205, outfitFemale = 379, outfitMale = 378}, [2024] = {storage = 200206, outfitFemale = 381, outfitMale = 380}, [2025] = {storage = 200207, outfitFemale = 383, outfitMale = 382} }, addons = 3, -- 0 = Sem Addon / 1 = First Addon / 2 = Second Addon/ 3 = Full Addon needPZ = true, -- true = Precisa estar na protect zone / false = Não precisa estar na protect zone message = "You received a new outfit.", messagePZ = "You need to be in a protect zone.", -- Mensagem se o player não estiver na protect zone messageError = "You already have this outfit." -- Mensagem se o player já tem o addon } function onUse(cid, item, fromPosition, itemEx, toPosition) for id, x in pairs(config.tableItem) do if(item.itemid == id) then if(getPlayerStorageValue(cid, x.storage) > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, config.messageError) elseif(needPZ == true and not getTilePzInfo(getCreaturePosition(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, config.messagePZ) elseif(doRemoveItem(item.uid, 1)) then if(getPlayerSex(cid) == 0) then doSendMagicEffect(fromPosition , CONST_ME_POFF) -- Efeito quando o item for usado e desaparecer doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) doPlayerAddOutfit(cid, x.outfitFemale, config.addons) setPlayerStorageValue(cid, x.storage, 1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.message) else doSendMagicEffect(fromPosition , CONST_ME_POFF) -- Efeito quando o item for usado e desaparecer doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) doPlayerAddOutfit(cid, x.outfitMale, config.addons) setPlayerStorageValue(cid, x.storage, 1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.message) end end end end return true end No arquivo actions.xml coloque essa tag:
    <action itemid="2018;2019;2020;2021;2022;2024;2025" event="script" value="itemOutfit.lua"/> Altere o itemid da tag que você colocou no actions.xml de acordo com os ID dos itens que você configurou no script itemOutfit.lua
     
    TESTADO TFS 0.4 - SCRIPT FUNCIONAL
     
    Log:
    Acrescentado:
    needPZ = true, -- true = Precisa estar na protect zone / false = Não precisa estar na protect zone message = "You received a new outfit.", -- Mensagem quando ganha o outfit -- Efeito doSendMagicEffect(fromPosition , CONST_ME_POFF) -- Efeito quando o item for usado e desaparecer Bug corrigido:
    (LuaInterface::luaDoRemoveItem) Item not found
  5. Gostei
    GiovaniRodrigo deu reputação a Cat em [DUVIDA] Porta de Minning decer dou rep   
  6. Gostei
    GiovaniRodrigo recebeu reputação de Vodkart em (Resolvido)NPC Informativo que marca no mapa.   
    @Mazarati Sempre que precisar, estaremos aqui para ajudar.
  7. Gostei
    GiovaniRodrigo deu reputação a Zanrix em Contruçao de Script   
    O certo é fazer esse script usando movements.
     
    Da um pouco mais de trabalho pra configurar, mas exige menos processo do servidor.
     
    Alterei um pouco o script do @GiovaniRodrigo
     
    Em movements.xml:
    <!-- Capacete --> <movevent type="DeEquip" itemid="2491" event="script" value="fullset.lua"/> <movevent type="Equip" itemid="2491" event="script" value="fullset.lua"/> <!-- Armadura --> <movevent type="DeEquip" itemid="2487" event="script" value="fullset.lua"/> <movevent type="Equip" itemid="2487" event="script" value="fullset.lua"/> <!-- Calça --> <movevent type="DeEquip" itemid="2488" event="script" value="fullset.lua"/> <movevent type="Equip" itemid="2488" event="script" value="fullset.lua"/> <!-- Bota --> <movevent type="DeEquip" itemid="2643" event="script" value="fullset.lua"/> <movevent type="Equip" itemid="2643" event="script" value="fullset.lua"/> <!-- Escudo --> <movevent type="DeEquip" itemid="2392" event="script" value="fullset.lua"/> <movevent type="Equip" itemid="2392" event="script" value="fullset.lua"/> <!-- Arma --> <movevent type="DeEquip" itemid="2519" event="script" value="fullset.lua"/> <movevent type="Equip" itemid="2519" event="script" value="fullset.lua"/> E em movements/scripts/fullset.lua:
    local config = { equipamentos = { {slot = CONST_SLOT_HEAD, id = 2491}, -- Capacete {slot = CONST_SLOT_ARMOR, id = 2487}, -- Armadura {slot = CONST_SLOT_LEGS, id = 2488}, -- Calça {slot = CONST_SLOT_FEET, id = 2643}, -- Bota {slot = CONST_SLOT_LEFT, id = 2392}, -- Escudo {slot = CONST_SLOT_RIGHT, id = 2519} -- Arma }, mensagem = "SETFULL", -- Mensagem que aparece intervalo = 3 -- Intervalo em segundos que a mensagem aparece } local function keepTalking(cid) if(not isPlayer(cid)) then return true end local temFullSet = true for i = 1, #config.equipamentos do if (getPlayerSlotItem(cid, config.equipamentos[i].slot).itemid ~= config.equipamentos[i].id) then temFullSet = false end end if (temFullSet == true) then doSendAnimatedText(getCreaturePosition(cid), config.mensagem, math.random(1, 255)) evento = addEvent(keepTalking, config.intervalo * 1000, cid) end return true end function onEquip(cid, item, slot) local equip = getPlayerSlotItem(cid, slot) if equip.itemid ~= item.itemid then return true end evento = addEvent(keepTalking, 100, cid) return true end function onDeEquip(cid, item, slot) return true end  
  8. Gostei
    GiovaniRodrigo recebeu reputação de tataboy67 em Script de equipe   
    Crie um arquivo com o nome itemEquip.lua na pasta data/creaturescripts/scripts e cole isso
    local config = { slot = CONST_SLOT_FEET, -- Slot que o item está equipado itemID = 2195, -- Item BOH message = "You are fast?", -- Mensagem que aparecerá delay = 10 -- Tempo que a mensagem aparecerá em segundos } function sendMessageItem(cid) if(not isPlayer(cid)) then return true end if(getPlayerSlotItem(cid, config.slot).itemid == config.itemID) then doCreatureSay(cid, config.message, TALKTYPE_MONSTER) addEvent(sendMessageItem, config.delay * 1000, cid) end end function onLogin(cid) sendMessageItem(cid) return true end Coloque este código no arquivo login.lua que está na pasta data/creaturescripts/scripts
    registerCreatureEvent(cid, "ItemEquip") Coloque essa tag no arquivo creaturescripts.xml
    <event type="login" name="ItemEquip" event="script" value="itemEquip.lua"/> A configuração está bem simples pois está tudo comentado, vou apenas colocar os nomes de cada slot do personagem.
    CONST_SLOT_HEAD = Capacete CONST_SLOT_NECKLACE = Colar CONST_SLOT_BACKPACK = Bolsa CONST_SLOT_ARMOR = Peitoral CONST_SLOT_RIGHT = Mão Direita CONST_SLOT_LEFT = Mão Esquerda CONST_SLOT_LEGS = Calça CONST_SLOT_FEET = Bota CONST_SLOT_RING = Anel CONST_SLOT_AMMO = Flechas TESTADO NO TFS 0.4 - FUNCIONAL
     
  9. Gostei
    GiovaniRodrigo recebeu reputação de Ajuda o Chupeta em Script de equipe   
    Crie um arquivo com o nome itemEquip.lua na pasta data/creaturescripts/scripts e cole isso
    local config = { slot = CONST_SLOT_FEET, -- Slot que o item está equipado itemID = 2195, -- Item BOH message = "You are fast?", -- Mensagem que aparecerá delay = 10 -- Tempo que a mensagem aparecerá em segundos } function sendMessageItem(cid) if(not isPlayer(cid)) then return true end if(getPlayerSlotItem(cid, config.slot).itemid == config.itemID) then doCreatureSay(cid, config.message, TALKTYPE_MONSTER) addEvent(sendMessageItem, config.delay * 1000, cid) end end function onLogin(cid) sendMessageItem(cid) return true end Coloque este código no arquivo login.lua que está na pasta data/creaturescripts/scripts
    registerCreatureEvent(cid, "ItemEquip") Coloque essa tag no arquivo creaturescripts.xml
    <event type="login" name="ItemEquip" event="script" value="itemEquip.lua"/> A configuração está bem simples pois está tudo comentado, vou apenas colocar os nomes de cada slot do personagem.
    CONST_SLOT_HEAD = Capacete CONST_SLOT_NECKLACE = Colar CONST_SLOT_BACKPACK = Bolsa CONST_SLOT_ARMOR = Peitoral CONST_SLOT_RIGHT = Mão Direita CONST_SLOT_LEFT = Mão Esquerda CONST_SLOT_LEGS = Calça CONST_SLOT_FEET = Bota CONST_SLOT_RING = Anel CONST_SLOT_AMMO = Flechas TESTADO NO TFS 0.4 - FUNCIONAL
     
  10. Gostei
    GiovaniRodrigo deu reputação a amora murder em (Resolvido)[ERRO] /reload   
    Não tinha esse arquivo. Tinha constant.lua, mas só tinha uns códigos sobre Roshamuul.

    ______________________
    @KotZletY Deu certo aqui, velho! 
    08:06 Reloaded actions.

    O código estava vazio, aí copiei o código da pack do malucooo do GitHub.
    ANTES:
    <?xml version="1.0" encoding="UTF-8"?> <commands> </commands> DEPOIS:
    <?xml version="1.0" encoding="UTF-8"?> <commands> <command cmd="/reload" group="2" acctype="5" log="yes" /> </commands>  
  11. Obrigado
    GiovaniRodrigo recebeu reputação de amora murder em (Resolvido)[ERRO] /reload   
    Encontre esse diretório no seu servidor data/lib e poste todo o script do arquivo 000-constant.lua nesse tópico.
  12. Gostei
    GiovaniRodrigo recebeu reputação de andreguima em Ajuda NPC de Mission   
    Vamos começar pelo NPC.
    Crie um arquivo chamado npcquest.lua na pasta data/npc/scripts e cole isso dentro



     
    Crie um arquivo chamado Npc Quest.xml na pasta data/npc e cole isso dentro
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="Nome Npc" script="data/npc/scripts/npcquest.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1">           <health now="150" max="150"/>           <look type="128" head="97" body="100" legs="115" feet="114" corpse="2212"/>           <parameters>                     <parameter key="message_greet" value="Hello, |PLAYERNAME|! Would like to do a {mission} for me?"/>                     <parameter key="message_walkaway" value="Hey Hey, where you go?"/>                     <parameter key="message_farewell" value="Goodbye |PLAYERNAME|."/>           </parameters> </npc>  
    Configurando



     
    Agora vamos para a porta
     
    Actions
    Crie um arquivo chamado storagedoor.lua na pasta data/action/scripts e cole isso dentro
     
    function onUse(cid, item, frompos, item2, topos)           if getPlayerStorageValue(cid, 30003) >= 1 then                     doTransformItem(item.uid,item.itemid+1)                     doTeleportThing(cid, topos)           else                     doPlayerSendTextMessage(cid, 22, 'You don\'t have access to area.')           end end  
    Adicione a seguinte linha no arquivo actions.xml que esta na pasta data/actions
     
    <action actionid="4587" event="script" value="storagedoor.lua" />  
    Movements
    Crie um arquivo chamado storagedoor.lua na pasta data/movements/scripts e cole isso
     
    function onStepOut(cid, item, position, fromposition)           doTransformItem(item.uid,item.itemid-1) end  
    Adicione a seguinte linha no arquivo movements.xml que esta na pasta data/movements
     
    <movements type="StepOut" actionid="4587" event="script" value="storagedoor.lua" />  
    MapEditor
    No MapEditor coloque a porta com o Action ID 4587
     
    Não testei caso der erro avise.
    Dúvidas? Me avise.
     
    @EDIT
    Editei o script do NPC pois tinha esquecido de algo.
     
    (OBS: Use portas que ela fechada seja um ID antes da aberta, ex: Fechada: 5112 e Aberta: 5113)
     
    Att.
    Giovani Rodrigo
  13. Gostei
    GiovaniRodrigo deu reputação a Vodkart em (Resolvido)Task System   
    <?xml version="1.0" encoding="UTF-8"?> <mod name="Simple Task" version="1.0" enabled="yes"> <config name="task_func"> <![CDATA[ monstertable = { ["troll"] = {monster = {"troll", "frost troll", "furious troll", "island troll", "swamp troll", "troll champion", "troll legionnaire"}, startStorage = 200201, storage = 91001, count = 20, experience = 150, money = 300, reward = {{2160, 2}, {2389, 10}}}, ["goblin"] = {monster = {"goblin", "goblin assassin", "goblin leader"}, startStorage = 200202, storage = 91002, count = 30, experience = 200, money = 150, reward = {{1294, 20}}} } function isSummon(cid) return getCreatureMaster(cid); end function checkTask(cid) for k, v in pairs(monstertable) do if getPlayerStorageValue(cid, v.startStorage) >= 1 then return true end end return false end function getItemsFromList(items) local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end function GiveRewardsTask(cid, items) local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end end function HavePlayerPosition(cid, from, to) return isInRange(getPlayerPosition(cid), from, to) and true or false end ]]> </config> <event type="login" name="TaskLogin" event="script"> <![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "KillTask") return true end ]]> </event> <event type="kill" name="KillTask" event="script"> <![CDATA[ domodlib('task_func') function onKill(cid, target, lastHit) if isMonster(target) and not isSummon(target) then local n = string.lower(getCreatureName(target)) for task, mob in pairs(monstertable) do if getPlayerStorageValue(cid, mob.startStorage) >= 1 then for i = 1, #mob.monster do if n == mob.monster[i] and getPlayerStorageValue(cid, mob.startStorage) >= 1 then local contagem = getPlayerStorageValue(cid, mob.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then return true end if contagem > mob.count then return true end setPlayerStorageValue(cid, mob.storage, contagem+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..(contagem == mob.count and "Congratulations! You finished the task of "..task.."." or "defeated. Total ["..contagem.."/"..mob.count.."] "..task..".").."") end end end end end return true end ]]> </event> </mod>  
     
    ------------------
     
    domodlib('task_func') 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 msg = string.lower(msg) if isInArray({"task", "tasks"}, msg) then selfSay("Tell me what the monster's name wants to do the task?", cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if monstertable[msg] then if checkTask(cid) ~= true then local contagem = getPlayerStorageValue(cid, monstertable[msg].storage) if(contagem == -1) then contagem = 1 end if not tonumber(contagem) then selfSay("Sorry, but you're done with the "..msg..".", cid) talkState[talkUser] = 0 return true end setPlayerStorageValue(cid, monstertable[msg].startStorage, 1) selfSay("Congratulations, you are now participating in the "..msg.." task, "..monstertable[msg].count.." "..msg.." left for you to kill.", cid) talkState[talkUser] = 0 else selfSay("Sorry, but you are already part of a task.", cid) talkState[talkUser] = 0 end else selfSay("Enter the correct task name.", cid) talkState[talkUser] = 0 end elseif msgcontains(msg, "reward") then if checkTask(cid) then for k, v in pairs(monstertable) do if getPlayerStorageValue(cid, v.startStorage) >= 1 then local contagem = getPlayerStorageValue(cid, v.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then selfSay("You can only receive items only once.", cid) return true end if (((contagem) -1) >= v.count) then local str = "" if v.experience ~= nil then doPlayerAddExp(cid, v.experience) str = str.."".. (str == "" and "" or ",").. " "..v.experience.." of experience" end if v.money ~= nil then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ",").." "..v.money.." golds" end if v.reward ~= nil then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end selfSay("Thanks for your help, you received "..(str == "" and "none" or ""..str.."").." for completing the task of the "..k..".", cid) setPlayerStorageValue(cid, v.storage, "Finished") setPlayerStorageValue(cid, v.startStorage, 0) setPlayerStorageValue(cid, 521456, getPlayerStorageValue(cid, 521456) == -1 and 1 or getPlayerStorageValue(cid, 521456) + 1) else selfSay("Sorry, but you only killed "..((contagem)-1).." of "..v.count.." "..k..".", cid) end end end else selfSay("You are not participating in any task.", cid) end elseif msgcontains(msg, "leave") then if checkTask(cid) then talkState[talkUser] = 2 for k, v in pairs(monstertable) do if getPlayerStorageValue(cid, v.startStorage) >= 1 then storagesair = v.startStorage local contagem = getPlayerStorageValue(cid, v.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then selfSay("You are not participating in any task.", cid) else selfSay("You are participating in a "..k.." and already has "..((contagem)-1).." dead "..k..", do you really want to leave?", cid) end end end else selfSay("You are not on any task.", cid) end elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then setPlayerStorageValue(cid, storagesair, 0) selfSay("You were successfully removed from the task!", cid) elseif msgcontains(msg, "no") then selfSay("Okay then.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
  14. Gostei
    GiovaniRodrigo deu reputação a Vodkart em (Resolvido)FimPremium.lua faltando algo   
    function onLogin(cid)     local house = getHouseByPlayerGUID(getPlayerGUID(cid))     local pos = {x=32369, y=32241, z=7} -- pos onde será teleportado     if isPremium(cid) and getPlayerStorageValue(cid, 548474) <= 0 then         setPlayerStorageValue(cid, 548474, 1)     elseif not isPremium(cid) and getPlayerStorageValue(cid, 548474) > 0 then         doPlayerSendTextMessage(cid, 22, "seu premium acabou")         doCreatureChangeOutfit(cid,{lookType = getPlayerSex(cid) == 0 and 136 or 128})         if house then         setHouseOwner(house,NO_OWNER_PHRASE,true)         end         doTeleportThing(cid, pos)         setPlayerStorageValue(cid, 548474, 0)     end     return true end  
  15. Gostei
    GiovaniRodrigo recebeu reputação de kaiquegabriel em (Resolvido)FimPremium.lua faltando algo   
    Não sei se está correto pois estou a anos sem fazer scripts, mas testa esse e me diz o que deu.
    function onLogin(cid) if isPremium(cid) and getPlayerStorageValue(cid, 2143190718) == -1 then setPlayerStorageValue(cid, 2143190718, 1) end local house = getHouseByPlayerGUID(getPlayerGUID(cid)) local pos = {x=32369, y=32241, z=7} -- pos onde será teleportado if not isPremium(cid) and getPlayerStorageValue(cid, 2143190718) == 1 then doPlayerSendTextMessage(cid, 22, "mensagem aqui.") doCreatureChangeOutfit(cid, 128) if getHouseByPlayerGUID(getPlayerGUID(cid)) ~= nil then setHouseOwner(house, 0) end doTeleportThing(cid, pos) end return true end  
  16. Gostei
    GiovaniRodrigo recebeu reputação de r0bert0lol em [Resolvido] [PEDIDO] NPC Troca Item por outro Item   
    Crie um arquivo chamado Jax.lua na pasta data/npc/scripts e cole 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   local items = {           item1 = {2346, 2349}, -- item1 item que será pedido e que será dado na primeira troca           item2 = {2033, 15515} -- item2 item que será pedido e que será dado na segunda troca } local counts = {           count1 = {1, 1}, -- count1 quantidade que será pedido e que será dado na primeira troca           count2 = {10, 1} -- count2 quantidade que será pedido e que será dado na segunda troca }   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, 'blue note') then                     if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then                               doPlayerRemoveItem(cid, items.item1[1], counts.count1[1])                               doPlayerAddItem(cid, items.item1[2], counts.count1[2])                               selfSay('You just swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid)                     end           elseif msgcontains(msg, 'bar of gold') then                     if getPlayerItemCount(cid, items.item2[1]) >= counts.count2[1] then                               doPlayerRemoveItem(cid, items.item2[1], counts.count2[1])                               doPlayerAddItem(cid, items.item2[2], counts.count2[2])                               selfSay('You just swap '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..' for '.. counts.count2[2] ..' '.. getItemNameById(items.item2[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..'.', cid)                     end           end           return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
    Crie um arquivo chamado Jax.xml na pasta data/npc e cole isso
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="Jax" script="Jax.lua" walkinterval="2000" floorchange="0">           <health now="150" max="150" />           <look type="134" head="57" body="59" legs="40" feet="76" corpse="2212" />           <parameters>                     <parameter key="message_greet" value="Hello |PLAYERNAME|. Do not want to make an exchange? I have {blue note} and {bar of gold}." />                     <parameter key="message_farewell" value="Bye bye!" />           </parameters> </npc>  
    Testado e está 100% funcional
     
    Att.
    Giovani Rodrigo
  17. Gostei
    GiovaniRodrigo recebeu reputação de lawkzz em [Resolvido] [PEDIDO] NPC Troca Item por outro Item   
    Crie um arquivo chamado Jax.lua na pasta data/npc/scripts e cole 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   local items = {           item1 = {2346, 2349}, -- item1 item que será pedido e que será dado na primeira troca           item2 = {2033, 15515} -- item2 item que será pedido e que será dado na segunda troca } local counts = {           count1 = {1, 1}, -- count1 quantidade que será pedido e que será dado na primeira troca           count2 = {10, 1} -- count2 quantidade que será pedido e que será dado na segunda troca }   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, 'blue note') then                     if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then                               doPlayerRemoveItem(cid, items.item1[1], counts.count1[1])                               doPlayerAddItem(cid, items.item1[2], counts.count1[2])                               selfSay('You just swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid)                     end           elseif msgcontains(msg, 'bar of gold') then                     if getPlayerItemCount(cid, items.item2[1]) >= counts.count2[1] then                               doPlayerRemoveItem(cid, items.item2[1], counts.count2[1])                               doPlayerAddItem(cid, items.item2[2], counts.count2[2])                               selfSay('You just swap '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..' for '.. counts.count2[2] ..' '.. getItemNameById(items.item2[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..'.', cid)                     end           end           return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
    Crie um arquivo chamado Jax.xml na pasta data/npc e cole isso
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="Jax" script="Jax.lua" walkinterval="2000" floorchange="0">           <health now="150" max="150" />           <look type="134" head="57" body="59" legs="40" feet="76" corpse="2212" />           <parameters>                     <parameter key="message_greet" value="Hello |PLAYERNAME|. Do not want to make an exchange? I have {blue note} and {bar of gold}." />                     <parameter key="message_farewell" value="Bye bye!" />           </parameters> </npc>  
    Testado e está 100% funcional
     
    Att.
    Giovani Rodrigo
  18. Gostei
    GiovaniRodrigo recebeu reputação de Sotten em [Pedido] Npc Que Teleporta Por Level   
    Crie um arquivo chamado James.lua na pasta data/npc/scripts e cole 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   local cfg = {           toPos = {x=359, y=1667, z=7}, -- Posição que o jogador sera teleportado           level = 170, -- Level necessário para ser teleportado           price = 50 -- Dinheiro a ser cobrado para ser teleportado }   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, 'rocket') then                     selfSay('You are sure you want to go? You can not return.', cid)                     talkState[talkUser] = 1           elseif talkState[talkUser] == 1 then                     if msgcontains(msg, 'yes') then                               if getPlayerLevel(cid) >= cfg.level then                                         if doPlayerRemoveMoney(cid, cfg.price) then                                                   doTeleportThing(cid, cfg.toPos)                                                   talkState[talkUser] = 0                                         else                                                   selfSay('You don\'t have enough money.', cid)                                         end                               else                                         selfSay('You need level having above '.. cfg.level ..'.', cid)                               end                     elseif msgcontains(msg, 'no') then                               selfSay('Skirt here!', cid)                     end           end end   npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Configurando



     
    Crie um arquivo chamado Kiru.xml na pasta data/npc e cole isso
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="James" script="data/npc/scripts/James.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1">           <health now="150" max="150"/>           <look type="128" head="114" body="12" legs="57" feet="114" addons="0" />           <parameters>                     <parameter key="message_greet" value="Hello, |PLAYERNAME|! Would like to travel to {rocket} quest?"/>                     <parameter key="message_walkaway" value="Hey Hey, where you go ?"/>                     <parameter key="message_farewell" value="Bye bye!"/>           </parameters> </npc>  
    Não testado.
    Dúvidas? Me avise.
     
    Att.
    Giovani Rodrigo
  19. Gostei
    GiovaniRodrigo recebeu reputação de peterson18 em [Pedido] Npc Que Teleporta Por Level   
    Crie um arquivo chamado James.lua na pasta data/npc/scripts e cole 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   local cfg = {           toPos = {x=359, y=1667, z=7}, -- Posição que o jogador sera teleportado           level = 170, -- Level necessário para ser teleportado           price = 50 -- Dinheiro a ser cobrado para ser teleportado }   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, 'rocket') then                     selfSay('You are sure you want to go? You can not return.', cid)                     talkState[talkUser] = 1           elseif talkState[talkUser] == 1 then                     if msgcontains(msg, 'yes') then                               if getPlayerLevel(cid) >= cfg.level then                                         if doPlayerRemoveMoney(cid, cfg.price) then                                                   doTeleportThing(cid, cfg.toPos)                                                   talkState[talkUser] = 0                                         else                                                   selfSay('You don\'t have enough money.', cid)                                         end                               else                                         selfSay('You need level having above '.. cfg.level ..'.', cid)                               end                     elseif msgcontains(msg, 'no') then                               selfSay('Skirt here!', cid)                     end           end end   npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Configurando



     
    Crie um arquivo chamado Kiru.xml na pasta data/npc e cole isso
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="James" script="data/npc/scripts/James.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1">           <health now="150" max="150"/>           <look type="128" head="114" body="12" legs="57" feet="114" addons="0" />           <parameters>                     <parameter key="message_greet" value="Hello, |PLAYERNAME|! Would like to travel to {rocket} quest?"/>                     <parameter key="message_walkaway" value="Hey Hey, where you go ?"/>                     <parameter key="message_farewell" value="Bye bye!"/>           </parameters> </npc>  
    Não testado.
    Dúvidas? Me avise.
     
    Att.
    Giovani Rodrigo
  20. Curtir
    GiovaniRodrigo recebeu reputação de mullino em [Resolvido] TILE POR STORAGE   
    Crie um arquivo chamado tilestorage.lua na pasta data/movements/scripts e cole isso

    function onStepIn(cid, item, position, fromPosition)           if getPlayerStorageValue(cid, 11138) <= 0 then                     doTeleportThing(cid, fromPosition, TRUE)                     doPlayerSendCancel(cid, "You don't have premission to pass.")           end           return TRUE end  
    Adicione a seguinte linha no arquivo movements.xml que se encontra na pasta data/movements

    <movevent type="StepIn" actionid="6587" event="script" value="tilestorage.lua"/>  
    No map editor coloque ActionID do tile 6587.
    Não testado.
    Dúvidas? Me avise.
     
    Att.
    Giovani Rodrigo
  21. Curtir
    GiovaniRodrigo recebeu reputação de Summ em [1] Gestão Banco de Dados - SQL   
    Olá KingTibianos, hoje trago a vocês alguns comandos de gestão de banco de dados no SQL.
     
    Cria um banco de dados. CREATE DATABASE baseDeDados;
     
    Apaga um bando de dados. DROP DATABASE baseDeDados;
     
    Mostra todos os bancos de dados existentes. SHOW DATABASES;
     
    Usa um determinado banco de dados. USE baseDeDados;
     
     
    Até a próxima pessoal.
  22. Curtir
    GiovaniRodrigo recebeu reputação de Silveira em [Resolvido] [PEDIDO] NPC Troca Item por outro Item   
    Crie um arquivo chamado Jax.lua na pasta data/npc/scripts e cole 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   local items = {           item1 = {2346, 2349}, -- item1 item que será pedido e que será dado na primeira troca           item2 = {2033, 15515} -- item2 item que será pedido e que será dado na segunda troca } local counts = {           count1 = {1, 1}, -- count1 quantidade que será pedido e que será dado na primeira troca           count2 = {10, 1} -- count2 quantidade que será pedido e que será dado na segunda troca }   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, 'blue note') then                     if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then                               doPlayerRemoveItem(cid, items.item1[1], counts.count1[1])                               doPlayerAddItem(cid, items.item1[2], counts.count1[2])                               selfSay('You just swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid)                     end           elseif msgcontains(msg, 'bar of gold') then                     if getPlayerItemCount(cid, items.item2[1]) >= counts.count2[1] then                               doPlayerRemoveItem(cid, items.item2[1], counts.count2[1])                               doPlayerAddItem(cid, items.item2[2], counts.count2[2])                               selfSay('You just swap '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..' for '.. counts.count2[2] ..' '.. getItemNameById(items.item2[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..'.', cid)                     end           end           return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
    Crie um arquivo chamado Jax.xml na pasta data/npc e cole isso
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="Jax" script="Jax.lua" walkinterval="2000" floorchange="0">           <health now="150" max="150" />           <look type="134" head="57" body="59" legs="40" feet="76" corpse="2212" />           <parameters>                     <parameter key="message_greet" value="Hello |PLAYERNAME|. Do not want to make an exchange? I have {blue note} and {bar of gold}." />                     <parameter key="message_farewell" value="Bye bye!" />           </parameters> </npc>  
    Testado e está 100% funcional
     
    Att.
    Giovani Rodrigo
  23. Gostei
    GiovaniRodrigo recebeu reputação de luanxy em [Pedido] Npc Que Teleporta Por Level   
    Crie um arquivo chamado James.lua na pasta data/npc/scripts e cole 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   local cfg = {           toPos = {x=359, y=1667, z=7}, -- Posição que o jogador sera teleportado           level = 170, -- Level necessário para ser teleportado           price = 50 -- Dinheiro a ser cobrado para ser teleportado }   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, 'rocket') then                     selfSay('You are sure you want to go? You can not return.', cid)                     talkState[talkUser] = 1           elseif talkState[talkUser] == 1 then                     if msgcontains(msg, 'yes') then                               if getPlayerLevel(cid) >= cfg.level then                                         if doPlayerRemoveMoney(cid, cfg.price) then                                                   doTeleportThing(cid, cfg.toPos)                                                   talkState[talkUser] = 0                                         else                                                   selfSay('You don\'t have enough money.', cid)                                         end                               else                                         selfSay('You need level having above '.. cfg.level ..'.', cid)                               end                     elseif msgcontains(msg, 'no') then                               selfSay('Skirt here!', cid)                     end           end end   npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Configurando



     
    Crie um arquivo chamado Kiru.xml na pasta data/npc e cole isso
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="James" script="data/npc/scripts/James.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1">           <health now="150" max="150"/>           <look type="128" head="114" body="12" legs="57" feet="114" addons="0" />           <parameters>                     <parameter key="message_greet" value="Hello, |PLAYERNAME|! Would like to travel to {rocket} quest?"/>                     <parameter key="message_walkaway" value="Hey Hey, where you go ?"/>                     <parameter key="message_farewell" value="Bye bye!"/>           </parameters> </npc>  
    Não testado.
    Dúvidas? Me avise.
     
    Att.
    Giovani Rodrigo
  24. Gostei
    GiovaniRodrigo recebeu reputação de nestlez em [Resolvido] [PEDIDO] NPC Troca Item por outro Item   
    Crie um arquivo chamado Jax.lua na pasta data/npc/scripts e cole 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   local items = {           item1 = {2346, 2349}, -- item1 item que será pedido e que será dado na primeira troca           item2 = {2033, 15515} -- item2 item que será pedido e que será dado na segunda troca } local counts = {           count1 = {1, 1}, -- count1 quantidade que será pedido e que será dado na primeira troca           count2 = {10, 1} -- count2 quantidade que será pedido e que será dado na segunda troca }   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, 'blue note') then                     if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then                               doPlayerRemoveItem(cid, items.item1[1], counts.count1[1])                               doPlayerAddItem(cid, items.item1[2], counts.count1[2])                               selfSay('You just swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid)                     end           elseif msgcontains(msg, 'bar of gold') then                     if getPlayerItemCount(cid, items.item2[1]) >= counts.count2[1] then                               doPlayerRemoveItem(cid, items.item2[1], counts.count2[1])                               doPlayerAddItem(cid, items.item2[2], counts.count2[2])                               selfSay('You just swap '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..' for '.. counts.count2[2] ..' '.. getItemNameById(items.item2[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..'.', cid)                     end           end           return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
    Crie um arquivo chamado Jax.xml na pasta data/npc e cole isso
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="Jax" script="Jax.lua" walkinterval="2000" floorchange="0">           <health now="150" max="150" />           <look type="134" head="57" body="59" legs="40" feet="76" corpse="2212" />           <parameters>                     <parameter key="message_greet" value="Hello |PLAYERNAME|. Do not want to make an exchange? I have {blue note} and {bar of gold}." />                     <parameter key="message_farewell" value="Bye bye!" />           </parameters> </npc>  
    Testado e está 100% funcional
     
    Att.
    Giovani Rodrigo
  25. Gostei
    GiovaniRodrigo recebeu reputação de Apache em [Resolvido] [PEDIDO] NPC Troca Item por outro Item   
    Crie um arquivo chamado Jax.lua na pasta data/npc/scripts e cole 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   local items = {           item1 = {2346, 2349}, -- item1 item que será pedido e que será dado na primeira troca           item2 = {2033, 15515} -- item2 item que será pedido e que será dado na segunda troca } local counts = {           count1 = {1, 1}, -- count1 quantidade que será pedido e que será dado na primeira troca           count2 = {10, 1} -- count2 quantidade que será pedido e que será dado na segunda troca }   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, 'blue note') then                     if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then                               doPlayerRemoveItem(cid, items.item1[1], counts.count1[1])                               doPlayerAddItem(cid, items.item1[2], counts.count1[2])                               selfSay('You just swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid)                     end           elseif msgcontains(msg, 'bar of gold') then                     if getPlayerItemCount(cid, items.item2[1]) >= counts.count2[1] then                               doPlayerRemoveItem(cid, items.item2[1], counts.count2[1])                               doPlayerAddItem(cid, items.item2[2], counts.count2[2])                               selfSay('You just swap '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..' for '.. counts.count2[2] ..' '.. getItemNameById(items.item2[2]) ..'.', cid)                     else                               selfSay('You need '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..'.', cid)                     end           end           return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
    Crie um arquivo chamado Jax.xml na pasta data/npc e cole isso
     
    <?xml version="1.0" encoding="UTF-8"?> <npc name="Jax" script="Jax.lua" walkinterval="2000" floorchange="0">           <health now="150" max="150" />           <look type="134" head="57" body="59" legs="40" feet="76" corpse="2212" />           <parameters>                     <parameter key="message_greet" value="Hello |PLAYERNAME|. Do not want to make an exchange? I have {blue note} and {bar of gold}." />                     <parameter key="message_farewell" value="Bye bye!" />           </parameters> </npc>  
    Testado e está 100% funcional
     
    Att.
    Giovani Rodrigo
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo