Ir para conteúdo

Vodkart

Héroi
  • Registro em

Tudo que Vodkart postou

  1. 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 pid = getPlayerGUID(player) setHouseOwner(6257, pid) 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() and getGlobalStorageValue(STORAGE_EVENT) <= 0 then doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7}) OpenEvent() CastleWalls() addEvent(getWinnerCastle, DUR * 60 * 1000) end return true end TAG <globalevent name="castle automatic" time="20:00" event="script" value="nome do seu script.lua"/>
  2. Dá sim, porém a casa seria aleatória? Já que o código vai pegar a que esta livre no banco de dados e dar para o jogador... function doAddHousePlayer(cid) local query, player = db.getResult("SELECT `id` FROM `houses` WHERE `owner` = 0;"), getPlayerGUID(cid) if (query:getID() ~= -1) then local houseid = query:getDataInt("id") setHouseOwner(houseid, player, true) end return true end function onLogin(cid) local stor = 785421 if getPlayerStorageValue(cid, stor) <= 0 then doAddHousePlayer(cid) setPlayerStorageValue(cid, stor, 1) local hid = getHouseByPlayerGUID(getPlayerGUID(cid)) local hname, htown = getHouseName(hid), getTownName(getHouseTown(hid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"você recebeu a "..hname.." House em "..htown.." parabens!") end return true end ---- Algumas funções de house que existem no servidor: function getHouseOwner(houseId) return getHouseInfo(houseId).owner end function getHouseName(houseId) return getHouseInfo(houseId).name end function getHouseEntry(houseId) return getHouseInfo(houseId).entry end function getHouseRent(houseId) return getHouseInfo(houseId).rent end function getHousePrice(houseId) return getHouseInfo(houseId).price end function getHouseTown(houseId) return getHouseInfo(houseId).town end function getHouseTilesCount(houseId) return getHouseInfo(houseId).tiles end
  3. Só tenho uma dúvida, se vários jogadores usarem essa mesma spell juntos? vai lotar a area de monstros ou de players... E como vai fazer para o monstro que foi enviado para lá voltar? pq ele não volta sozinho né?
  4. usa essa função function isWalkable(pos) -- by Nord / editado por Omega if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false elseif isCreature(getTopCreature(pos).uid) then return false elseif getTileInfo(pos).protection then return false elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then return false end return true end dps como vai ser aleatorio pode usar assim: local pos = {x = 10, y = 10, z = 7} -- pode ser uma pos aleatoria claro if isWalkable(pos) then -- teleportar end
  5. 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
  6. vc editou tudo errado... manda o arquivo original sem alterações...
  7. @DigoleraZica eu estava achando que todos da guild ganhassem o item, por isso estava procurando essa parte no código, mas pelo que vi, só estavam ganhando 30% a mais de exp... realCastle = { itemid = 10091, open_storage = 100005, guild_storage = 100006, dateStorages = {100007,100008,100009}, frompos = {x = 2189, y = 522, z = 6}, topos = {x = 2282, y = 614, z = 6}, storages = { -- só modifique os storages se necessário accessTime = 100010, running = 100013 } } 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 realCastle.open = function() setGlobalStorageValue(realCastle.open_storage,1) setGlobalStorageValue(realCastle.guild_storage,-1) setGlobalStorageValue(realCastle.storages.running, 1) end realCastle.close = function() setGlobalStorageValue(realCastle.open_storage,-1) local tomorrow = getTomorrowsDate() local tomorrowString = tomorrow[1].."/"..tomorrow[2].."/"..tomorrow[3] for i = 1, 3 do setGlobalStorageValue(realCastle.dateStorages[i], tomorrow[i]) end local players = getPlayersInArea(realCastle.frompos, realCastle.topos) if players then for _, pid in pairs(players) do doTeleportThing(pid,getTownTemplePosition(1)) end end if getGlobalStorageValue(realCastle.guild_storage) == -1 then doBroadcastMessage("[Real Castle] A batalhar terminou e nenhuma guild conseguiu dominar o castelo!") else local gname = getGuildNameByID(getGlobalStorageValue(realCastle.guild_storage)) doBroadcastMessage("[Real Castle] A batalha terminou e a guild vencedora foi "..gname.."! Todos os jogadores dessa guild agora tem 30% a + de experiencia!") local leader = getGuildLeaderName(gname) local parcel = doCreateItemEx(ITEM_PARCEL) doAddContainerItem(parcel, realCastle.itemid, 1) doPlayerSendMailByName(leader, parcel) -- manda item para depot do leader end local func = db.query or db.executeQuery func("DELETE FROM real_castle WHERE world_id = '"..getWorldId().."'") func("INSERT INTO real_castle (guild_name, guild_id, tomorrow, world_id) VALUES ('"..getGuildNameByID(getGlobalStorageValue(realCastle.guild_storage)).."', '"..getGlobalStorageValue(realCastle.guild_storage).."', '"..tomorrowString.."', '"..getWorldId().."')") setGlobalStorageValue(realCastle.storages.running, -1) doSaveServer() end realCastle.broadcast = function(message) local players = getPlayersInArea(realCastle.frompos, realCastle.topos) if players then for _, pid in pairs(players) do doPlayerSendTextMessage(pid,MESSAGE_STATUS_WARNING,message) end end end realCastle.domain = function(cid) local guild_id = getPlayerGuildId(cid) setGlobalStorageValue(realCastle.guild_storage,guild_id) doBroadcastMessage("[Real Castle] O jogador "..getPlayerName(cid).." da guild "..getPlayerGuildName(cid).." dominou o castelo! As outras guilds têm até às 22:00 para conseguir tirar o domínio deles, não desistam!") end realCastle.isDominating = function(cid) local guild_id = getPlayerGuildId(cid) return guild_id == getGlobalStorageValue(realCastle.guild_storage) end realCastle.isOpen = function() return getGlobalStorageValue(realCastle.open_storage) == 1 end --- Config by Dwarfer realCastle.isRunning = function() return getGlobalStorageValue(realCastle.storages.running) ~= -1 end ---------------------------------------- OBS: Coloquei para o item ir direto para o Depot, pq pode acontecer de o leader da guild cair ou não estar presente... ai ele recebe tanto online como offline.
  8. seu ot é 8.6 não é? tfs 0.4?
  9. @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>
  10. <?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, 13540) - os.time() > 0 and getPlayerStorageValue(cid, 853608) <= 0 then setPlayerStorageValue(cid, 853608, 1) elseif getPlayerStorageValue(cid, 853608) > 0 and getPlayerStorageValue(cid, 13540) - 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, 13540) - os.time() <= 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Auto Loot] You need vip account to use this command.") 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>
  11. posta o resto do sistema, principalmente o código onde os players recebem as rewards.
  12. db.query("UPDATE `players` SET `resets`= ".. (resets+1) ..",`experience`= 0 WHERE `players`.`id`= "..playerid)
  13. tenta adicionar na lib: function doRemovePlayersFromArea(from, to, pos) for _, pid in pairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), from, to) then doTeleportThing(pid, pos) end end end
  14. Vodkart postou uma resposta no tópico em Suporte Tibia OTServer
    Sim... igual no pokemon msm né... vai pegar por exemplo a chance da larva que é de 5% e + item que aumenta por exemplo, 25% e somar, ficando 30% ao total... é isso? mas é um item para TODOS os mobs ou é um item individual para cada mob?
  15. é um boss que nasce em um determinado script ou é feito pelo spawn no mapper editor?
  16. 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
  17. Vodkart postou uma resposta no tópico em Suporte Tibia OTServer
    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
  18. Vodkart postou uma resposta no tópico em Suporte Tibia OTServer
    me fala como o script funciona agora e como você quer que ele funcione futuramente. pq realmente está só para nascer 1x até o server fechar e abrir novamente...
  19. é 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)
  20. 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 = 60 -- 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, 1000, 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
  21. Vodkart postou uma resposta no tópico em Suporte Tibia OTServer
    @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
  22. -- Checasse qual o id da looktype do player. if getCreatureOutfit(cid).lookType == 136 then bloco end -- Checar se é male ou female if getPlayerSex(cid) == PLAYERSEX_FEMALE then -- female bloco end -- Checasse se ele tem addon ou não. if getCreatureOutfit(cid).lookAddons == 3 then -- full addon bloco end
  23. https://tibiaking.com/forums/topic/97733-resolvidocomo-abrir-quantas-tasks-quiser-script-do-vodkart/

Informação Importante

Confirmação de Termo