Ir para conteúdo

MaTTch

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Gostei
    MaTTch recebeu reputação de Teddy Ursa em [Vault System] Sistema de Cofre   
    Bom galera eu resolvi fazer o Vault System a pedido de um amigo meu e decidi compartilhar com vocês.
     
    Testado em 8.60 TFS 0.4
     
    EDIT -- O script foi arrumado, pois havia um bug que o player ganhava golds.
     
    Vamos lá.
     
    1° - Vá em data/actions/scripts e crie um arquivo chamado vault.lua, e dentro você coloca isso:
    local vaultStorage = 99991 -- storage em que ficara armazenado os golds ------------------//* Functions //------------------- local function getPlayerFreeSpace(cid) -- by MaTTch     local checkSlots, space = {3,5,6,10}, 0     local function getContainerFree(container)         local free = 0         if(not isContainer(container.uid)) then             return free         end         for i = 0, (getItemInfo(container.itemid).maxItems -1) do             local item = getContainerItem(container.uid, i)             if(item.itemid == 0) then                 free = free + 1             elseif(isContainer(item.uid)) then                 free = free + getContainerFree(item)             end         end         return free     end     for _, i in ipairs(checkSlots) do         local slotItem = getPlayerSlotItem(cid, i)         if(i ~= CONST_SLOT_BACKPACK and slotItem.itemid == 0) then             space = space + 1         elseif(isContainer(slotItem.uid)) then             space = space + getContainerFree(slotItem)         end     end     return space end local function withdrawMoneySecurity(cid, value, storage) -- by MaTTch     local storageMoney, countValue = getPlayerStorageValue(cid, storage), 0     local config = {         [1] = {ITEM_CRYSTAL_COIN, math.floor(value/getItemInfo(ITEM_CRYSTAL_COIN).worth)},         [2] = {ITEM_PLATINUM_COIN, math.floor((value/getItemInfo(ITEM_PLATINUM_COIN).worth)-(math.floor(value/getItemInfo(ITEM_CRYSTAL_COIN).worth)*100))},         [3] = {ITEM_GOLD_COIN, math.floor(value%100)}     }     for i = 1, #config do         local count = config[i][2]         if(count > 0) then             while(count > 0) do                 storageMoney = getPlayerStorageValue(cid, storage)                 local a, itemCap = count > 100 and 100 or count, getItemInfo(config[i][1]).weight                 if(getPlayerFreeCap(cid) >= (itemCap*a)) then                     if(getPlayerFreeSpace(cid) >= 1) then                         doPlayerAddItem(cid, config[i][1], a)                         setPlayerStorageValue(cid, storage, (storageMoney - (getItemInfo(config[i][1]).worth * a)))                         countValue = countValue + (getItemInfo(config[i][1]).worth * a)                         count = count - a                     else                         return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have enough space in container. You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.")                     end                 else                     return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have enough cap. You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.")                 end             end         end     end     return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.") end ------------------//* End Functions //------------------- function onUse(cid, item, fromPosition, itemEx, toPosition)     local cidMoney, vaultMoney = getPlayerMoney(cid), getPlayerStorageValue(cid, vaultStorage)     if(vaultMoney <= 0) then         if(cidMoney <= 0) then             return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have money.")         end         doPlayerRemoveMoney(cid, cidMoney)         setPlayerStorageValue(cid, vaultStorage, cidMoney)         doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have added "..cidMoney.." gold"..(cidMoney > 1 and "s" or "").." to vault. Now your money is kept in the vault chest, you can take it whenever you want.")     else         withdrawMoneySecurity(cid, vaultMoney, vaultStorage)     end     return true end 2° - Agora em data/actions/actions.xml adicione a tag:
    <action itemid="ID" event="script" value="vault.lua"/> Em ID você escolhe o id do item que quiser.
     
    3° - Agora em data/creaturescripts/scripts crie um arquivo com o nome vaultLook.lua, e dentro coloque isso:
    local config = { vaultId = ID, -- itemid do vault vaultStorage = 99991 -- storage em que ficara armazenado os golds } function onLook(cid, thing, position, lookDistance) local show = getPlayerStorageValue(cid, config.vaultStorage) if(thing.itemid == config.vaultId) then local str = "You see"..(getItemInfo(thing.itemid).article and " "..getItemInfo(thing.itemid).article.." " or " ")..getItemInfo(thing.itemid).name..".\nYou have "..(show < 0 and 0 or show).." gold"..(show > 1 and "s" or "").." in the vault." if(getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then str = str .. "\nItemID: ["..thing.itemid.."].\nPosition: [X: "..getThingPos(thing.uid).x.."] [Y: "..getThingPos(thing.uid).y.."] [Z: "..getThingPos(thing.uid).z.."]." end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str) return false end return true end 4° - Agora em data/creaturescripts/creaturescripts.xml adicione a tag:
    <event type="look" name="vaultLook" event="script" value="vaultLook.lua"/> 5° - Agora em data/creaturescripts/login.lua lá embaixo adicione junto dos outros:
    registerCreatureEvent(cid, "vaultLook") E agora o sistema já esta pronto para ser usado.
     
    - Aah mas como funciona?
    Você clica uma vez no cofre (vault) e deposita todo seu dinheiro nele, ao clicar de novo você pega-os de volta, e caso não tiver cap ou espaço na bag você pega somente o possível e o restante ficara la até você quiser pegar.
     
    --> Versão do Vault System em editText
     
    Créditos:
    MaTTch (eu)
  2. Gostei
    Você tem 2 opções:

    1 - colocar as saidas corretamente pelo map editor
     
    2 - dentro do script NomeDoSeuMapa-house.xml aperta ctrl + h, e substitua os entryx="0" entryy="0" entryz="0" pela posição inicial de quando o player morre (TEMPLO) ou de qualquer lugar que queira.
  3. Obrigado
    MaTTch recebeu reputação de Yamili em Verificar se existe XX item naquela position   
    É porque a função getTileItemById não esta sendo usada corretamente nessa parte:
    if t1 and t2 and t3 and t4 then  
    Você precisa verificar se existe algum item checando se id ou o unique id é diferente de 0.
    Tipo assim:
    if t1.uid ~= 0 then doRemoveItem(t1.uid, 1) end  
    Você precisa fazer isso pra cada posição que quiser remover o item, e se quiser adicionar o efeito basta colocar junto a função doSendMagicEffect:
    if t1.uid ~= 0 then doRemoveItem(t1.uid, 1) doSendMagicEffect(config.pos1, 0000) end  
     
  4. Obrigado
    MaTTch recebeu reputação de KR33 em (Resolvido)Ajuda com esse script efeito quando player logar [SCRIPT]   
    Pra mim parece que ele pediu as duas coisas
     
     
  5. Obrigado
    MaTTch recebeu reputação de Nysman em Acentuação   
    No Notepad++ vai na aba Formatar->Converter para ANSI.
  6. Curtir
    MaTTch recebeu reputação de GOD Vitor em (Resolvido)Level e Vocação na Tela de Login   
  7. Obrigado
    MaTTch recebeu reputação de Sentsuizan em [Vault System] Sistema de Cofre   
    Bom galera eu resolvi fazer o Vault System a pedido de um amigo meu e decidi compartilhar com vocês.
     
    Testado em 8.60 TFS 0.4
     
    EDIT -- O script foi arrumado, pois havia um bug que o player ganhava golds.
     
    Vamos lá.
     
    1° - Vá em data/actions/scripts e crie um arquivo chamado vault.lua, e dentro você coloca isso:
    local vaultStorage = 99991 -- storage em que ficara armazenado os golds ------------------//* Functions //------------------- local function getPlayerFreeSpace(cid) -- by MaTTch     local checkSlots, space = {3,5,6,10}, 0     local function getContainerFree(container)         local free = 0         if(not isContainer(container.uid)) then             return free         end         for i = 0, (getItemInfo(container.itemid).maxItems -1) do             local item = getContainerItem(container.uid, i)             if(item.itemid == 0) then                 free = free + 1             elseif(isContainer(item.uid)) then                 free = free + getContainerFree(item)             end         end         return free     end     for _, i in ipairs(checkSlots) do         local slotItem = getPlayerSlotItem(cid, i)         if(i ~= CONST_SLOT_BACKPACK and slotItem.itemid == 0) then             space = space + 1         elseif(isContainer(slotItem.uid)) then             space = space + getContainerFree(slotItem)         end     end     return space end local function withdrawMoneySecurity(cid, value, storage) -- by MaTTch     local storageMoney, countValue = getPlayerStorageValue(cid, storage), 0     local config = {         [1] = {ITEM_CRYSTAL_COIN, math.floor(value/getItemInfo(ITEM_CRYSTAL_COIN).worth)},         [2] = {ITEM_PLATINUM_COIN, math.floor((value/getItemInfo(ITEM_PLATINUM_COIN).worth)-(math.floor(value/getItemInfo(ITEM_CRYSTAL_COIN).worth)*100))},         [3] = {ITEM_GOLD_COIN, math.floor(value%100)}     }     for i = 1, #config do         local count = config[i][2]         if(count > 0) then             while(count > 0) do                 storageMoney = getPlayerStorageValue(cid, storage)                 local a, itemCap = count > 100 and 100 or count, getItemInfo(config[i][1]).weight                 if(getPlayerFreeCap(cid) >= (itemCap*a)) then                     if(getPlayerFreeSpace(cid) >= 1) then                         doPlayerAddItem(cid, config[i][1], a)                         setPlayerStorageValue(cid, storage, (storageMoney - (getItemInfo(config[i][1]).worth * a)))                         countValue = countValue + (getItemInfo(config[i][1]).worth * a)                         count = count - a                     else                         return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have enough space in container. You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.")                     end                 else                     return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have enough cap. You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.")                 end             end         end     end     return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.") end ------------------//* End Functions //------------------- function onUse(cid, item, fromPosition, itemEx, toPosition)     local cidMoney, vaultMoney = getPlayerMoney(cid), getPlayerStorageValue(cid, vaultStorage)     if(vaultMoney <= 0) then         if(cidMoney <= 0) then             return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have money.")         end         doPlayerRemoveMoney(cid, cidMoney)         setPlayerStorageValue(cid, vaultStorage, cidMoney)         doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have added "..cidMoney.." gold"..(cidMoney > 1 and "s" or "").." to vault. Now your money is kept in the vault chest, you can take it whenever you want.")     else         withdrawMoneySecurity(cid, vaultMoney, vaultStorage)     end     return true end 2° - Agora em data/actions/actions.xml adicione a tag:
    <action itemid="ID" event="script" value="vault.lua"/> Em ID você escolhe o id do item que quiser.
     
    3° - Agora em data/creaturescripts/scripts crie um arquivo com o nome vaultLook.lua, e dentro coloque isso:
    local config = { vaultId = ID, -- itemid do vault vaultStorage = 99991 -- storage em que ficara armazenado os golds } function onLook(cid, thing, position, lookDistance) local show = getPlayerStorageValue(cid, config.vaultStorage) if(thing.itemid == config.vaultId) then local str = "You see"..(getItemInfo(thing.itemid).article and " "..getItemInfo(thing.itemid).article.." " or " ")..getItemInfo(thing.itemid).name..".\nYou have "..(show < 0 and 0 or show).." gold"..(show > 1 and "s" or "").." in the vault." if(getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then str = str .. "\nItemID: ["..thing.itemid.."].\nPosition: [X: "..getThingPos(thing.uid).x.."] [Y: "..getThingPos(thing.uid).y.."] [Z: "..getThingPos(thing.uid).z.."]." end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str) return false end return true end 4° - Agora em data/creaturescripts/creaturescripts.xml adicione a tag:
    <event type="look" name="vaultLook" event="script" value="vaultLook.lua"/> 5° - Agora em data/creaturescripts/login.lua lá embaixo adicione junto dos outros:
    registerCreatureEvent(cid, "vaultLook") E agora o sistema já esta pronto para ser usado.
     
    - Aah mas como funciona?
    Você clica uma vez no cofre (vault) e deposita todo seu dinheiro nele, ao clicar de novo você pega-os de volta, e caso não tiver cap ou espaço na bag você pega somente o possível e o restante ficara la até você quiser pegar.
     
    --> Versão do Vault System em editText
     
    Créditos:
    MaTTch (eu)
  8. Curtir
    MaTTch deu reputação a Yan Liima em [8.60] TFS 0.4 Rev3996 War & Cast   
    Salve salve pessoal, no inicio desse ano estava dando uma estudada e mexendo com a TFS 0.4 rev3884, e vi que havia alguns bugs e que não tinha Cast incluso. Com base nisso decidi atualizar e otimizar a source, já que ainda ela é uma das mais utilizadas no mundo de Otserv.  Decidi compartilhar esse meu trabalho com vocês! Acredito que possa ser uma das melhores REV atualmente.
     
    Conto com o seu feedback, caso haja algum bug, algo que tenha que mudar/optimizar, não exite em avisar aqui no tópico. Toda ajuda será bem vinda xD
     
    The Forgotten Server, Tibia Versão: 8.60
    O que contém nela?
     
    Dentro da pasta contém o config.lua com todas as tag já adicionadas.
     
    Não esquecam de executar a Query do Cast na sua DB:
     
    Downloads uint8(Effects até 255)
    Distro: TheForgottenServer.exe
    Src + datapack: Source & Data
    Recentes atualizações: GitHub
    Downloads uint8 sem o CAST incluso
    Distro: TheForgottenServer.exe
    Src + datapack: Source & Data
    -------------------------------------------------------
    Downloads uint16(Effects até 65534)
    Distro: TheForgottenServer.exe
    Src + datapack: Source & Data
    É necessário fazer a modificação do Hexadecimal no cliente. Aqui tem um já pronto: Cliente.exe(com mc) ou Cliente.exe(sem mc) (só será necessario se utilizar a src com o uint 16.)
    Lembrado também que precisa utilizar a lib 000-constant.lua deste datapack.
    -------------------------------------------------------
    Scans:
    Distro(uint8) & Distro(uint16)
    Source
    Cliente
     
    Obs: Os virus detectado é um falso positivo, então não se preocupem!
     
    A distro foi testada em Windows e em Linux Ubuntu 12.04, 14.04, em
    ambos funcionaram muito bem!
    É compatível com 16 também e o 18.04 é necessário fazer uma alteração que é possível encontrar no post desse tópico. 
     
    É possível compilar em Dev Cpp e Visual-Studio. 
     
    E para quem se interessa em saber onde se localiza os code do Cast, aqui está uma imagem. Você pode achar procurando por "//CAST"
     
    Façam um ótimo aproveito ?
  9. Obrigado
    MaTTch recebeu reputação de Zyros em (Resolvido)Spell Parede   
    local time = 5 -- tempo que vai durar as paredes function onCastSpell(cid, var) local cpos = getThingPos(cid) local dir = { [0] = {1026, from = {x=cpos.x-1, y=cpos.y-1, z=cpos.z}, to = {x=cpos.x+1, y=cpos.y-1, z=cpos.z}}, -- North (cima) [1] = {1025, from = {x=cpos.x+1, y=cpos.y-1, z=cpos.z}, to = {x=cpos.x+1, y=cpos.y+1, z=cpos.z}}, -- East (direita) [2] = {1026, from = {x=cpos.x-1, y=cpos.y+1, z=cpos.z}, to = {x=cpos.x+1, y=cpos.y+1, z=cpos.z}}, -- South (baixo) [3] = {1025, from = {x=cpos.x-1, y=cpos.y-1, z=cpos.z}, to = {x=cpos.x-1, y=cpos.y+1, z=cpos.z}}, -- West (esquerda) } local getDir = dir[getCreatureLookDirection(cid)] for x = getDir.from.x, getDir.to.x do for y = getDir.from.y, getDir.to.y do local pos = {x=x,y=y,z=cpos.z} if not getTileInfo(pos).house and not getTilePzInfo(pos) then doCreateItem(getDir[1], 1, pos) addEvent(function() if getTileItemById(pos, getDir[1]).uid > 0 then doRemoveItem(getTileItemById(pos, getDir[1]).uid) end end,time*1000) end end end return true end  Ali nos números 1026 e 1025 é o ID das paredes.
  10. Curtir
    MaTTch recebeu reputação de WooX em Aumentar Limite de gold do NPC   
    Em clientes mais antigo o limite numérico do trade é de 2147483647 (int32), está diretamente codificado no cliente, ao menos que você saiba um pouco de engenharia reversa, não pode ser mudado. Em um OTCliente isso pode ser facilmente mudado, mas não creio que é o seu caso.
  11. Curtir
    MaTTch recebeu reputação de ZeeroBR em [Vault System] Sistema de Cofre   
    Bom galera eu resolvi fazer o Vault System a pedido de um amigo meu e decidi compartilhar com vocês.
     
    Testado em 8.60 TFS 0.4
     
    EDIT -- O script foi arrumado, pois havia um bug que o player ganhava golds.
     
    Vamos lá.
     
    1° - Vá em data/actions/scripts e crie um arquivo chamado vault.lua, e dentro você coloca isso:
    local vaultStorage = 99991 -- storage em que ficara armazenado os golds ------------------//* Functions //------------------- local function getPlayerFreeSpace(cid) -- by MaTTch     local checkSlots, space = {3,5,6,10}, 0     local function getContainerFree(container)         local free = 0         if(not isContainer(container.uid)) then             return free         end         for i = 0, (getItemInfo(container.itemid).maxItems -1) do             local item = getContainerItem(container.uid, i)             if(item.itemid == 0) then                 free = free + 1             elseif(isContainer(item.uid)) then                 free = free + getContainerFree(item)             end         end         return free     end     for _, i in ipairs(checkSlots) do         local slotItem = getPlayerSlotItem(cid, i)         if(i ~= CONST_SLOT_BACKPACK and slotItem.itemid == 0) then             space = space + 1         elseif(isContainer(slotItem.uid)) then             space = space + getContainerFree(slotItem)         end     end     return space end local function withdrawMoneySecurity(cid, value, storage) -- by MaTTch     local storageMoney, countValue = getPlayerStorageValue(cid, storage), 0     local config = {         [1] = {ITEM_CRYSTAL_COIN, math.floor(value/getItemInfo(ITEM_CRYSTAL_COIN).worth)},         [2] = {ITEM_PLATINUM_COIN, math.floor((value/getItemInfo(ITEM_PLATINUM_COIN).worth)-(math.floor(value/getItemInfo(ITEM_CRYSTAL_COIN).worth)*100))},         [3] = {ITEM_GOLD_COIN, math.floor(value%100)}     }     for i = 1, #config do         local count = config[i][2]         if(count > 0) then             while(count > 0) do                 storageMoney = getPlayerStorageValue(cid, storage)                 local a, itemCap = count > 100 and 100 or count, getItemInfo(config[i][1]).weight                 if(getPlayerFreeCap(cid) >= (itemCap*a)) then                     if(getPlayerFreeSpace(cid) >= 1) then                         doPlayerAddItem(cid, config[i][1], a)                         setPlayerStorageValue(cid, storage, (storageMoney - (getItemInfo(config[i][1]).worth * a)))                         countValue = countValue + (getItemInfo(config[i][1]).worth * a)                         count = count - a                     else                         return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have enough space in container. You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.")                     end                 else                     return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have enough cap. You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.")                 end             end         end     end     return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.") end ------------------//* End Functions //------------------- function onUse(cid, item, fromPosition, itemEx, toPosition)     local cidMoney, vaultMoney = getPlayerMoney(cid), getPlayerStorageValue(cid, vaultStorage)     if(vaultMoney <= 0) then         if(cidMoney <= 0) then             return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have money.")         end         doPlayerRemoveMoney(cid, cidMoney)         setPlayerStorageValue(cid, vaultStorage, cidMoney)         doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have added "..cidMoney.." gold"..(cidMoney > 1 and "s" or "").." to vault. Now your money is kept in the vault chest, you can take it whenever you want.")     else         withdrawMoneySecurity(cid, vaultMoney, vaultStorage)     end     return true end 2° - Agora em data/actions/actions.xml adicione a tag:
    <action itemid="ID" event="script" value="vault.lua"/> Em ID você escolhe o id do item que quiser.
     
    3° - Agora em data/creaturescripts/scripts crie um arquivo com o nome vaultLook.lua, e dentro coloque isso:
    local config = { vaultId = ID, -- itemid do vault vaultStorage = 99991 -- storage em que ficara armazenado os golds } function onLook(cid, thing, position, lookDistance) local show = getPlayerStorageValue(cid, config.vaultStorage) if(thing.itemid == config.vaultId) then local str = "You see"..(getItemInfo(thing.itemid).article and " "..getItemInfo(thing.itemid).article.." " or " ")..getItemInfo(thing.itemid).name..".\nYou have "..(show < 0 and 0 or show).." gold"..(show > 1 and "s" or "").." in the vault." if(getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then str = str .. "\nItemID: ["..thing.itemid.."].\nPosition: [X: "..getThingPos(thing.uid).x.."] [Y: "..getThingPos(thing.uid).y.."] [Z: "..getThingPos(thing.uid).z.."]." end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str) return false end return true end 4° - Agora em data/creaturescripts/creaturescripts.xml adicione a tag:
    <event type="look" name="vaultLook" event="script" value="vaultLook.lua"/> 5° - Agora em data/creaturescripts/login.lua lá embaixo adicione junto dos outros:
    registerCreatureEvent(cid, "vaultLook") E agora o sistema já esta pronto para ser usado.
     
    - Aah mas como funciona?
    Você clica uma vez no cofre (vault) e deposita todo seu dinheiro nele, ao clicar de novo você pega-os de volta, e caso não tiver cap ou espaço na bag você pega somente o possível e o restante ficara la até você quiser pegar.
     
    --> Versão do Vault System em editText
     
    Créditos:
    MaTTch (eu)
  12. Obrigado
    MaTTch recebeu reputação de OWeen em [Vault System] Sistema de Cofre   
    Bom galera eu resolvi fazer o Vault System a pedido de um amigo meu e decidi compartilhar com vocês.
     
    Testado em 8.60 TFS 0.4
     
    EDIT -- O script foi arrumado, pois havia um bug que o player ganhava golds.
     
    Vamos lá.
     
    1° - Vá em data/actions/scripts e crie um arquivo chamado vault.lua, e dentro você coloca isso:
    local vaultStorage = 99991 -- storage em que ficara armazenado os golds ------------------//* Functions //------------------- local function getPlayerFreeSpace(cid) -- by MaTTch     local checkSlots, space = {3,5,6,10}, 0     local function getContainerFree(container)         local free = 0         if(not isContainer(container.uid)) then             return free         end         for i = 0, (getItemInfo(container.itemid).maxItems -1) do             local item = getContainerItem(container.uid, i)             if(item.itemid == 0) then                 free = free + 1             elseif(isContainer(item.uid)) then                 free = free + getContainerFree(item)             end         end         return free     end     for _, i in ipairs(checkSlots) do         local slotItem = getPlayerSlotItem(cid, i)         if(i ~= CONST_SLOT_BACKPACK and slotItem.itemid == 0) then             space = space + 1         elseif(isContainer(slotItem.uid)) then             space = space + getContainerFree(slotItem)         end     end     return space end local function withdrawMoneySecurity(cid, value, storage) -- by MaTTch     local storageMoney, countValue = getPlayerStorageValue(cid, storage), 0     local config = {         [1] = {ITEM_CRYSTAL_COIN, math.floor(value/getItemInfo(ITEM_CRYSTAL_COIN).worth)},         [2] = {ITEM_PLATINUM_COIN, math.floor((value/getItemInfo(ITEM_PLATINUM_COIN).worth)-(math.floor(value/getItemInfo(ITEM_CRYSTAL_COIN).worth)*100))},         [3] = {ITEM_GOLD_COIN, math.floor(value%100)}     }     for i = 1, #config do         local count = config[i][2]         if(count > 0) then             while(count > 0) do                 storageMoney = getPlayerStorageValue(cid, storage)                 local a, itemCap = count > 100 and 100 or count, getItemInfo(config[i][1]).weight                 if(getPlayerFreeCap(cid) >= (itemCap*a)) then                     if(getPlayerFreeSpace(cid) >= 1) then                         doPlayerAddItem(cid, config[i][1], a)                         setPlayerStorageValue(cid, storage, (storageMoney - (getItemInfo(config[i][1]).worth * a)))                         countValue = countValue + (getItemInfo(config[i][1]).worth * a)                         count = count - a                     else                         return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have enough space in container. You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.")                     end                 else                     return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have enough cap. You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.")                 end             end         end     end     return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have took "..countValue.." gold"..(countValue > 1 and "s" or "").." from vault.") end ------------------//* End Functions //------------------- function onUse(cid, item, fromPosition, itemEx, toPosition)     local cidMoney, vaultMoney = getPlayerMoney(cid), getPlayerStorageValue(cid, vaultStorage)     if(vaultMoney <= 0) then         if(cidMoney <= 0) then             return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You do not have money.")         end         doPlayerRemoveMoney(cid, cidMoney)         setPlayerStorageValue(cid, vaultStorage, cidMoney)         doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have added "..cidMoney.." gold"..(cidMoney > 1 and "s" or "").." to vault. Now your money is kept in the vault chest, you can take it whenever you want.")     else         withdrawMoneySecurity(cid, vaultMoney, vaultStorage)     end     return true end 2° - Agora em data/actions/actions.xml adicione a tag:
    <action itemid="ID" event="script" value="vault.lua"/> Em ID você escolhe o id do item que quiser.
     
    3° - Agora em data/creaturescripts/scripts crie um arquivo com o nome vaultLook.lua, e dentro coloque isso:
    local config = { vaultId = ID, -- itemid do vault vaultStorage = 99991 -- storage em que ficara armazenado os golds } function onLook(cid, thing, position, lookDistance) local show = getPlayerStorageValue(cid, config.vaultStorage) if(thing.itemid == config.vaultId) then local str = "You see"..(getItemInfo(thing.itemid).article and " "..getItemInfo(thing.itemid).article.." " or " ")..getItemInfo(thing.itemid).name..".\nYou have "..(show < 0 and 0 or show).." gold"..(show > 1 and "s" or "").." in the vault." if(getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then str = str .. "\nItemID: ["..thing.itemid.."].\nPosition: [X: "..getThingPos(thing.uid).x.."] [Y: "..getThingPos(thing.uid).y.."] [Z: "..getThingPos(thing.uid).z.."]." end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str) return false end return true end 4° - Agora em data/creaturescripts/creaturescripts.xml adicione a tag:
    <event type="look" name="vaultLook" event="script" value="vaultLook.lua"/> 5° - Agora em data/creaturescripts/login.lua lá embaixo adicione junto dos outros:
    registerCreatureEvent(cid, "vaultLook") E agora o sistema já esta pronto para ser usado.
     
    - Aah mas como funciona?
    Você clica uma vez no cofre (vault) e deposita todo seu dinheiro nele, ao clicar de novo você pega-os de volta, e caso não tiver cap ou espaço na bag você pega somente o possível e o restante ficara la até você quiser pegar.
     
    --> Versão do Vault System em editText
     
    Créditos:
    MaTTch (eu)
  13. Curtir
    MaTTch recebeu reputação de Black Fenix em (Resolvido)Critical E Dodge no LOOK   
  14. Gostei
    MaTTch recebeu reputação de King Laker em Players tomando Muted. Como Resolver?   
    almente o maxMessageBuffer no config.lua
  15. Curtir
    MaTTch recebeu reputação de Rafaelk36 em Spell funciona mesmo com storage pedido   
    if(getPlayerStorageValue(cid, 1436472) == 1) then doSetCreatureOutfit(cid, {lookType = 666}, -1) else doPlayerSendCancel(cid, "You cannot use this spell.") return false end  
  16. Gostei
    MaTTch recebeu reputação de KotZletY em [Function] getCombatAreaPos(centerpos, area)   
    Olá. A algum tempo atrás eu havia feito essa função, mas decidi compartilhar com vocês.
     
    Você pode instala-la definitivamente na sua libs ou pode apenas usar em algum script ocasional:
    function getCombatAreaPos(centerpos, area) -- by MaTTch if(type(area) ~= "table") then error("area is not a table") return false elseif(not centerpos) then return false end local t, center, ret = {}, {}, {} for n in ipairs(area) do for i = 2, 3 do if(table.find(area[n], i)) then center = {n, table.find(area[n], i)} break end end end if(#center == 0) then error("area do not have a number center") return false end for line in ipairs(area) do for _, value in ipairs(area[line]) do t[line] = t[line] and t[line] or {} if(value == 1 or value == 3) then table.insert(t[line], 1) else table.insert(t[line], 0) end end end for y in pairs(t) do for l, x in pairs(t[y]) do local ry, rx = y - center[1], l - center[2] if(#area == 1) then ry = 0 end if(x == 1) then table.insert(ret, {x=centerpos.x+(rx),y=centerpos.y+(ry),z=centerpos.z}) end end end return ret end - Como funciona?
    A função retorna uma tabela com as posições da area de combat.
     
    Exemplo:
    function onSay(cid, words, param)     local area = { -- Area         {1,0,0,0,0,0,1},         {0,1,0,0,0,1,0},         {0,0,1,0,1,0,0},         {0,0,0,2,0,0,0}, -- 2 ou 3 é o numero do centro         {0,0,1,0,1,0,0},         {0,1,0,0,0,1,0},         {1,0,0,0,0,0,1}     }          for _, pos in pairs(getCombatAreaPos(getThingPos(cid), area)) do -- loop com todas as tabelas         doSendMagicEffect(pos, 10) -- efeito em todas as posicoes da tabela     end     return true end Espero que tenham entendido...
     
    Créditos:
    MaTTch (eu)
  17. Curtir
    MaTTch recebeu reputação de Heezy em [Erro] Error #1125 (Object Builder)   
    Qual sua versão do O.B?
  18. Curtir
    MaTTch recebeu reputação de KotZletY em Wono 5.2.1 Download   
    @Brunds 
    Okay
     
    Mas ainda assim pra quem quiser ele aberto com dlls e tudo mais ta aqui:
    https://www.sendspace.com/file/tjpnkm
  19. Curtir
    MaTTch recebeu reputação de KotZletY em Wono 5.2.1 Download   
    Esse spr ai é o falso (de 100mb), o original é um pouco mais pesado.
  20. Gostei
    MaTTch recebeu reputação de WooX em [TFS 0.4] Life Steal em monstros!   
    Isso aqui só funciona em OTX:
    if (getPlayerSlotItem(attacker, slot).id == id) then  
    Tenta:
    if(getPlayerSlotItem(attacker, slot).itemid == id) then  
  21. Gostei
    MaTTch recebeu reputação de felippepsa em (Resolvido)Color Name   
    Isso ai você só vai conseguir pagando alguém pra criar uma dll.
  22. Gostei
    MaTTch recebeu reputação de xWhiteWolf em (Resolvido)Modificação de script   
    O erro basicamente era que ele checava se podia "castar" a magia, o que retorna falso se a criatura, por exemplo, não estivesse dentro do alcance da magia, ou se não houvesse um alvo, o que fazia dar erro de magia não existente.
     
    Enfim, editado.
  23. Gostei
    MaTTch recebeu reputação de xWhiteWolf em (Resolvido)Modificação de script   
    Em luascript.cpp, você adiciona no final do arquivo:
     
    no mesmo arquivo, procure por:
    luaL_register(m_luaState, "std", LuaInterface::luaStdTable); e abaixo dele adicione:
     
    Agora em luascript.h, procure por:
    static int32_t luaStdSHA512(lua_State* L); e abaixo adicione:
     
     
    Agora só compilar.
  24. Gostei
    MaTTch recebeu reputação de xWhiteWolf em (Resolvido)Modificação de script   
  25. Gostei
    MaTTch recebeu reputação de Zwarttyp em (Resolvido)Modificação de script   

Informação Importante

Confirmação de Termo