Ir para conteúdo

Vodkart

Héroi
  • Registro em

Solutions

  1. Vodkart's post in (Resolvido)Por que não remove a assassin star do inventario was marked as the answer   
    local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_REDSTAR) function onGetFormulaValues(cid, level, skill) return -(((skill + 25) / 3) + (level / 5)), -((skill + 25) + (level / 5)), 0 end setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") function onCastSpell(cid, var) local item = 7368 if not doPlayerRemoveItem(cid, item, 1) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) return false end doCombat(cid, combat, var) return true end  
  2. Vodkart's post in (Resolvido)Npc Teleporta só com X Storages was marked as the answer   
    na própria lib do npc já existe um campo para tal... basta usar o index "storage", por exemplo são paulo
     
    exemplo
     
    local travelNode = keywordHandler:addKeyword({'sao paulo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Sao Paulo for 1000 gold coins?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 1000, storage = 32148324, destination = {x=32072, y=32182, z=5}}) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})  
    -----------------------
    Caso o seu não tenha, vai na lib do npc e me manda a função
     
    function StdModule.travel(cid, message, keywords, parameters, node)  
    Mas geralmente já vem junto esse parâmetro 
  3. Vodkart's post in (Resolvido)Modificar script (Healing) was marked as the answer   
    testa assim:
     
    local config = { removeOnUse = "no", usableOnTarget = "yes", -- can be used on target? (fe. healing friend) splashable = "no", realAnimation = "no", -- make text effect visible only for players in range 1x1 healthMultiplier = 1.0, manaMultiplier = 1.0 } config.removeOnUse = getBooleanFromString(config.removeOnUse) config.usableOnTarget = getBooleanFromString(config.usableOnTarget) config.splashable = getBooleanFromString(config.splashable) config.realAnimation = getBooleanFromString(config.realAnimation) local POTIONS = { [8704] = {empty = 7636, splash = 2, health = {2,5}}, -- small health potion [7618] = {empty = 7636, splash = 2, health = {2,5}}, -- health potion [7588] = {empty = 7634, splash = 2, health = {8,13}, level = 1, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion [7591] = {empty = 7635, splash = 2, health = {9,15}, level = 1, vocations = {4, 8}, vocStr = "knights"}, -- great health potion [8473] = {empty = 7635, splash = 2, health = {15,20}, level = 1, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion [7620] = {empty = 7636, splash = 7, mana = {20,25}}, -- mana potion [7589] = {empty = 7634, splash = 7, mana = {25,30}, level = 1, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion [7590] = {empty = 7635, splash = 7, mana = {30,35}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion [8472] = {empty = 7635, splash = 3, health = {40,50}, mana = {45, 50}, level = 1, vocations = {3, 7}, vocStr = "paladins"}, -- great spirit potion } local exhaust = createConditionObject(CONDITION_EXHAUST) setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100)) function onUse(cid, item, fromPosition, itemEx, toPosition) local potion = POTIONS[item.itemid] if(not potion) then return false end if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then if(not config.splashable) then return false end if(toPosition.x == CONTAINER_POSITION) then toPosition = getThingPos(item.uid) end doDecayItem(doCreateItem(2016, potion.splash, toPosition)) doTransformItem(item.uid, potion.empty) return true end if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) return true end if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1) return true end if potion.health ~= nil then local health = math.random(potion.health[1], potion.health[2]) doSendAnimatedText(getThingPos(itemEx.uid), "+"..health.."%", TEXTCOLOR_GREEN) if not doCreatureAddHealth(itemEx.uid, math.ceil(getCreatureMaxHealth(cid) * (health / 100))) then return false end end if potion.mana ~= nil then local mana = math.random(potion.mana[1], potion.mana[2]) doSendAnimatedText(getThingPos(itemEx.uid), "+"..mana.."%", TEXTCOLOR_BLUE) if not doCreatureAddMana(itemEx.uid, math.ceil(getCreatureMaxMana(cid) * (mana / 100))) then return false end end if(not realAnimation) then doCreatureSay(itemEx.uid, "", TALKTYPE_ORANGE_1) else for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do if(isPlayer(tid)) then doCreatureSay(itemEx.uid, "", TALKTYPE_ORANGE_1, false, tid) end end end doAddCondition(cid, exhaust) if(not potion.empty or config.removeOnUse) then doRemoveItem(item.uid, 1) return true end doRemoveItem(item.uid, 0) doPlayerAddItem(cid, potion.empty, 0) doPlayerRemoveItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty)) doPlayerAddItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty)) return true end  
  4. Vodkart's post in (Resolvido)Sala de boss por alavanca was marked as the answer   
    achei que seu codigo ja fazia isso.
     
     
    local config = { cooldown = 60 * 60 * 20, -- in seconds - (Make it 'seconds * minutes * hours' - its will be '60 * 60 * 20' for 20 hours) (player cooldown) cooldown_storage = 808856, storage_control = 78484, duration = 10, -- time till reset, in minutes (lever cooldown) level_req = 8, -- minimum level to do quest min_players = 1, -- minimum players to join quest lever_id = 1945, -- id of lever before pulled pulled_id = 1946 -- id of lever after pulled } local player_positions = { [1] = {fromPos = Position(33395, 32662, 6), toPos = Position(33395, 32658, 6)}, [2] = {fromPos = Position(33395, 32663, 6), toPos = Position(33395, 32658, 6)}, [3] = {fromPos = Position(33395, 32663, 6), toPos = Position(33395, 32658, 6)}, [4] = {fromPos = Position(33395, 32665, 6), toPos = Position(33395, 32658, 6)}, [5] = {fromPos = Position(33394, 32662, 6), toPos = Position(33395, 32658, 6)} } local monsters = { [1] = {pos = Position(33396, 32642, 6), name = "scarlett etzel"} } local quest_range = {fromPos = Position(33386, 32639, 6), toPos = Position(33405, 32659, 6)} -- see image in thread for explanation local exit_position = Position(33395, 32671, 6) -- Position completely outside the quest area function getPlayersInBossRoom() local spectators, t = Game.getSpectators(Position(33396, 32649, 6), false, false, 10, 10, 10, 10),{} for _, spectatorCreature in ipairs(spectators) do if spectatorCreature:isPlayer() then t[#t+1] = spectatorCreature end end return t end function doKickPlayerBoss(id) local players = getPlayersInBossRoom() if #players == 0 then return true end if Game.getStorageValue(config.storage_control) == id then for _, cid in pairs(players) do local participant = Player(cid) participant:teleportTo(exit_position) exit_position:sendMagicEffect(CONST_ME_TELEPORT) participant:sendTextMessage(22,"voce nao matou o boss a tempo.") end Game.setStorageValue(config.storage_control, 0) end end function doResetTheBossDukeKrule(position, cid_array) local tile = Tile(position) local item = tile and tile:getItemById(config.pulled_id) if not item then return end local monster_names = {} for key, value in pairs(monsters) do if not isInArray(monster_names, value.name) then monster_names[#monster_names + 1] = value.name end end for i = 1, #monsters do local creatures = Tile(monsters[i].pos):getCreatures() for key, creature in pairs(creatures) do if isInArray(monster_names, creature:getName()) then creature:remove() end end end for i = 1, #player_positions do local creatures = Tile(player_positions[i].toPos):getCreatures() for key, creature in pairs(creatures) do if isInArray(monster_names, creature:getName()) then creature:remove() end end end for key, cid in pairs(cid_array) do local participant = Player(cid) if participant and isInRange(participant:getPosition(), quest_range.fromPos, quest_range.toPos) then participant:teleportTo(exit_position) exit_position:sendMagicEffect(CONST_ME_TELEPORT) end end item:transform(config.lever_id) end local function removeBoss() local specs, spec = Game.getSpectators(Position(33396, 32649, 6), false, false, 10, 10, 10, 10) for j = 1, #specs do spec = specs[j] if spec:getName():lower() == 'scarlett etzel' then spec:remove() end end end function onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getStorageValue(config.cooldown_storage) >= os.time() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "try tomorrow") return true end if #getPlayersInBossRoom() > 0 then return player:sendCancelMessage("ja exitem jogadores dentro do evento.") end local participants, pull_player = {}, false for i = 1, #player_positions do local fromPos = player_positions[i].fromPos local tile = Tile(fromPos) if not tile then print(">> ERROR: Annihilator tile does not exist for Position(" .. fromPos.x .. ", " .. fromPos.y .. ", " .. fromPos.z .. ").") return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.") end local creature = tile:getBottomCreature() if creature then local participant = creature:getPlayer() if not participant then return player:sendCancelMessage(participant:getName() .. " is not a valid participant.") end if participant:getLevel() < config.level_req then return player:sendCancelMessage(participant:getName() .. " is not the required level.") end if participant.uid == player.uid then pull_player = true end participants[#participants + 1] = {participant = participant, toPos = player_positions[i].toPos} end end if #participants < config.min_players then return player:sendCancelMessage("You do not have the required amount of participants.") end if not pull_player then return player:sendCancelMessage("You are in the wrong position.") end for i = 1, #monsters do local toPos = monsters[i].pos if not Tile(toPos) then print(">> ERROR: Annihilator tile does not exist for Position(" .. toPos.x .. ", " .. toPos.y .. ", " .. toPos.z .. ").") return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.") end removeBoss() Game.createMonster(monsters[i].name, monsters[i].pos, false, true) end local cid_array = {} for i = 1, #participants do participants[i].participant:teleportTo(participants[i].toPos) participants[i].toPos:sendMagicEffect(CONST_ME_TELEPORT) cid_array[#cid_array + 1] = participants[i].participant.uid player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 10 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.") end item:transform(config.pulled_id) player:setStorageValue(config.cooldown_storage, os.time() + config.cooldown) local r = math.random(1, 9999) Game.setStorageValue(config.storage_control, r) addEvent(doKickPlayerBoss, config.duration * 60 * 1000, r) addEvent(doResetTheBossDukeKrule, config.duration * 60 * 1000, toPosition, cid_array) return true end  
  5. Vodkart's post in (Resolvido)Reflect was marked as the answer   
    local config = { storage = 3411101, percent = 70 } math.percent = function (value, percentage) return math.ceil(math.floor(value)*math.floor(percentage)/100) end function onStatsChange(cid, attacker, type, combat, value) if value >= 1 and (type == STATSCHANGE_HEALTHLOSS or (getCreatureCondition(cid, CONDITION_MANASHIELD) and type == STATSCHANGE_MANALOSS)) then if getPlayerStorageValue(cid,config.storage) == 1 and isCreature(attacker) then local atk, me = math.percent(value, config.percent), math.percent(value, (100 - config.percent)) -- aqui por exemplo vai devolver 70% do atack para o que atacou e 30% para mim doSendAnimatedText(getCreaturePosition(cid),"REFLECT "..atk, 215) doSendAnimatedText(getCreaturePosition(attacker),"-"..atk, 215) doCreatureAddHealth(attacker, -atk, true) doCreatureAddHealth(cid, -me, true) setPlayerStorageValue(cid,config.storage, 0) return false end end return true end  
  6. Vodkart's post in (Resolvido)Erro no Spell Aura -=[TFS]=- 8.60 -=[TFS]=- was marked as the answer   
    Não está lendo é o seu spells.xml, deve estar com algum erro.
  7. Vodkart's post in (Resolvido)Erro no Spell Aura -=[TFS]=- 8.60 -=[TFS]=- was marked as the answer   
    Não está lendo é o seu spells.xml, deve estar com algum erro.
  8. Vodkart's post in Criando conta ou personagem e Ganhando uma casa! was marked as the answer   
    function onLogin(player) local stor = 785421 if player:getStorageValue(stor) <= 0 then local query, pid = db.storeQuery("SELECT `id` FROM `houses` WHERE `owner` = 0;"), player:getGuid() if query ~= false then local house = House(result.getDataInt(query, "id")) house:setOwnerGuid(pid) player:setStorageValue(stor, 1) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,"você recebeu a ".. house:getName() .." House parabens!") end end return true end  
  9. Vodkart's post in (Resolvido)Spell por % was marked as the answer   
    tenta assim:
     
    local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, 8000) setConditionParam(condition, CONDITION_PARAM_SKILL_FISTPERCENT, -70) setConditionParam(condition, CONDITION_PARAM_SKILL_AXEPERCENT, -70) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORDPERCENT, -70) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUBPERCENT, -70) setCombatCondition(combat, condition)  
    ou assim:
     
    local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, 8000) setConditionParam(condition, CONDITION_PARAM_SKILL_FISTPERCENT, 70) setConditionParam(condition, CONDITION_PARAM_SKILL_AXEPERCENT, 70) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORDPERCENT, 70) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUBPERCENT, 70) setCombatCondition(combat, condition)  
  10. Vodkart's post in evento com erro was marked as the answer   
    qual a position? coloquei para remover e criar mesmo
     
     
    local THRONE_POS = {x = 2561, y = 2446, z = 5} local STORAGE_EVENT = 83902 local STORAGE_PLAYER = 73289 local DUR = 2 -- in minutes local days = {"Friday", "Saturday", "Thursday"} -- coloque os dias function OpenEvent() for _, tid in ipairs(getPlayersOnline()) do setPlayerStorageValue(tid, STORAGE_PLAYER, 1) end setGlobalStorageValue(STORAGE_EVENT, 1) doBroadcastMessage("O Evento castle foi aberto e vai durar ".. DUR .." minutos.", 25) end function CastleWalls(n) -- 1 remove pedra e cria escada local pos = {x = 2539, y = 2474, z = 7} local remove = n == 1 and 1285 or 3687 local create = n == 1 and 3687 or 1285 local t = getTileItemById(pos, remove).uid return t > 0 and doRemoveItem(t) and doSendMagicEffect(pos, CONST_ME_POFF) and doCreateItem(create, 1, pos) end function getWinnerCastle() CastleWalls(0) local player = getTopCreature(THRONE_POS).uid if getGlobalStorageValue(STORAGE_EVENT) < 0 then return true end if (isPlayer(player)) then if (getPlayerStorageValue(player, STORAGE_PLAYER) > 0) then local id, pid = 561, getPlayerGUID(player) setHouseOwner(id, pid) db.executeQuery("UPDATE `houses` SET `owner` = "..pid.." WHERE `id` = "..id) doPlayerAddPremiumDays(player, 7) for _, cid in ipairs(getPlayersOnline()) do setPlayerStorageValue(cid, STORAGE_PLAYER, 0) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end doBroadcastMessage(getCreatureName(player) .. " ganhou o evento.", 25) doTeleportThing(player, {x = 2531, y = 2460, z = 7}) doCreateItem(391, 1, {x = 2561, y = 2446, z = 5}) end else doBroadcastMessage("Ningúem ganhou o evento.", 27) for _, pid in ipairs(getPlayersOnline()) do setPlayerStorageValue(pid, STORAGE_PLAYER, 0) doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid))) end end setGlobalStorageValue(STORAGE_EVENT, 0) return db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. STORAGE_PLAYER) end function isEventDay() for _, dia in pairs(days) do if dia == os.date("%A") then return true end end return false end function onTimer() if isEventDay() then OpenEvent() CastleWalls(1) addEvent(getWinnerCastle, DUR * 60 * 1000) end return true end  
     
    a pos da pedra e escada é essa né
     
    local pos = {x = 2539, y = 2474, z = 7}  
  11. Vodkart's post in Me ajudem a arrumar esse bug com esse NPC de task! was marked as the answer   
    <?xml version="1.0" encoding="UTF-8"?> <mod name="Simple Task" version="3.0" author="Vodkart" contact="xtibia.com" enabled="yes"> <config name="task_func"><![CDATA[ tasktabble = { ["diabolic"] = {monster_race={"diabolic"}, storage_start = 200201, storage = 91001,count = 2000,exp = 2350000,money = 3500000, reward = {{11717,20},{9970,200}}}, ["nukenin"] = {monster_race={"nukenin"}, storage_start = 200202, storage = 91002,count = 2000,exp = 2350000,money = 3500000, reward = {{11717,20},{9970,200}}}, ["task orochimaru"] = {monster_race={"task orochimaru"}, storage_start = 200239, storage = 91039,count = 20, exp = 2350000, money = 3500000, reward = {{11717,10},{9970,200}}} } configbosses_task = { {race = "minotaur",Playerpos = {x = 189, y = 57, z = 7}, FromPosToPos = {{x = 186, y = 54, z = 7},{x = 193, y = 60, z = 7}},time = 5}, {race = "necromancer",Playerpos = {x = 196, y = 39, z = 7}, FromPosToPos = {{x = 195, y = 37, z = 7},{x = 198, y = 41, z = 7}}, time = 5}, {race = "dragon",Playerpos = {x = 208, y = 59, z = 7}, FromPosToPos = {{x = 206, y = 56, z = 7},{x = 209, y = 65, z = 7}}, time = 5} } function isSummon(uid) return uid ~= getCreatureMaster(uid) or false end function CheckTask(cid) for k, v in pairs(tasktabble) do if getPlayerStorageValue(cid,v.storage_start) >= 1 then return true end end return false end function finisheAllTask(cid) local config = { exp = {false,350000}, money = {false,350000}, items ={false,{{11191,20},{11192,20}}}, premium ={true,5} } local x = true for k, v in pairs(tasktabble) do if tonumber(getPlayerStorageValue(cid,v.storage)) then x = false end end if x == true then setPlayerStorageValue(cid, 521456, 0) local b = getGlobalStorageValue(63005) if b == -1 then b = 1 end if b < 11 then setGlobalStorageValue(63005,b+1) doBroadcastMessage('[Task Mission Complete] '..getCreatureName(cid)..' was the '..b..' to finish the task!.') doPlayerAddPremiumDays(cid, config.premium[1] == true and config.premium[2] or 0) doPlayerAddExp(cid, config.exp[1] == true and config.exp[2] or 0) doPlayerAddMoney(cid, config.money[1] == true and config.money[2] or 0) if config.items[1] == true then doAddItemsFromList(cid,config.items[2]) end doItemSetAttribute(doPlayerAddItem(cid, 7369), "name", "trophy "..getCreatureName(cid).." completed all the task.") end end end function HavePlayerPosition(cid, from, to) return isInRange(getPlayerPosition(cid), from, to) and true or false end function getRankStorage(cid, value, max, RankName) -- by vodka local str ="" str = "--[".. (RankName == nil and "RANK STORAGE" or ""..RankName.."") .."]--\n\n" local query = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..value.." ORDER BY cast(value as INTEGER) DESC;") if (query:getID() ~= -1) then k = 1 repeat if k > max then break end str = str .. "\n " .. k .. ". "..getPlayerNameByGUID(query:getDataString("player_id")).." - [" .. query:getDataInt("value") .. "]" k = k + 1 until not query:next() end return doShowTextDialog(cid, 2529, str) end function getItemsInContainerById(container, itemid) -- Function By Kydrai local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function getItemsFromList(items) -- by vodka 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 doAddItemsFromList(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 pairsByKeys(t, f) local a = {} for n in pairs(t) do table.insert(a, n) end table.sort(a, f) local i = 0 local iter = function () i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end return iter end ]]></config> <event type="login" name="TaskLogin" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "KillTask") return true end]]></event> <talkaction words="/task;!task" event="buffer"><![CDATA[ domodlib('task_func') local param = string.lower(param) if param == "rank" then getRankStorage(cid, 521456, 20, "Task Rank Finalizadas") return true end local str = "" str = str .. "Task Completed :\n\n" for k, v in pairsByKeys(tasktabble) do local contagem = getPlayerStorageValue(cid, v.storage) if (contagem == -1) then contagem = 1 end str = str..k.." = ".. (not tonumber(contagem) and "["..contagem.."]" or "["..((contagem)-1).."/"..v.count.."]") .."\n" end str = str .. "" return doShowTextDialog(cid, 8983, str) ]]></talkaction> <event type="kill" name="KillTask" event="script"><![CDATA[ domodlib('task_func') function onKill(cid, target, lastHit) if isMonster(target) then local n = string.lower(getCreatureName(target)) for race, mob in pairs(tasktabble) do if getPlayerStorageValue(cid,mob .storage_start) >= 1 then for i = 1,#mob.monster_race do if n == mob.monster_race[i] then local contagem = getPlayerStorageValue(cid, mob.storage) if not tonumber(contagem) then return true end if (contagem == -1) then contagem = 1 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 "..race.."." or "defeated. Total [" .. contagem .. "/" .. mob.count .. "] " .. race .. ".").."") end end end end end return true end]]></event> </mod>  
  12. Vodkart's post in (Resolvido)Experiencia bonus por Stamina. was marked as the answer   
    rateStaminaAboveNormal = 1.2
  13. Vodkart's post in evento automatico was marked as the answer   
    sim e era para remover, estranho hein... testa em outra house pra ver se passa, troca o id lá naquela linha o 223 por outra house só para testar
    local THRONE_POS = {x = 2561, y = 2446, z = 5} local STORAGE_EVENT = 83902 local STORAGE_PLAYER = 73289 local DUR = 15 -- in minutes local days = {"Monday", "Saturday", "Thursday"} -- coloque os dias function OpenEvent() for _, tid in ipairs(getPlayersOnline()) do setPlayerStorageValue(tid, STORAGE_PLAYER, 1) end setGlobalStorageValue(STORAGE_EVENT, 1) doBroadcastMessage("O Evento castle foi aberto e vai durar ".. DUR .." minutos.", 25) end function getWinnerCastle() CastleWalls() local player = getTopCreature(THRONE_POS).uid if getGlobalStorageValue(STORAGE_EVENT) < 0 then return true end if (isPlayer(player)) then if (getPlayerStorageValue(player, STORAGE_PLAYER) > 0) then local id, pid = 223, getPlayerGUID(player) setHouseOwner(id, pid) db.executeQuery("UPDATE `houses` SET `owner` = "..pid.." WHERE `id` = "..id) doPlayerAddPremiumDays(player, 7) for _, cid in ipairs(getPlayersOnline()) do setPlayerStorageValue(cid, STORAGE_PLAYER, 0) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end doBroadcastMessage(getCreatureName(player) .. " ganhou o evento.", 25) doTeleportThing(player, {x = 2531, y = 2460, z = 7}) doCreateItem(391, 1, {x = 2561, y = 2446, z = 5}) end else doBroadcastMessage("Ningúem ganhou o evento.", 27) for _, pid in ipairs(getPlayersOnline()) do setPlayerStorageValue(pid, STORAGE_PLAYER, 0) doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid))) end end setGlobalStorageValue(STORAGE_EVENT, 0) return db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. STORAGE_PLAYER) end function isEventDay() for _, dia in pairs(days) do if dia == os.date("%A") then return true end end return false end function CastleWalls() local pedra = getTileItemById({ x = 2539, y = 2474, z = 7}, 1285) local escada = getTileItemById({ x = 2539, y = 2474, z = 7}, 3687) if pedra.uid > 0 then return doRemoveItem(pedra.uid) else return doCreateItem(1285, 1, { x = 2539, y = 2474, z = 7}) end if escada.uid > 0 then return doRemoveItem(escada.uid) else return doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7}) end end function onTimer() if isEventDay() then doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7}) OpenEvent() CastleWalls() addEvent(getWinnerCastle, DUR * 60 * 1000) end return true end  
  14. Vodkart's post in (Resolvido)Teleport que muda estando com target ou não. was marked as the answer   
    testa o dano
     
    local from, to = {x=980, y=980, z=15}, {x=1050, y=1050, z=15} -- area total do kamui local teleport = {x=1000, y=1000, z=15} -- para onde vai local blocks = {"demon", "hydra"} -- defina o nome dos monstro em minusculo local storage = 753159 function isInKamuiArea(cid) return isInRange(getCreaturePosition(cid), from, to) and true or false end function TeleportToKamui(alvo, pos) if not isCreature(alvo) then return LUA_ERROR end doTeleportThing(alvo, pos) doSendMagicEffect(getThingPos(alvo), 40) -- effect target ao entrar no kamui end function onCastSpell(cid, var) local target = getCreatureTarget(cid) if target > 0 and isCreature(target) then -- se tiver target if isMonster(target) then if isInArray(blocks, getCreatureName(target):lower()) then doPlayerSendCancel(cid, "voce nao pode usar a spell neste monstro") return true end doSendMagicEffect(getCreaturePosition(cid), 4) -- cid doSendMagicEffect(getThingPos(target), 10) -- effect target ao usar kamui local min = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) * 20) * 5 local max = (getPlayerLevel(cid) * 5 + getPlayerMagLevel(cid) * 50) * 8 doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -min, -max, CONST_ME_BLOCKHIT) -- defina combat e effect COMBAT_PHYSICALDAMAGE / CONST_ME_BLOCKHIT addEvent(TeleportToKamui, 300, target,teleport) elseif isPlayer(target) then if isInKamuiArea(target) then doPlayerSendCancel(cid, "voce nao pode usar a spell em um target dentro do kamui") return true end setPlayerStorageValue(target, storage, ":".. getCreaturePosition(target).x ..",:".. getCreaturePosition(target).y ..",:".. getCreaturePosition(target).z) doSendMagicEffect(getCreaturePosition(cid), 4) -- cid doSendMagicEffect(getThingPos(target), 10) -- effect target ao usar kamui local min = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) * 20) * 5 local max = (getPlayerLevel(cid) * 5 + getPlayerMagLevel(cid) * 50) * 8 doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -min, -max, CONST_ME_BLOCKHIT) -- defina combat e effect COMBAT_PHYSICALDAMAGE / CONST_ME_BLOCKHIT addEvent(TeleportToKamui, 300, target, teleport) end else if isInKamuiArea(cid) then doPlayerSendCancel(cid, "voce nao pode usar a spell dentro do kamui") return true end setPlayerStorageValue(cid, storage, ":".. getCreaturePosition(cid).x ..",:".. getCreaturePosition(cid).y ..",:".. getCreaturePosition(cid).z) doSendMagicEffect(getCreaturePosition(cid), 4) -- cid addEvent(TeleportToKamui, 300, cid, teleport) doCreatureAddHealth(cid, -100) end return true end  
  15. Vodkart's post in (Resolvido)Adcionar delay na spell de teleport. was marked as the answer   
    local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_HITCOLOR, COLOR_TEAL) setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, 32) function onGetFormulaValues(cid, level, maglevel) min = -((30) * (maglevel + level)) max = -((33) * (maglevel + level)) return min, max end setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") local function onCastSpell1(parameters) return isCreature(parameters.cid) and doCombat(parameters.cid, combat, parameters.var) end function onCastSpell(cid, var) local parameters = { cid = cid, var = var} local waittime = 1 -- Tempo de exhaustion local storage = 445000 if exhaustion.check(cid, storage) then doPlayerSendCancel(cid, "Podera usar novamente dentro de 1 segundos.") doSendMagicEffect(getCreaturePosition(cid), 32) return false end exhaustion.set(cid, storage, waittime) local positionp = getPlayerPosition(cid) local target = getCreatureTarget(cid) local enemypos = getCreaturePosition(target) addEvent(onCastSpell1, 550, parameters) if target == isMonster or isCreature then addEvent(function() if not isCreature(cid) then return LUA_ERROR end doTeleportThing(cid, enemypos) end, 500) addEvent(doSendMagicEffect, 500, {x = enemypos.x, y = enemypos.y+1, z = enemypos.z}, 311) addEvent(doSendMagicEffect, 10, {x = positionp.x, y = positionp.y+1, z = positionp.z}, 312) end return true end  
  16. Vodkart's post in [AJUDA] Adicionar Item ao Lider da Guild was marked as the answer   
    function getGuildLeaderName(GuildName) -- function by vodkart local leader = db.getResult("SELECT `players`.`name` FROM `players` WHERE `players`.`id` = (SELECT `guilds`.`ownerid` FROM `guilds` WHERE `guilds`.`name` = ".. db.escapeString(GuildName) .. ")") if(leader:getID() ~= -1) then return leader:getDataString("name") end return nil end if not RealCastle then RealCastle = { itemid = 10091, openStorage = 722374, guildStorage = 722375, dateStorages = {722376,722377,722378} } function RealCastle:isInside(cid) local thingPos = getThingPos(cid) local areas = { {{x = 1921, y = 484, z = 6}, {x = 2098, y = 607, z = 6}}, {{x = 2187, y = 396, z = 6}, {x = 2264, y = 511, z = 6}}, {{x = 2442, y = 416, z = 4}, {x = 2604, y = 521, z = 4}}, {{x = 2446, y = 391, z = 5}, {x = 2619, y = 543, z = 5}}, {{x = 2091, y = 449, z = 6}, {x = 2166, y = 508, z = 6}}, {{x = 1907, y = 606, z = 6}, {x = 2099, y = 735, z = 6}}, {{x = 2653, y = 442, z = 6}, {x = 2741, y = 559, z = 6}}, {{x = 2653, y = 442, z = 5}, {x = 2741, y = 559, z = 5}}, {{x = 2653, y = 442, z = 4}, {x = 2741, y = 559, z = 5}}, {{x = 2277, y = 613, z = 7}, {x = 2462, y = 716, z = 7}}, {{x = 2277, y = 613, z = 6}, {x = 2462, y = 716, z = 6}}, {{x = 2277, y = 613, z = 5}, {x = 2462, y = 716, z = 5}}, {{x = 2277, y = 613, z = 4}, {x = 2462, y = 716, z = 4}}, {{x = 2242, y = 723, z = 6}, {x = 2442, y = 894, z = 6}}, {{x = 2255, y = 804, z = 7}, {x = 2282, y = 832, z = 7}}, {{x = 2103, y = 638, z = 6}, {x = 2262, y = 740, z = 6}}, {{x = 2103, y = 638, z = 7}, {x = 2262, y = 740, z = 7}}, {{x = 1899, y = 590, z = 7}, {x = 2102, y = 730, z = 7}}, {{x = 2130, y = 781, z = 7}, {x = 2210, y = 923, z = 7}}, {{x = 2240, y = 835, z = 7}, {x = 2304, y = 916, z = 7}}, {{x = 1927, y = 739, z = 5}, {x = 2043, y = 927, z = 5}} } for _, area in next, areas do if isInRange(thingPos, area[1], area[2]) then return true end end if (thingPos.x >= 2288 and thingPos.x <= 2364 and thingPos.y >= 433 and thingPos.y <= 509) or (thingPos.x >= 2148 and thingPos.x <= 2189 and thingPos.y >= 641 and thingPos.y <= 679) or (thingPos.x >= 2229 and thingPos.x <= 622 and thingPos.y >= 2320 and thingPos.y <= 704) then return true end return false end function RealCastle:getAllPlayers() local players = {} for _, pid in next, getPlayersOnline() do if self:isInside(pid) then table.insert(players, pid) end end return players end function RealCastle:removePlayers(messageType, message) local players = self:getAllPlayers() for _, pid in next, players do doPlayerSetPzLocked(pid, false) doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid))) if type(messageType) == "string" and messageType == "popup" then doPlayerPopupFYI(pid, message) else doPlayerSendTextMessage(pid, messageType, message) end end end function RealCastle:open() setGlobalStorageValue(self.openStorage, 1) setGlobalStorageValue(self.guildStorage, EMPTY_STORAGE) self:removePlayers("popup", "[War Castle] O domínio de sua guild pelo castelo acabou e você foi trazido a seu Templo.") end function RealCastle:close() setGlobalStorageValue(self.openStorage, EMPTY_STORAGE) local tomorrow = getTomorrowsDate() local tomorrowString = tomorrow[1].."/"..tomorrow[2].."/"..tomorrow[3] for i = 1, 3 do setGlobalStorageValue(self.dateStorages[i], tomorrow[i]) end local guild_id = getGlobalStorageValue(self.guildStorage) local guild_name = "" if guild_id ~= EMPTY_STORAGE then guild_name = getGuildNameByID(guild_id) self:removePlayers(MESSAGE_STATUS_CONSOLE_ORANGE, "[War Castle] A batalha pelo domínio do castelo se encerrou com vitória da guild "..guild_name.." e você foi trazido a seu Templo.") doBroadcastMessage("[War Castle] A batalha terminou e a guild vencedora foi "..guild_name.."! Todos os jogadores dessa guild agora podem aproveitar o castelo até amanhã às 19:00!") local leader = getGuildLeaderName(guild_name) local parcel = doCreateItemEx(ITEM_PARCEL) doAddContainerItem(parcel, RealCastle.itemid, 1) doPlayerSendMailByName(leader, parcel) else guild_name = "Castelo LIVRE" self:removePlayers(MESSAGE_STATUS_CONSOLE_ORANGE, "[War Castle] A batalha pelo domínio do castelo se encerrou e "..guild_name.." ficou com o domínio. Você foi trazido a seu Templo.") doBroadcastMessage("[War Castle] A batalha terminou e nenhuma guild conseguiu dominar o castelo! Amanhã às 19:00 haverá uma nova batalha!") end db.query("DELETE FROM real_castle WHERE world_id = '"..getWorldId().."'") db.query("INSERT INTO real_castle (guild_name, guild_id, tomorrow, world_id) VALUES ('"..guild_name.."', '"..guild_id.."', '"..tomorrowString.."', '"..getWorldId().."')") doSaveServer() end function RealCastle:broadcast(message) for _, pid in next, self:getAllPlayers() do doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, message) end end function RealCastle:domain(cid) setGlobalStorageValue(self.guildStorage, getPlayerGuildId(cid)) self:broadcast("[War Castle] O jogador ["..getPlayerName(cid).."] da guild ["..getPlayerGuildName(cid).."] dominou o castelo! As outras guilds têm até às 20:00 para conseguir tirar o domínio deles, não desistam!") end function RealCastle:isDominating(cid) return getPlayerGuildId(cid) == getGlobalStorageValue(self.guildStorage) end function RealCastle:isOpen() return getGlobalStorageValue(self.openStorage) ~= EMPTY_STORAGE end function RealCastle:checkLogin(cid) if self:isInside(cid) then if not self:isDominating(cid) then doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doPlayerPopupFYI(cid, "[War Castle] Você foi removido do castelo pois ele não pertence mais a sua guild.") end end return true end function RealCastle:announce(message, times) if times == 0 then return true end doBroadcastMessage(message) addEvent(self.announce, 5*60000 , self, message, (times - 1)) end function RealCastle:checkOnTime() if self:isOpen() then self:close() else self:open() self:announce("[War Castle] O acesso à área de dominar do castelo está liberado até às 20:00. Boa sorte a todas as guilds!", 11) for i = 1, 4 do addEvent(doBroadcastMessage, 60000 * i, "[War Castle] O acesso à área de dominar do castelo está liberado até as 20:00. Boa sorte a todas as guilds!") end end return true end function RealCastle:checkOnUse(cid, item, frompos, item2, topos) if item.uid == 61466 then local guild_id = getGlobalStorageValue(self.guildStorage) local guild = guild_id > 1 and "a guild "..getGuildNameByID(guild_id).." possui o domínio" or "nenhuma guild possui o domínio do castelo" local time = getGlobalStorageValue(self.dateStorages[1]).."/"..getGlobalStorageValue(self.dateStorages[2]).."/"..getGlobalStorageValue(self.dateStorages[3]) local domain = self:isOpen() and "as guilds estão batalhando pelo domínio do castelo" or guild local msg = " ----------[War Castle]---------\n\n\nAtualmente "..domain..".\n\nPróxima batalha: "..time.." às 19:00." doShowTextDialog(cid,8977,msg) return true end if not self:isOpen() then doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid))) return true end if not self:isDominating(cid) then self:domain(cid) doSendMagicEffect(getThingPos(cid), CONST_ME_CRAPS) else doSendMagicEffect(fromPosition, CONST_ME_POFF) doPlayerSay(cid,"[War Castle] Sua guild já está com o domínio do castelo!", TALKTYPE_ORANGE_1) end return true end function RealCastle:checkStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if item.actionid == 61465 then if self:isOpen() then if getPlayerGuildId(cid) > 0 then if getPlayerLevel(cid) >= 200 then doSendMagicEffect(getThingPos(cid), 13) return true else doTeleportThing(cid, fromPosition) doSendMagicEffect(fromPosition, CONST_ME_POFF) doPlayerSay(cid,"[War Castle] Somente jogadores com level 200 ou mais podem batalhar pelo castelo!", TALKTYPE_ORANGE_1) end else doTeleportThing(cid, fromPosition) doSendMagicEffect(fromPosition, CONST_ME_POFF) doPlayerSay(cid,"[War Castle] Somente jogadores com guild podem batalhar pelo castelo!", TALKTYPE_ORANGE_1) end else doTeleportThing(cid, fromPosition) doSendMagicEffect(fromPosition, CONST_ME_POFF) doPlayerSay(cid,"[War Castle] O castelo não está aberto para invasões!", TALKTYPE_ORANGE_1) end elseif item.actionid == 61466 then if self:isDominating(cid) then doSendMagicEffect(getThingPos(cid), 14) doPlayerSay(cid,"Bem vindo ao War Castle!", TALKTYPE_ORANGE_1) return true end if self:isOpen() then doTeleportThing(cid, fromPosition) doSendMagicEffect(fromPosition, CONST_ME_POFF) doPlayerSay(cid,"[War Castle] Não é permitido entrar no castelo enquanto as guilds estão batalhando pelo seu domínio.", TALKTYPE_ORANGE_1) else local guild_id = getGlobalStorageValue(self.guildStorage) doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 2, z = toPosition.z}) doSendMagicEffect({x = toPosition.x, y = toPosition.y + 2, z = toPosition.z}, CONST_ME_FIREAREA) doPlayerSay(cid, guild_id ~= EMPTY_STORAGE and "[War Castle] Somente membros da guild ["..getGuildNameByID(guild_id).."] podem entrar." or "[War Castle] Somente membros da guild dominante podem entrar.", TALKTYPE_ORANGE_1) end end return true end end  
  17. Vodkart's post in Comando !autoloot/autoloot só pode usar o comando se for vip was marked as the answer   
    @Muvukavdd eu que troquei a storage, usa assim:
     
     
    <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Perfect Auto Loot" version="2.0" author="Vodkart" contact="none.com" enabled="yes"> <config name="Loot_func"><![CDATA[ info = { vip = true, directory = "data/logs/autoloot", Warn_Bp_Slots = 5, -- quando tiver 5 ou menos slots na BP vai avisar o jogador Talkaction_delay = 5, -- em segundos // delay para remover e adicionar item BlockMonsters = {}, BlockItemsList = {2123,2515}, Money_ids = {2148, 2152, 2160, 2159, 9971}, -- id das moedas do ot Max_Slots = {free = 3, premium = 5}, Storages = {988801, 988802, 988803, 988804, 988805, 988806, 988807, 13545} } Color_Loot = { [0] = {MESSAGE_EVENT_ORANGE, "Orange"}, [1] = {MESSAGE_STATUS_CONSOLE_BLUE, "Blue"}, [2] = {MESSAGE_INFO_DESCR, "Green"}, [3] = {MESSAGE_STATUS_CONSOLE_RED, "Red"}, [4] = {MESSAGE_STATUS_SMALL, "White"} } function getPlayerColorLootMessage(cid) return getPlayerStorageValue(cid, info.Storages[5]) <= 0 and 0 or getPlayerStorageValue(cid, info.Storages[5]) end function isInTable(cid, item) for _,i in pairs(getItensFromAutoloot(cid)) do if tonumber(i) == tonumber(item) then return true end end return false end function doremoveItemFromAutoloot(cid, itemid) local file, fileContent = io.open(info.directory.."/"..getCreatureName(cid)..".txt", 'r'),{} for line in file:lines() do if line ~= "" and tonumber(line) ~= tonumber(itemid) then fileContent[#fileContent + 1] = line end end io.close(file) file = io.open(info.directory.."/"..getCreatureName(cid)..".txt", 'w') for index, value in ipairs(fileContent) do file:write(value..'\n') end io.close(file) end function doAddItemFromAutoloot(cid, itemid) if not existsAutoloot(cid) then doCreateLootUserName(cid, itemid) return true end local file = io.open(info.directory.."/"..getCreatureName(cid)..".txt", "a+") file:write('\n'..itemid) file:close() end function existsAutoloot(cid) local f = io.open(info.directory.."/"..getCreatureName(cid)..".txt", "rb") if f then f:close() end return f ~= nil end function doCreateLootUserName(cid, itemid) newFile = io.open(info.directory.."/"..getCreatureName(cid)..".txt", "w+" ) newFile:write(itemid) newFile:close() end function getItensFromAutoloot(cid) if not existsAutoloot(cid) then return {} end lines = {} for line in io.lines(info.directory.."/"..getCreatureName(cid)..".txt") do if line ~= "" then lines[#lines + 1] = tonumber(line) end end return lines end function doCleanAutoloot(cid) return os.remove(info.directory.."/"..getCreatureName(cid)..".txt") end function ShowItemsTabble(cid) local auto_list = getItensFromAutoloot(cid) local n,str = 0,"[+] Auto Loot Commands [+]\n\n!autoloot item name --> To add ou Remove item from list.\n!autoloot money --> To collect gold automatically.\n!autoloot clear --> To clear the list.\n!autoloot on/off --> To enable or disable the collecting of items in the system.\n!autoloot message --> To enable or disable message from Collect items.\n!autoloot color --> To change Color message in Auto Loot Collect.\n!autoloot warn --> To enable or disable message warning of "..info.Warn_Bp_Slots.." or less slots in the backpack.\n!autoloot deposit --> To enable or disable automatic money deposit at the bank.\n\n[+] Auto Loot Info [+]\n\nSystem: "..(getPlayerStorageValue(cid, info.Storages[1]) <= 0 and "Activated" or "Disabled")..".\nGold Collecting: "..(getPlayerStorageValue(cid, info.Storages[2]) > 0 and "Activated" or "Disabled")..".\nMessage: "..(getPlayerStorageValue(cid, info.Storages[6]) <= 0 and "Activated" or "Disabled")..".\nColor Message: "..Color_Loot[getPlayerColorLootMessage(cid)][2]..".\nWarn Backpack: "..(getPlayerStorageValue(cid, info.Storages[3]) <= 0 and "Activated" or "Disabled")..".\nAutomatic Gold Deposit: "..(getPlayerStorageValue(cid, info.Storages[4]) > 0 and "Activated" or "Disabled")..".\nTotal Bank Balance: ["..getPlayerBalance(cid).."]\nMaximum Slots: ["..#auto_list.."/"..(isPremium(cid) and info.Max_Slots.premium or info.Max_Slots.free).."]\n\n[+] Auto Loot Slots [+]\n\n" if #auto_list > 0 then for i = 1, #auto_list do n = n + 1 str = str.."Slot "..n.." - "..getItemNameById(auto_list[i]).."\n" end end return doPlayerPopupFYI(cid, str) end function getContainerItems(container, array, haveCap) array = array or {} haveCap = haveCap or false if not isContainer(container.uid) or getContainerSize(container.uid) == 0 then array[#array +1] = container else local size = getContainerSize(container.uid) haveCap = (getContainerCap(container.uid) -size) > 0 for slot = 0, (size -1) do local item = getContainerItem(container.uid, slot) if item.itemid > 1 then getContainerItems(item, array, haveCap) end end end return #array >= 1 and array, haveCap end function getContainerItemsById(container, itemid) local founds = {} local items = not container.uid and container or getContainerItems(container) for index, item in pairs(items) do if item.itemid == itemid then founds[#founds +1] = item end end return #founds >= 1 and founds end function AutomaticDeposit(cid, item, n) if isInArray(info.Money_ids, item) and getPlayerStorageValue(cid, info.Storages[4]) > 0 then local deposit = item == tonumber(2160) and (n*10000) or tonumber(item) == 2152 and (n*100) or (n) doPlayerDepositMoney(cid, deposit) end return true end function getAllContainerFree(cid) -- by vodka local containers,soma = {},0 for i = CONST_SLOT_FIRST, CONST_SLOT_LAST do local sitem = getPlayerSlotItem(cid, i) if sitem.uid > 0 then if isContainer(sitem.uid) then table.insert(containers, sitem.uid) soma = soma + getContainerSlotsFree(sitem.uid) end end end while #containers > 0 do for k = (getContainerSize(containers[1]) - 1), 0, -1 do local tmp = getContainerItem(containers[1], k) if isContainer(tmp.uid) then table.insert(containers, tmp.uid) soma = soma + getContainerSlotsFree(tmp.uid) end end table.remove(containers, 1) end return soma end function getContainerSlotsFree(container) -- by vodka return getContainerCap(container)-getContainerSize(container) end function doPlayerAddItemStackable(cid, itemid, count) local container = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK) if container.itemid > 1 then local items = getContainerItemsById(container, itemid) if not items then return doPlayerAddItem(cid, itemid, count) else local piles = #items for index, item in pairs(items) do if item.type < 100 then local sum = item.type + count local result = doTransformItem(item.uid, itemid, sum) if sum <= 100 then return result else return doPlayerAddItem(cid, itemid, sum - 100) end else piles = piles - 1 if piles == 0 then return doPlayerAddItem(cid, itemid, count) end end end end end return false end function corpseRetireItems(cid, pos) local check, slots = false, 0 for i = 0, 255 do pos.stackpos = i if getThingFromPos(pos).uid > 0 and isContainer(getThingFromPos(pos).uid) then corpse = getThingFromPos(pos) check = true break end end if check == true then local str, id_list = "", getItensFromAutoloot(cid) for _, item in pairs(getContainerItems(corpse)) do local id = item.itemid if #id_list > 0 and isInArray(id_list, id) or getPlayerStorageValue(cid, info.Storages[2]) > 0 and isInArray(info.Money_ids, id) then local amount = isItemStackable(id) and item.type or 1 local total_cap = getItemWeightById(id, amount) slots = getAllContainerFree(cid) if slots > 0 and getPlayerFreeCap(cid) >= total_cap then str = str.." " .. getItemInfoLoot(id, amount) if isItemStackable(id) then doPlayerAddItemStackable(cid, id, amount) AutomaticDeposit(cid, id, amount) else doPlayerAddItem(cid, id) end doRemoveItem(item.uid) end end end if str ~= "" and getPlayerStorageValue(cid, info.Storages[6]) <= 0 then doPlayerSendTextMessage(cid, Color_Loot[getPlayerColorLootMessage(cid)][1],"[Auto Loot Collect]:"..string.sub(str, 1, -2)..".") end if getPlayerStorageValue(cid, info.Storages[3]) <= 0 and slots > 0 and slots <= info.Warn_Bp_Slots then doPlayerSendTextMessage(cid,18, "[Auto Loot Warn] You only have "..slots.." slots free in your backpack!") end end end function ExistItemByName(name) -- by vodka local items = io.open("data/items/items.xml", "r"):read("*all") local get = items:lower():match('name="' .. name:lower() ..'"') if get == nil or get == "" then return false end return true end function getItemInfoLoot(id, amount) local info = getItemInfo(id) return isItemStackable(id) and amount.." "..(amount > 1 and info.plural or info.name).."," or info.article.." " .. info.name .."," end ]]></config> <event type="login" name="LootLogin" event="script"><![CDATA[ domodlib('Loot_func') function onLogin(cid) registerCreatureEvent(cid, "LootEventKIll") if getPlayerStorageValue(cid, 13545) - os.time() > 0 and getPlayerStorageValue(cid, 853608) <= 0 then setPlayerStorageValue(cid, 853608, 1) elseif getPlayerStorageValue(cid, 853608) > 0 and getPlayerStorageValue(cid, 13545) - os.time() <= 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Auto Loot] You Vip is Over, Start a new list!") setPlayerStorageValue(cid, 853608, -1) doCleanAutoloot(cid) end return true end]]></event> <event type="kill" name="LootEventKIll" event="script"><![CDATA[ domodlib('Loot_func') function onKill(cid, target, lastHit) if isPlayer(cid) and getPlayerStorageValue(cid, info.Storages[1]) <= 0 and isMonster(target) and not isInArray(info.BlockMonsters, getCreatureName(target):lower()) then addEvent(corpseRetireItems, 0, cid ,getThingPos(target)) end return true end]]></event> <talkaction words="!autoloot;/autoloot" event="buffer"><![CDATA[ domodlib('Loot_func') local param, slots = param:lower(), isPremium(cid) and info.Max_Slots.premium or info.Max_Slots.free if info.vip and getPlayerStorageValue(cid, 13545) - os.time() <= 0 then doPlayerPopupFYI(cid, "Voce nao possui VIP Account") return true end if not param or param == "" then ShowItemsTabble(cid) return true elseif tonumber(param) then doPlayerSendCancel(cid, "enter commands: !autoloot item name [+] !autoloot clean [+] !autoloot money [+] !autoloot on/off") return true elseif isInArray({"clean","limpar", "clear"}, param) then if existsAutoloot(cid) then doCleanAutoloot(cid) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Auto Loot] Your list has been cleaned.") return true elseif isInArray({"start","stop","on","off"}, param) then setPlayerStorageValue(cid, info.Storages[1], getPlayerStorageValue(cid, info.Storages[1]) <= 0 and 1 or 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Auto Loot "..(getPlayerStorageValue(cid, info.Storages[1]) > 0 and "Stopped" or "Started")..".") return true elseif isInArray({"warn","aviso"}, param) then setPlayerStorageValue(cid, info.Storages[3], getPlayerStorageValue(cid, info.Storages[3]) <= 0 and 1 or 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Auto Loot Backpack Warn "..(getPlayerStorageValue(cid, info.Storages[3]) > 0 and "disabled" or "Activated")..".") return true elseif isInArray({"mensagem","message","mensagen","msg"}, param) then setPlayerStorageValue(cid, info.Storages[6], getPlayerStorageValue(cid, info.Storages[6]) <= 0 and 1 or 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Auto Loot Message "..(getPlayerStorageValue(cid, info.Storages[6]) > 0 and "disabled" or "Activated")..".") return true elseif isInArray({"cor","color","type"}, param) then setPlayerStorageValue(cid, info.Storages[5], getPlayerColorLootMessage(cid) == #Color_Loot and 0 or getPlayerColorLootMessage(cid)+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Auto Loot Message Color Changed to "..Color_Loot[getPlayerColorLootMessage(cid)][2]..".") return true elseif isInArray({"money","gold","gps","dinheiro"}, param) then setPlayerStorageValue(cid, info.Storages[2], getPlayerStorageValue(cid, info.Storages[2]) <= 0 and 1 or 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Auto Loot Gold Colleting "..(getPlayerStorageValue(cid, info.Storages[2]) > 0 and "Activated" or "disabled")..".") return true elseif isInArray({"deposito","bank","gbank","deposit","autodeposit"}, param) then setPlayerStorageValue(cid, info.Storages[4], getPlayerStorageValue(cid, info.Storages[4]) <= 0 and 1 or 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Auto Loot] Automatic Gold Bank "..(getPlayerStorageValue(cid, info.Storages[4]) > 0 and "Activated" or "disabled")..".") return true end local item = ExistItemByName(tostring(param)) if not item then doPlayerSendCancel(cid, "This item does not exist.") return true end local item = getItemIdByName(tostring(param)) local var = isInTable(cid, item) if isInArray(info.Money_ids, item) then doPlayerSendTextMessage(cid, MESSAGE_FIRST, "Enter !autoloot money to add money in your list!") return true elseif isInArray(info.BlockItemsList, item) then doPlayerSendCancel(cid, "You can not add this item in the list!") return true elseif not var and #getItensFromAutoloot(cid) >= slots then doPlayerSendCancel(cid, "max "..slots.." from auto loot") return true elseif getPlayerStorageValue(cid, info.Storages[7]) - os.time() > 0 then doPlayerSendCancel(cid, "wait a second to use this command again") return true end if not var then doAddItemFromAutoloot(cid, item) else doremoveItemFromAutoloot(cid, item) end setPlayerStorageValue(cid, info.Storages[7], os.time()+info.Talkaction_delay) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,not var and "you added the item "..param.." in the list" or "you removed the item "..param.." from the list, please wait 5 seconds to save the directory.") return true]]></talkaction> </mod>  
  18. Vodkart's post in v8.60 problema Com Npc Reset was marked as the answer   
    db.query("UPDATE `players` SET `resets`= ".. (resets+1) ..",`experience`= 0 WHERE `players`.`id`= "..playerid)  
  19. Vodkart's post in Ajuda por favor fala orange no default e green no broadcast 8.60 was marked as the answer   
    function onSay(cid, words, param, channel) if(param == "") then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Please type a message for broadcast.") and true end if not (exhaustion.check(cid, 1000)) then exhaustion.set(cid, 1000, 60) broadcastMessage("[/all] --> "..getPlayerName(cid) .." [".. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_STATUS_CONSOLE_ORANGE) broadcastMessage("[/all] --> "..getPlayerName(cid) .." [".. getPlayerLevel(cid) .. "]: " .. param, MESSAGE_INFO_DESCR) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Please wait "..exhaustion.get(cid, 1000).." second"..(exhaustion.get(cid, 1000) > 1 and "s" or "").." to broadcast again.") end return true end  
  20. Vodkart's post in Spawn.lua was marked as the answer   
    function onKill(cid, target) local monsters = { ["larva"] = {chance = 5, name = "bug", effect = 10}, ["bug"] = {chance = 10, name = "scarab", effect = 10}, ["scarab"] = {chance = 15, name = "ancient scarab", effect = 10} } if isPlayer(cid) and isMonster(target) then local var = monsters[getCreatureName(target):lower()] if var then if var.chance >= math.random(1, 100) then doSummonCreature(var.name, getThingPos(target)) doSendMagicEffect(getThingPos(target), var.effect) end end end return true end  
  21. Vodkart's post in (Resolvido)Tempo do effect no script was marked as the answer   
    é que eu acho que o tempo do efeito a seta é de 2 segundos se não me engano né? 
     
    usa assim para ver:
     
    local config = { itemid = {2434, 7730}, --IDs dos items, para aumentar só colocar repetir o padrao Ex: {2471, 7730, 2160}. --Edited by Zefz/Vabrindox drop_effect = 296, --Efeito que aparecerá em cima da corpse, OPCIONAL! Se não quiser, coloque false. time = 30 -- em segundos } function doEffectCorpse(position, corpse_id, seconds) local corpse = getTileItemById(position, corpse_id).uid if corpse <= 1 or not isContainer(corpse) then return true end doSendMagicEffect(position, config.drop_effect) if seconds ~= 1 then addEvent(doEffectCorpse, 2000, position, corpse_id, seconds-1) end end function examine(cid, position, corpse_id) if not isPlayer(cid) then return true end local corpse = getTileItemById(position, corpse_id).uid if corpse <= 1 or not isContainer(corpse) then return true end for slot = 0, getContainerSize(corpse) - 1 do local item = getContainerItem(corpse, slot) if item.uid <= 1 then return true end for i, listid in ipairs(config.itemid) do if item.itemid == listid then if config.drop_effect then doEffectCorpse(position, corpse_id, config.time) end end end end end function onKill(cid, target) if not isMonster(target) then return true end local corpse_id = getMonsterInfo(getCreatureName(target)).lookCorpse addEvent(examine, 2, cid, getThingPos(target), corpse_id) return true end  
     
    qualquer coisa mude essa linha:
     
    if seconds ~= 1 then addEvent(doEffectCorpse, 2000, position, corpse_id, seconds-1) end  
     
    onde está 2000 coloque por exemplo 2500(2,5 segundos) ou 3000(3 segundos)
  22. Vodkart's post in mcs nao ganham was marked as the answer   
    @Doidodepeda
     
    function onSay(cid, words, param, channel) local t = string.explode(param, ",") if t[1] ~= nil and t[2] ~= nil then local list,ips = {},{} for _, tid in pairs(getPlayersOnline()) do if #ips == 0 or not isInArray(ips, getPlayerIp(tid)) then list[#list+1] = tid ips[#ips+1] = getPlayerIp(tid) end end for i = 1, #list do doPlayerAddItem(list[i],t[1],t[2]) doBroadcastMessage(getPlayerName(cid) .. " Acabou de dar: " .. t[2] .." ".. getItemNameById(t[1]) .. " para todos os players online!") end else doPlayerPopupFYI(cid, "No parm...\nSend:\n /itemadd itemid,how_much_items\nexample:\n /itemadd 2160,10") end return true end  
  23. Vodkart's post in (Resolvido)Iniciar Task was marked as the answer   
    https://tibiaking.com/forums/topic/97733-resolvidocomo-abrir-quantas-tasks-quiser-script-do-vodkart/
  24. Vodkart's post in Acumular tempo - Actions was marked as the answer   
    @Doidodepeda
     
    function onUse(cid, item, frompos, item2, topos) local config = { timeForUse = 1, -- tempo em horas que o player poderá entrar na cave. storage = 789450, toKnow = 456789, effect = 27 -- efeito que dará ao usar o item. } local time = getPlayerStorageValue(cid, config.storage) - os.time() <= 0 and (os.time() + config.timeForUse * 60) or (getPlayerStorageValue(cid, config.storage) + config.timeForUse * 60) setPlayerStorageValue(cid, config.storage, time) doRemoveItem(item.uid,1) setPlayerStorageValue(cid, config.toKnow, 1) doSendMagicEffect(getThingPos(cid), config.effect) doPlayerSendTextMessage(cid, 19, "Voce Usou a Bonus Area") return true end  
  25. Vodkart's post in Check se o Attacker está vivo was marked as the answer   
    usa
    if isCreature(...) then bloco end  
    posta o reflect system pra mim ver...

Informação Importante

Confirmação de Termo