Ir para conteúdo

GustavaoTibia

Campones
  • Total de itens

    30
  • Registro em

  • Última visita

Tudo que GustavaoTibia postou

  1. GustavaoTibia

    Action

    também nada, sem erro no console sem mover alavanca
  2. GustavaoTibia

    Action

    Não da erro, mas não acontece nada, alavanca antes movia pra um lado e quando fosse da use de novo dava aquele erro com o jogador no sqm certo, se o jogador tiver no sqm fora alavanca vai e volta sem aparecer nenhum erro no console
  3. GustavaoTibia

    Action

    Galera to com um problema no action de um boss... Alguém poderia me ajudar corrigir? ou dizer mais ou menos porque acontece? Lua Script Error: [Action Interface] data/actions/scripts/forgotten knowledge/tenebris lever.lua:onUse data/actions/scripts/forgotten knowledge/tenebris lever.lua:15: attempt to compare number with nil stack traceback: [C]: in function '__le' data/actions/scripts/forgotten knowledge/tenebris lever.lua:15: in function <data/actions/scripts/forgotten knowledge/tenebris lever.lua:7
  4. Oi gente Gostaria de colocar pra funcionar esse script com apenas um item e que seja infinito. E se for possível também gostaria por "talkactions" local config = { [11260] = {blessId = 5, text = 'The Spiritual Shielding'}, [11259] = {blessId = 6, text = 'The Embrace of Tibia'}, [11261] = {blessId = 4, text = 'The Fire of the Suns'}, [11258] = {blessId = 3, text = 'The Spark of the Phoenix'}, [11262] = {blessId = 2, text = 'The Wisdom of Solitude'}, [28036] = {blessId = 7, text = 'Heart of the Mountain'}, [28037] = {blessId = 8, text = 'Blood of the Mountain'} } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local useItem = config[item.itemid] if not useItem then return true end if player:hasBlessing(useItem.blessId) then player:say('You already possess this blessing.', TALKTYPE_MONSTER_SAY) return true end player:addBlessing(useItem.blessId,1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, useItem.text .. ' protects you.') player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY) item:remove(1) return true end
  5. Oi gente Gostaria de colocar pra funcionar esse script com apenas um item e que seja infinito. E se for possível também gostaria por "talkactions" local config = { [11260] = {blessId = 5, text = 'The Spiritual Shielding'}, [11259] = {blessId = 6, text = 'The Embrace of Tibia'}, [11261] = {blessId = 4, text = 'The Fire of the Suns'}, [11258] = {blessId = 3, text = 'The Spark of the Phoenix'}, [11262] = {blessId = 2, text = 'The Wisdom of Solitude'}, [28036] = {blessId = 7, text = 'Heart of the Mountain'}, [28037] = {blessId = 8, text = 'Blood of the Mountain'} } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local useItem = config[item.itemid] if not useItem then return true end if player:hasBlessing(useItem.blessId) then player:say('You already possess this blessing.', TALKTYPE_MONSTER_SAY) return true end player:addBlessing(useItem.blessId,1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, useItem.text .. ' protects you.') player:getPosition():sendMagicEffect(CONST_ME_LOSEENERGY) item:remove(1) return true end
  6. Lua Script Error: [CreatureScript Interface] data/creaturescripts/scripts/modalwindowhelper.lua:onModalWindowdata/creaturescripts/scripts/citywar.lua:147: attempt to call method 'getBankBalance' (a nil value)stack traceback: [C]: in function 'getBankBalance' data/creaturescripts/scripts/citywar.lua:147: in function 'callback' data/creaturescripts/scripts/modalwindowhelper.lua:26: in function <data/creaturescripts/scripts/modalwindowhelper.lua:1> Alguém pode me ajudar? tfs 1.x Script:
  7. Gente eu estou procurando alguém que faça sistema anti-entrosa para war system no tfs 1.x Uma guild invita a outra para ir para um local privado onde apenas membros das duas guilds pode acessar Limitar o numero de jogadores que pode ir, ou seja, /war invite, nome da guild, 5, spell bloqueada, pote bloqueada Se for mais simples fazer deixar apenas /war invite, Nome da guild, 5 "5" = números máximo de jogadores de ambas guilds que pode entrar no local privado, 5x5 spells bloqueadas = spells bloqueadas "sem ue" "apenas sd" tanto faz pote bloqueada = pote nova bloqueada ou não. Eu tentei comprar de um cara aqui no fórum mas o animal só passou a perna. Acredito que pedindo assim vai ser mais difícil ainda. Aceito recomendações quem manjar de script pode passar o contato se quiser único jeito. (desculpe se postei no local errado)
  8. Gente eu to com um problema em um ONKILL, na verdade acho que não seja o onkill O problema é o seguinte REWARD CHEST, quando eu mato o boss usando um jogador apenas não acontece nada o reward funciona perfeitamente, mais quando eu uso utevo res "fire elemental (qualquer monstro) e faça ele participar do boss do reward ou que ele chegue a matar o boss o server crasha Achei que o problema seria o onkill mais eu removi uma função do onkill e não caiu, por favor podem tentar me ajudar? Assim cai function onKill(cid, target)target = Monster(target) if (target ~= nil) then local mt = MonsterType(target:getName()) if mt:useRewardChest() then local loot = BossLoot:new(target) if loot then local corpse = Item(doCreateItem(MonsterType(target:getName()):getCorpseId(), 1, target:getPosition())) corpse:decay() target:setDropLoot(false) loot:updateDamage() loot:setRewards() loot:addRewards() corpse:setAttribute('aid', 21584) end end end return trueend Então eu removi o ' loot:updateDamage() ' e parou de cair mais o reward não funciona como deveria claro que é enviar os items 'x' para os jogadores que participaram... function onKill(cid, target)target = Monster(target) if (target ~= nil) then local mt = MonsterType(target:getName()) if mt:useRewardChest() then local loot = BossLoot:new(target) if loot then local corpse = Item(doCreateItem(MonsterType(target:getName()):getCorpseId(), 1, target:getPosition())) corpse:decay() target:setDropLoot(false) loot:setRewards() loot:addRewards() corpse:setAttribute('aid', 21584) end end end return trueend function BossLoot:updateDamage() if self.creature then local tmp = {} local totaldmg = 0 for killer, damage in pairs(self.creature:getDamageMap()) do totaldmg = totaldmg+damage.total tmp[killer] = damage.total end self.players = sort_descending(tmp) self.totaldmg = totaldmg else error("Creature not found.") endend
  9. Estou procurando algo parecido, gostaria que os summons não ataque um certo tipo de monstro ou no caso bosses Uso tfs 1.x será que é possível isso? problema que estou tentando fazer o reward chest para de derrubar o server quando um summon participa ou mata um boss.
  10. @Eskylo obrigado amigo, deu certo perfeitamente o negocio da BAG e teve o resultado que eu esperava, não esta caindo o server pelo menos do jeito de antes não. Mais agora tem o problema do summon, tipo se o jogador summonar algum monstro e ele participar ou matar o boss do reward chest o server cai... Eu coloquei aquilo que voce passou ali no onkill e parece que não deu Tem como me ajudar neste caso também? @Eskylo me desculpe pela demora para responder, é que a maquina que uso para teste teve um problema nela e pedi para formatarem.
  11. @Eskylo amigo, obrigado eu ainda não testei mais creio que será de otima ajuda. Mais eu achei outro problema nele.. tipo se eu sumonar um monstro e colocar ele para atacar o monstro que tiver na lista do REWARD CHEST (boss) se ele matar o servidor cai... creio que seja porque os items do boss vai ser enviado pro monstro e como ele nao é um jogador o server cai. Será que tem um jeito de colocar no ONKILL apenas os jogadores que matar receber? se caso não for um jogador não acontece nada será possível isso?
  12. @Eskylo Os items ja esta indo para o DEPOT mais o problema que ele vai em items.. não em uma BAG, eu fiz um jeito de ir 1 item por bag ou seja, se o boss me dar 100 items vai ser enviado 100 BAGS com 1 item dentro. Eu so gostaria que fosse 1 bag por cada boss, matar 1 boss e ir todos os items que sair dele pra 1 bag só... deu pra entender? ja tentei editar essa parte ai mais "bugou" o script... Poderia fazer um tipo de exemplo pra eu testar?
  13. Sempre posto coisas aqui e nunca sou ajudado.. desanimador.
  14. Olá gostaria de pedir uma força pra alguem ai. Eu gostaria que este script me envie uma BAG por cada boss do reward chest que o jogador matar, atualmente ele esta enviando os items normal so que se eu mato 2 bosses iguais ou diferentes os items fica um em cima do outro, gostaria de separar. Ex: matou um boss os items vai ser enviado dentro de uma bag ou backpack dependendo do id que colocar, quando eu matar o outro boss vou receber outra bag ou backpack e quando eu ir na ilha pegar os items do reward, lá vai esta 2 bag ou backpack e nao os items tudo juntos Eu tentei mais consegui apenas enviar 1 item por cada bag ou backpack, ou seja, se eu matar um boss e ganhar 10 item, vai ser enviado 10 bags :\ Por fim o scritp é este: function sort_descending(t) local tmp = {} for k, v in pairs(t) do table.insert(tmp, {k, v}) end table.sort(tmp, function(a, b) return a[2] > b[2] end) return tmpendfunction table.find(t, v) for i,x in pairs(t) do if x == v then return true end endendfunction Player:addItemRewardBag(itemid, count)local rewardbag = self:getDepotChest(99, true) return rewardbag:addItem(itemid, count)endfunction MonsterType:getBossReward(chance, unique) local ret = {} local function randomItem(lootBlock, chance) local randvalue = math.random(0, 100000) / (getConfigInfo("rateLoot") * chance) if randvalue < lootBlock.chance then if (ItemType(lootBlock.itemId):isStackable()) then return (randvalue%lootBlock.maxCount) + 0 else return 1 end end end local lootBlockList = self:getLoot() for _, loot in pairs(lootBlockList) do local rd = randomItem(loot, chance) if rd then if loot.uniquedrop then if unique then table.insert(ret, {loot, rd}) end else table.insert(ret, {loot, rd}) end end end return retendBossLoot = {}BossUids = {}function BossLoot:new(boss) if not table.find(BossUids, boss:getId()) then table.insert(BossUids, boss:getId()) return setmetatable({creature=boss}, {__index = BossLoot}) endendfunction BossLoot:updateDamage() if self.creature then local tmp = {} local totaldmg = 0 for killer, damage in pairs(self.creature:getDamageMap()) do totaldmg = totaldmg+damage.total tmp[killer] = damage.total end self.players = sort_descending(tmp) self.totaldmg = totaldmg else error("Creature not found.") endendfunction BossLoot:setRewards() if self.totaldmg and self.creature then if getConfigInfo("rateLoot") > 0 then local mt = MonsterType(self.creature:getName()) for i, playertab in ipairs(self.players) do local loot if i == 1 then loot = mt:getBossReward(playertab[2] / self.totaldmg, true) else loot = mt:getBossReward(playertab[2] / self.totaldmg, false) end table.insert(self.players[i], loot) end end else error("Error") endendfunction BossLoot:addRewards() if self.players and self.players[1] and self.players[1][3] then for i, playertab in ipairs(self.players) do local player = Player(playertab[1]) if player then local str = "The following items are available in your reward chest: " for i, lootTable in ipairs(playertab[3]) do local item = player:addItemRewardBag(lootTable[1].itemId, math.ceil(lootTable[2])) if item then str = str .. item:getNameDescription() .. ", " end end str = str:sub(1, #str-2) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, str) end end else error("Error") endendfunction onKill(cid, target)target = Monster(target) if (target ~= nil) then local mt = MonsterType(target:getName()) if mt:useRewardChest() then local loot = BossLoot:new(target) if loot then local corpse = Item(doCreateItem(MonsterType(target:getName()):getCorpseId(), 1, target:getPosition())) doDecayItem() target:setDropLoot(false) loot:updateDamage() loot:setRewards() loot:addRewards() corpse:setAttribute('aid', 21584) end end end return trueend
  15. como foi que você resolveu? eu também tive o mesmo problema.
  16. Ola, gente eu to tentando adicionar comando para invitar war, para não ficar usando site. Mais o problema que achei é que o comando não adiciona os nomes das guilds, estou tentando colocar para adicionar os nomes não estou tendo sucesso, então resolvi pedir ajuda a algum abençoado daqui, sempre tento pedir ajuda aqui mais nunca ninguem ajuda. Será que é impossível colocar os nomes das guilds? GUILD QUE INVITOU E GUILD INIMIGA, O TFS É 1.0 Comando: function onSay(cid, words, param) local player = Player(cid) local guild = player:getGuild() if(guild == nil) then player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.") return false end local guild = getPlayerGuildId(cid) if not guild or (player:getGuildLevel() < GUILDLEVEL_LEADER) then player:sendCancelMessage("You cannot execute this talkaction.") return false end local t = string.split(param, ",") if(not t[2]) then player:sendChannelMessage("", "Not enough param(s).", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end local enemy = getGuildId(t[2]) if(not enemy) then player:sendChannelMessage("", "Guild \"" .. t[2] .. "\" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end if(enemy == guild) then player:sendChannelMessage("", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy) if tmp ~= false then enemyName = result.getDataString(tmp, "name") result.free(tmp) end if(isInArray({"accept", "reject", "cancel"}, t[1])) then local query = "`guild1` = " .. enemy .. " AND `guild2` = " .. guild if(t[1] == "cancel") then query = "`guild1` = " .. guild .. " AND `guild2` = " .. enemy end tmp = db.storeQuery("SELECT `id`, `started`, `ended`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0") if(tmp == false) then player:sendChannelMessage("", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end if(t[1] == "accept") then local _tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild) local state = result.getDataInt(_tmp, "balance") < result.getDataInt(tmp, "payment") result.free(_tmp) if(state) then player:sendChannelMessage("", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end db.query("UPDATE `guilds` SET `balance` = `balance` - " .. result.getDataInt(tmp, "payment") .. " WHERE `id` = " .. guild) end query = "UPDATE `guild_wars` SET " local msg = "accepted " .. enemyName .. " invitation to war." if(t[1] == "reject") then query = query .. "`ended` = " .. os.time() .. ", `status` = 2" msg = "rejected " .. enemyName .. " invitation to war." elseif(t[1] == "cancel") then query = query .. "`ended` = " .. os.time() .. ", `status` = 3" msg = "canceled invitation to a war with " .. enemyName .. "." else query = query .. "`started` = " .. os.time() .. ", `ended` = " .. (result.getDataInt(tmp, "ended") > 0 and (os.time() + ((result.getDataInt(tmp, "started") - result.getDataInt(tmp, "ended")) / 86400)) or 0) .. ", `status` = 1" end query = query .. " WHERE `id` = " .. result.getDataInt(tmp, "id") result.free(tmp) db.query(query) broadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE) return false end if(t[1] == "invite") then local str = "" tmp = db.storeQuery("SELECT `guild1`, `status` FROM `guild_wars` WHERE `guild1` IN (" .. guild .. "," .. enemy .. ") AND `guild2` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)") if(tmp ~= false) then if(result.getDataInt(tmp, "status") == 0) then if(result.getDataInt(tmp, "guild1") == guild) then str = "You have already invited " .. enemyName .. " to war." else str = enemyName .. " have already invited you to war." end else str = "You are already on a war with " .. enemyName .. "." end result.free(tmp) end if(str ~= "") then player:sendChannelMessage("", str, TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end local frags = tonumber(t[3]) if(frags ~= nil) then frags = math.max(10, math.min(1000, frags)) else frags = 100 end local payment = tonumber(t[4]) if(payment ~= nil) then payment = math.floor(payment)+1000 tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild) local state = result.getDataInt(tmp, "balance") < payment result.free(tmp) if(state) then player:sendChannelMessage("", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end db.query("UPDATE `guilds` SET `balance` = `balance` - " .. payment .. " WHERE `id` = " .. guild) else payment = 0 end local begining, ending = os.time(), tonumber(t[5]) if(ending ~= nil and ending ~= 0) then ending = begining + (ending * 86400) else ending = 0 end db.query("INSERT INTO `guild_wars` (`guild1`, `guild2`, `started`, `ended`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");") broadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE) return false end if(not isInArray({"end", "finish"}, t[1])) then return false end local status = (t[1] == "end" and 1 or 4) tmp = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `guild1` = " .. guild .. " AND `guild2` = " .. enemy .. " AND `status` = " .. status) if(tmp ~= false) then local query = "UPDATE `guild_wars` SET `ended` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. result.getDataInt(tmp, "id") result.free(tmp) db.query(query) broadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE) return false end if(status == 4) then player:sendChannelMessage("", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end tmp = db.storeQuery("SELECT `id`, `ended` FROM `guild_wars` WHERE `guild1` = " .. enemy .. " AND `guild2` = " .. guild .. " AND `status` = 1") if(tmp ~= false) then if(result.getDataInt(tmp, "ended") > 0) then result.free(tmp) player:sendChannelMessage("", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end local query = "UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `id` = " .. result.getDataInt(tmp, "id") result.free(tmp) db.query(query) broadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE) return false end player:sendChannelMessage("", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end No mysql as tabela name1 e name2 ficam vazia olha abaixo Se for impossível colocar pra adicionar os nomes das guild usando comando por favor avise se não for INCOMODAR ¬¬
  17. Gente eu to procurando resolver um problema na WOTE quest. O boss é sumonado normal quando da USE no item e joga em cima do outro item no MAPA. O problema é que se o player sair ou morrer o boss continua vivo e ninguem pode entrar até que ele seja morto, só que claro que não tem como matar porque ninguem entra na sala, eu queria arrumar para depois de um tempo liberar a sala e o boss ser removido para poder o outro player que entrar sumonar novamente e tentar matar se caso ele sair ou morrer depois do tempo "x" a sala é liberada e o boss é removido. O script atual é e o que libera ou bloqueia a sala é "setGlobalStorageValue" Poderia colocar o TP normal, mais dai os players que morrer e tentar novamente vai ficar chamando muitos bosses caso ele nao seja removido. local boss = { [3193] = "fury of the emperor", [3194] = "wrath of the emperor", [3195] = "scorn of the emperor", [3196] = "spite of the emperor", } function onUse(cid, item, fromPosition, itemEx, toPosition) if(item.itemid == 12318 and boss[itemEx.uid] and itemEx.itemid == 12383) then doTransformItem(itemEx.uid, 11753) doSummonCreature(boss[itemEx.uid], {x = toPosition.x + 4, y = toPosition.y, z = toPosition.z}) setGlobalStorageValue(itemEx.uid - 4, 1) elseif(item.itemid == 12318 and itemEx.itemid == 12317) then if(toPosition.x > 33034 and toPosition.x < 33071 and toPosition.y > 31079 and toPosition.y < 31102) then if(getPlayerStorageValue(cid, 1090) == 1) then setPlayerStorageValue(cid, 1090, 2) doCreatureSay(cid, "The sceptre is almost torn from your hand as you banish the presence of the emperor.", TALKTYPE_ORANGE_1) doTeleportThing(cid, {x = 33052, y = 31085, z = 14}) doSendMagicEffect({x = 33052, y = 31085, z = 14}, CONST_ME_TELEPORT) end elseif(toPosition.x > 33080 and toPosition.x < 33111 and toPosition.y > 31079 and toPosition.y < 31100) then if(getPlayerStorageValue(cid, 1090) == 2) then setPlayerStorageValue(cid, 1090, 3) doCreatureSay(cid, "The sceptre is almost torn from your hand as you banish the presence of the emperor.", TALKTYPE_ORANGE_1) doTeleportThing(cid, {x = 33098, y = 31085, z = 14}) doSendMagicEffect({x = 33098, y = 31085, z = 14}, CONST_ME_TELEPORT) end elseif(toPosition.x > 33078 and toPosition.x < 33112 and toPosition.y > 31106 and toPosition.y < 31127) then if(getPlayerStorageValue(cid, 1090) == 3) then setPlayerStorageValue(cid, 1090, 4) doCreatureSay(cid, "The sceptre is almost torn from your hand as you banish the presence of the emperor.", TALKTYPE_ORANGE_1) doTeleportThing(cid, {x = 33100, y = 31116, z = 14}) doSendMagicEffect({x = 33100, y = 31116, z = 14}, CONST_ME_TELEPORT) end elseif(toPosition.x > 33035 and toPosition.x < 33069 and toPosition.y > 31107 and toPosition.y < 31127) then if(getPlayerStorageValue(cid, 1090) == 4) then setPlayerStorageValue(cid, 1090, 5) doCreatureSay(cid, "The sceptre is almost torn from your hand as you banish the presence of the emperor.", TALKTYPE_ORANGE_1) doTeleportThing(cid, {x = 33066, y = 31151, z = 15}) doSendMagicEffect({x = 33066, y = 31151, z = 15}, CONST_ME_TELEPORT) end end elseif(item.itemid == 12318 and itemEx.itemid == 12385) then if(getPlayerStorageValue(cid, 1090) == 5) then doCreatureSay(cid, "NOOOoooooooo...!", TALKTYPE_ORANGE_1, false, cid, toPosition) doCreatureSay(cid, "This should have dealt the deathblow to the snake things' ambitions.", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, 1090, 6) end end return true end
  18. Bem eu ando procurando como fazer uma talkactions pra convida outra guild para ir para um local X por um tempo determinado e assim que o tempo acabar eles volta pro templo ou se eles quiser cancelar antes ja usa o comando pra terminar. Como não consegui ajuda eu mesmo estou procurando fazer um modo, primeiramente eu consegui fazer com que os dois lider serem teleportado porem só consigo colocar 1 de cada vez exemplo !invite - lider que enviou o comando já foi teleportado !accept - lider que aceitou também foi teleportado Fazendo isso vai acontecer bugs... queria fazer com que os dois e seus membros serem teleportado para coordenadas x O TFS que uso é 1.0 function onSay(cid, words, param) local player = Player(cid) local guild = player:getGuild() if(guild == nil) then player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.") return false end local guild = getPlayerGuildId(cid) if not guild or (player:getGuildLevel() < GUILDLEVEL_LEADER) then player:sendCancelMessage("You cannot execute this talkaction.") return false end local t = string.split(param, ",") if(not t[2]) then player:sendChannelMessage("", "Not enough param(s).", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end local enemy = getGuildId(t[2]) if(not enemy) then player:sendChannelMessage("", "Guild \"" .. t[2] .. "\" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end if(enemy == guild) then player:sendChannelMessage("", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy) if tmp ~= false then enemyName = result.getDataString(tmp, "name") result.free(tmp) end if(isInArray({"accept", "reject", "cancel"}, t[1])) then local query = "`guild1` = " .. enemy .. " AND `guild2` = " .. guild if(t[1] == "cancel") then query = "`guild1` = " .. guild .. " AND `guild2` = " .. enemy end tmp = db.storeQuery("SELECT `id`, `started`, `ended`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0") if(tmp == false) then player:sendChannelMessage("", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end if(t[1] == "accept") then local _tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild) local state = result.getDataInt(_tmp, "balance") < result.getDataInt(tmp, "payment") result.free(_tmp) if(state) then player:sendChannelMessage("", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end db.query("UPDATE `guilds` SET `balance` = `balance` - " .. result.getDataInt(tmp, "payment") .. " WHERE `id` = " .. guild) end query = "UPDATE `guild_wars` SET " local msg = "accepted " .. enemyName .. " invitation to war." if(t[1] == "reject") then query = query .. "`ended` = " .. os.time() .. ", `status` = 2" msg = "rejected " .. enemyName .. " invitation to war." elseif(t[1] == "cancel") then query = query .. "`ended` = " .. os.time() .. ", `status` = 3" msg = "canceled invitation to a war with " .. enemyName .. "." else query = query .. "`started` = " .. os.time() .. ", `ended` = " .. (result.getDataInt(tmp, "ended") > 0 and (os.time() + ((result.getDataInt(tmp, "started") - result.getDataInt(tmp, "ended")) / 86400)) or 0) .. ", `status` = 1" end query = query .. " WHERE `id` = " .. result.getDataInt(tmp, "id") result.free(tmp) db.query(query) broadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE) return false end if(t[1] == "invite") then local str = "" tmp = db.storeQuery("SELECT `guild1`, `status` FROM `guild_wars` WHERE `guild1` IN (" .. guild .. "," .. enemy .. ") AND `guild2` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)") if(tmp ~= false) then if(result.getDataInt(tmp, "status") == 0) then if(result.getDataInt(tmp, "guild1") == guild) then str = "You have already invited " .. enemyName .. " to war." else str = enemyName .. " have already invited you to war." end else str = "You are already on a war with " .. enemyName .. "." end result.free(tmp) end if(str ~= "") then player:sendChannelMessage("", str, TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end local frags = tonumber(t[3]) if(frags ~= nil) then frags = math.max(10, math.min(1000, frags)) else frags = 100 end local payment = tonumber(t[4]) if(payment ~= nil) then payment = math.floor(payment)+1000 tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild) local state = result.getDataInt(tmp, "balance") < payment result.free(tmp) if(state) then player:sendChannelMessage("", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end db.query("UPDATE `guilds` SET `balance` = `balance` - " .. payment .. " WHERE `id` = " .. guild) else payment = 0 end local begining, ending = os.time(), tonumber(t[5]) if(ending ~= nil and ending ~= 0) then ending = begining + (ending * 86400) else ending = 0 end db.query("INSERT INTO `guild_wars` (`guild1`, `guild2`, `started`, `ended`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");") broadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE) return false end if(not isInArray({"end", "finish"}, t[1])) then return false end local status = (t[1] == "end" and 1 or 4) tmp = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `guild1` = " .. guild .. " AND `guild2` = " .. enemy .. " AND `status` = " .. status) if(tmp ~= false) then local query = "UPDATE `guild_wars` SET `ended` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. result.getDataInt(tmp, "id") result.free(tmp) db.query(query) broadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE) return false end if(status == 4) then player:sendChannelMessage("", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end tmp = db.storeQuery("SELECT `id`, `ended` FROM `guild_wars` WHERE `guild1` = " .. enemy .. " AND `guild2` = " .. guild .. " AND `status` = 1") if(tmp ~= false) then if(result.getDataInt(tmp, "ended") > 0) then result.free(tmp) player:sendChannelMessage("", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end local query = "UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `id` = " .. result.getDataInt(tmp, "id") result.free(tmp) db.query(query) broadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE) return false end player:sendChannelMessage("", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD) return false end
  19. Cara não poderia fazer um talkaction que convida outra guild e assim que ela aceitar todos os membros que tiver dentro do pz vai ser movido para um local X? To usando como base a talkaction de invite pra war... so que nao to conseguindo colocar pra duas guild serem movidas para o local x ao mesmo tempo
  20. Pois é, mais ninguem ajuda... não precisa ser ligado a war system, pra invitar war system os jogadores usa o site mais dai usa o comando pra ir pro local x.
  21. Ola, gostaria de saber se alguém nesse fórum aqui tem experiencia para fazer um sistema sem entrosa para que possa adicionar no servidor para as guilds ir war em locais privados aonde ninguem vá atrapalhar com makers que não seja da guild. Não precisa ser ligado na war system, só preciso de um system que convite a outra guild e os seus membros para ir para um local "X" aonde apenas eles tivesse acesso por um certo período e assim fazer uma war para ninguem vim atrapalhar. Eu tento mandar privado para algumas pessoas do fórum pra falar sobre o assunto mais eles nunca respondem, então se alguém souber por favor mande privado pra mim ou responda aqui, Se voce quer vender ok ótimo eu compro.
  22. Gente gostaria de ajuda pra passar esse código para funcionar no TFS 1.0 REWARD_CHEST = { BOSSES = {"Bibby Bloodbath", "Chizzoron the Distorter", "Ferumbras", "Furyosa", "Gaz'haragoth", "Ghazbaran", "Hirintror", "Jaul", "Mad Mage", "Mawhawk", "Morgaroth", "Obujos", "Ocyakao", "Omrafir", "Orshabaal", "Raging Mage", "Tanjis", "The Mutated Pumpkin", "The Pale Count", "The Welter", "Tyrn", "White Pale", "Zulazza the Corruptor", "Zushuka"}, LOOT = {}, DECAY = {}, DEPOT_ID = 99, CONTAINER = 21518, EXPIRE = 7*24*60*60, --days to erase stored rewards STORAGE = 18394, --player storage for chest exhaustion EXHAUST = 5*60, --time allowed to use again the chest } function table.find(t, value, sensitive) local sensitive = sensitive or true if(not sensitive and type(value) == 'string') then for i, v in pairs(t) do if(type(v) == 'string') then if(v:lower() == value:lower()) then return i end end end return nil end for i, v in pairs(t) do if(v == value) then return i end end return nil end function table.serialize(x, recur) local t = type(x) recur = recur or {} if(t == nil) then return "nil" elseif(t == "string") then return string.format("%q", x) elseif(t == "number") then return tostring(x) elseif(t == "boolean") then return x and "true" or "false" elseif(getmetatable(x)) then error("Can not serialize a table that has a metatable associated with it.") elseif(t == "table") then if(table.find(recur, x)) then error("Can not serialize recursive tables.") end table.insert(recur, x) local s = "{" for k, v in pairs(x) do s = s .. "[" .. table.serialize(k, recur) .. "]" .. " = " .. table.serialize(v, recur) .. ", " end return s:sub(0, s:len() - 2) .. "}" end error("Can not serialize value of type '" .. t .. "'.") end function table.unserialize(str) return loadstring('return ' .. str)() end function addContainerItems(container, items) for k, v in pairs(items) do if ItemType(k):isContainer() then local newBag = Container(doCreateItemEx(k, 1)) addContainerItems(newBag, v) container:addItemEx(newBag) else container:addItem(v[1], v[2]) end end end function MonsterType.createLootItem(self, lootBlock, chance) local lootTable, itemCount = {}, 0 local randvalue = math.random(0, 100000) / (getConfigInfo("rateLoot") * chance) if randvalue < lootBlock.chance then if (ItemType(lootBlock.itemId):isStackable()) then itemCount = randvalue % lootBlock.maxCount + 1 else itemCount = 1 end end while itemCount > 0 do local n = math.min(itemCount, 100) itemCount = itemCount - n table.insert(lootTable, {lootBlock.itemId, n}) end return lootTable end function MonsterType.getBossReward(self, chance) local result = {} if getConfigInfo("rateLoot") > 0 then for _, loot in pairs(self:getLoot()) do local itemList = self:createLootItem(loot, chance) if itemList then for _, item in ipairs(itemList) do table.insert(result, item) end end end end return result end function getDecayTime(id) local decayTime = 0 do local o = io.open('data/items/items.xml','r') file = o:read('*a') o:close() end local function sumDecayTime(corpse) for attr in file:gmatch('<item.-id="' .. corpse ..'"(.-)</item>') do local decayTo = attr:match('<attribute.-key="decayTo".-value="(.-)".-/>') local duration = attr:match('<attribute.-key="duration".-value="(.-)".-/>') decayTime = decayTime + duration if tonumber(decayTo) > 0 then sumDecayTime(decayTo) end break end end sumDecayTime(id) return decayTime end function loadCorpses() for _, name in ipairs(REWARD_CHEST.BOSSES) do if MonsterType(name) ~= nil then REWARD_CHEST.DECAY[name] = getDecayTime(MonsterType(name):getCorpseId()) end end end addEvent(loadCorpses, 0) function getPlayerByGUID(guid) for _, player in ipairs(Game.getPlayers()) do if guid == player:getGuid() then return player end end return nil end function Player.addReward(self, reward, time, id) local LootBag = Container(doCreateItemEx(REWARD_CHEST.CONTAINER, 1)) LootBag:setAttribute('text', time) addContainerItems(LootBag, reward) if id then db.query('DELETE FROM player_rewardchest WHERE id = ' .. id .. ';') end return self:getDepotChest(REWARD_CHEST.DEPOT_ID, true):addItemEx(LootBag) end function doSaveReward(uid, name) for GUID, items in pairs(REWARD_CHEST.LOOT[uid]) do local player = getPlayerByGUID(GUID) if player ~= nil then player:addReward(items, os.time()) player:sendTextMessage(MESSAGE_INFO_DESCR, 'Your reward container from ' .. name .. ' was moved to your reward chest.') else db.query('INSERT INTO player_rewardchest VALUES (NULL, ' .. GUID ..', "' .. table.serialize(items) ..'", ' .. os.time() ..');') end end REWARD_CHEST.LOOT[uid] = nil end function Player.updateRewardChest(self) db.query('DELETE FROM player_rewardchest WHERE TIME_TO_SEC(TIMEDIFF(NOW(), FROM_UNIXTIME(date))) >= '.. REWARD_CHEST.EXPIRE ..';') local Query = db.storeQuery('SELECT id, reward, date FROM player_rewardchest WHERE player_id = '.. self:getGuid() ..';') if Query ~= false then repeat local rewardBag = table.unserialize(result.getDataString(Query, 'reward')) self:addReward(rewardBag, result.getDataInt(Query, 'date'), result.getDataInt(Query, 'id')) until not result.next(Query) result.free(Query) end local depotChest = self:getDepotChest(REWARD_CHEST.DEPOT_ID, true) for index = (depotChest:getSize() - 1), 0, -1 do local container = depotChest:getItem(index) if (container:getAttribute('text') ~= nil) and (tonumber(container:getAttribute('text')) + REWARD_CHEST.EXPIRE < os.time()) then container:remove() end end return self:setExhaustion(REWARD_CHEST.STORAGE, REWARD_CHEST.EXHAUST) end function string.diff(self) local format = { {'day', self / 60 / 60 / 24}, {'hour', self / 60 / 60 % 24}, {'minute', self / 60 % 60}, {'second', self % 60} } local out = {} for k, t in ipairs(format) do local v = math.floor(t[2]) if(v > 0) then table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or '')) end end local ret = table.concat(out) if ret:len() < 16 and ret:find('second') then local a, b = ret:find(' and ') ret = ret:sub(b+1) end return ret end function doBossReward(monster, corpse) REWARD_CHEST.LOOT[corpse:getUniqueId()] = {} corpse:setAttribute('aid', 21584) corpse:setAttribute('text', corpse:getUniqueId()) for killer, damage in pairs(monster:getDamageMap()) do local player, str = Player(killer), 'Loot of ' .. MonsterType(monster:getName()):getNameDescription() .. ': ' if player ~= nil then local rewardBag = doCreateItemEx(REWARD_CHEST.CONTAINER) if player:getStamina() > 840 then local loot = MonsterType(monster:getName()):getBossReward(damage.total/monster:getMaxHealth()) if #loot > 0 then addContainerItems(Container(rewardBag), loot) REWARD_CHEST.LOOT[corpse:getUniqueId()][player:getGuid()] = loot str = str .. Container(rewardBag):getContentDescription() else str = str .. 'nothing' end else str = str .. 'nothing (due to low stamina)' end player:sendTextMessage(MESSAGE_INFO_DESCR, str .. '.') end end addEvent(doSaveReward, REWARD_CHEST.DECAY[monster:getName()]*1000, corpse:getUniqueId(), MonsterType(monster:getName()):getNameDescription()) end function onKill(creature, target) if (Monster(target) ~= nil) and isInArray(REWARD_CHEST.BOSSES, target:getName()) then local corpse = Item(doCreateItem(MonsterType(target:getName()):getCorpseId(), 1, target:getPosition())) corpse:decay() target:setDropLoot(false) doBossReward(target, corpse) end end Aparece o seguinte erro: Lua Script Error: [CreatureScript Interface] data/creaturescripts/scripts/reward_chest.lua:onKill data/creaturescripts/scripts/reward_chest.lua:249: attempt to index local 'target' (a number value) stack traceback: [C]: in function '__index' data/creaturescripts/scripts/reward_chest.lua:249: in function <data/creaturescripts/scripts/reward_chest.lua:248> Estou tentando fazer o sistema de reward boss igual do tibia RL. Me ajudem ai
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...