Ir para conteúdo

MatheusGlad

Conde
  • Total de itens

    528
  • Registro em

  • Última visita

  • Dias Ganhos

    30

Tudo que MatheusGlad postou

  1. Bem, a talkaction é a mesma coisa que o !rank que conhecemos, porem voce pode adicionar outros ranks e ela atualiza exatamente na hora que alguem upa. Exemplos de novos ranks: Rank para ver quem morreu mais. Rank para level de players vip. Rank para ver quem matou mais monstros no ot. E varios outros... Bem se alguem quizer implementar um novo rank, peça no topico e mande PM para mim (Nao adianta so pedir no topico porque eu nao irei lembrar de entrar nele). O script está em mod, bem mais facil de instalar. Va na pasta mods do seu ot e adicione o arquivo: RankSystem em formato XML e adicione isso: <?xml version="1.0" encoding="UTF-8"?> <mod name="RankSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com"> <config name="RankLib"><![CDATA[ ranks = { ["fist"] = 74666, ["club"] = 74667, ["sword"] = 74668, ["axe"] = 74669, ["distance"] = 74670, ["shielding"] = 74671, ["fishing"] = 74672, ["magic"] = 74673, ["level"] = 74674, ["monsters"] = 74675, ["guilds"] = 74676 } function havePlayerInRank(rank, playername) -- Checa se o player ja esta no rank. local rankstr = getGlobalStorageValue(ranks[rank]) local players = string.explode(rankstr, "; ") for i,x in pairs(players) do local a, b = string.find(x, "%[") if b ~= nil then if x:sub(1, b-1):lower() == playername:lower() then return TRUE end end end end function getPlayerLevelInRank(rank, playername) -- Pega o level de algum player no rank (Importante para novos tipos de rank.) local rankstr = getGlobalStorageValue(ranks[rank]) local players = string.explode(rankstr, "; ") for i,x in pairs(players) do local a, b = string.find(x, "%[") local t = string.match(x, "%[(.+)]") if b ~= nil and x:sub(1, b-1):lower() == playername:lower() then return t end end return 0 end function addRankPlayer(rank, playername, rankvalue) -- Adiciona um player ao rank ou muda o valor dele no rank. if not havePlayerInRank(rank, playername) then setGlobalStorageValue(ranks[rank], getGlobalStorageValue(ranks[rank]) .. (playername .. "[" .. rankvalue .. "]; ")) else local a,b = string.find(getGlobalStorageValue(ranks[rank]), playername) local c,d = string.find(getGlobalStorageValue(ranks[rank]), playername .. "%[%d+]") setGlobalStorageValue(ranks[rank], getGlobalStorageValue(ranks[rank]):sub(1, b+1) .. rankvalue .. "]; " .. getGlobalStorageValue(ranks[rank]):sub(d+2)) end end function tablelen(tab) -- By MatheusMkalo local result = 0 for i,x in pairs(tab) do result = result+1 end return result end function getRank(rank, maxplayers) -- Pega a lista de players com maior level do rank local rankstr = getGlobalStorageValue(ranks[rank]) local playerstatus = string.explode(rankstr, "; ") local tab = {} local rankTab = {} local rankStr = "Highscore for " .. rank .. "\n\n" .. (isInArray({"monsters", "guilds"}, rank) and "Number of Kills" or "Rank Level") .. " - " .. (rank == "guilds" and "Guild Name" or "Player Name") .. "\n" table.remove(playerstatus, #playerstatus) for i,x in pairs(playerstatus) do local a, b = string.find(x, "%[") local t = string.match(x, "%[(.+)]") tab[x:sub(1, b-1)] = tonumber(t) end local lastname = "" local lastvalue = 0 for i = 1, maxplayers do if tablelen(tab) <= 0 then break end for s,x in pairs(tab) do if x > lastvalue then lastvalue = x lastname = s end end table.insert(rankTab, lastvalue .. " - " .. lastname) tab[lastname] = nil lastname = "" lastvalue = 0 end for i,x in ipairs(rankTab) do rankStr = rankStr .. (i .. ". ") .. x .. "\n" end return rankStr end ]]></config> <talkaction words="!rank;/rank" event="script"><![CDATA[ domodlib('RankLib') if ranks[param:lower()] then setGlobalStorageValue(ranks[param:lower()], getGlobalStorageValue(ranks[param:lower()]) == -1 and "" or getGlobalStorageValue(ranks[param:lower()])) doShowTextDialog(cid, 6500, getRank(param:lower(), 10)) else return doPlayerSendCancel(cid, "Esse rank nao existe ou voce nao digitou corretamente.") end return TRUE ]]></talkaction> <creaturescript type="advance" name="RankSystem" event="script"><![CDATA[ domodlib('RankLib') if skill == 0 then setGlobalStorageValue(74666, getGlobalStorageValue(74666) == -1 and "" or getGlobalStorageValue(74666)) addRankPlayer("fist", getCreatureName(cid), newLevel) elseif skill == 1 then setGlobalStorageValue(74667, getGlobalStorageValue(74667) == -1 and "" or getGlobalStorageValue(74667)) addRankPlayer("club", getCreatureName(cid), newLevel) elseif skill == 2 then setGlobalStorageValue(74668, getGlobalStorageValue(74668) == -1 and "" or getGlobalStorageValue(74668)) addRankPlayer("sword", getCreatureName(cid), newLevel) elseif skill == 3 then setGlobalStorageValue(74669, getGlobalStorageValue(74669) == -1 and "" or getGlobalStorageValue(74669)) addRankPlayer("axe", getCreatureName(cid), newLevel) elseif skill == 4 then setGlobalStorageValue(74670, getGlobalStorageValue(74670) == -1 and "" or getGlobalStorageValue(74670)) addRankPlayer("distance", getCreatureName(cid), newLevel) elseif skill == 5 then setGlobalStorageValue(74671, getGlobalStorageValue(74671) == -1 and "" or getGlobalStorageValue(74671)) addRankPlayer("shielding", getCreatureName(cid), newLevel) elseif skill == 6 then setGlobalStorageValue(74672, getGlobalStorageValue(74672) == -1 and "" or getGlobalStorageValue(74672)) addRankPlayer("fishing", getCreatureName(cid), newLevel) elseif skill == 7 then setGlobalStorageValue(74673, getGlobalStorageValue(74673) == -1 and "" or getGlobalStorageValue(74673)) addRankPlayer("magic", getCreatureName(cid), newLevel) elseif skill == 8 then setGlobalStorageValue(74674, getGlobalStorageValue(74674) == -1 and "" or getGlobalStorageValue(74674)) addRankPlayer("level", getCreatureName(cid), newLevel) end return TRUE ]]></creaturescript> <creaturescript type="kill" name="KillRank" event="script"><![CDATA[ domodlib('RankLib') setGlobalStorageValue(74675, getGlobalStorageValue(74675) == -1 and "" or getGlobalStorageValue(74675)) if isMonster(target) then addRankPlayer("monsters", getCreatureName(cid), getPlayerLevelInRank("monsters", getCreatureName(cid))+1) end if isPlayer(target) then if getPlayerGuildId(cid) > 0 then if lastHit then if getPlayerGuildId(target) <= 0 or getPlayerGuildId(target) ~= getPlayerGuildId(cid) then addRankPlayer("guilds", getPlayerGuildName(cid), getPlayerLevelInRank("guilds", getPlayerGuildName(cid))+1) end end end end return TRUE ]]></creaturescript> <creaturescript type="login" name="RankEvents" event="script"><![CDATA[ registerCreatureEvent(cid, "KillRank") registerCreatureEvent(cid, "RankSystem") return TRUE ]]></creaturescript> </mod> Alem dos ranks normais, eu inclui um rank para os maiores matadores de monstros, para voces poderem ter uma ideia de como incluir novos ranks. PARA QUE O SCRIPT FUNCIONE RETIRE ESSA LINHA DO TALKACTIONS.XML: <talkaction words="!rank;/rank" event="script" value="ranks.lua"/> OBS: Para usar o rank novo use /rank ou !rank e o nome dos skills que se encontram nessa table: ranks = { ["fist"] = 74666, ["club"] = 74667, ["sword"] = 74668, ["axe"] = 74669, ["distance"] = 74670, ["shielding"] = 74671, ["fishing"] = 74672, ["magic"] = 74673, ["level"] = 74674, ["monsters"] = 74675 } No caso do novo rank seria /rank monsters. Para mudar o numero de players mostrados no rank mude essa linha no mod: doShowTextDialog(cid, 2160, getRank(param:lower(), 10)) 10 eh o numero de players que vai mostrar. Adicionado /rank guilds, que mostra as guilds que mais mataram no ot. Agora com aparencia e frases exatamente iguais ao /rank padrao. È Isso ai comentem!
  2. MatheusGlad

    Pedido De Script

    function onSay(cid, words, param) --[[ Script feito por Medargo Storage value utilizado: 9845 ]]-- local perg = { "10+10=1000, isso é verdade? Responda da seguinte maneira: '!quiz sim/não' apenas com 'sim' ou 'não'", "O Estados Unidos é um pais? Responda da seguinte maneira: '!quiz sim/não' apenas com 'sim' ou 'não'", "Michael Jackson esta prestes a fazer uma turnê? Responda da seguinte maneira: '!question sim/não' apenas com 'sim' ou 'não'", "Newton descobriu a gravidade com uma maça? Responda da seguinte maneira: '!quiz sim/não' apenas com 'sim' ou 'não'", "Ajudantes também são players?: '!quiz sim/não' apenas com 'sim' ou 'não'", "O bixo Lord Vampire é o mais forte do servidor?: '!quiz sim/não' apenas com 'sim' ou 'não'", "Se alguém não atender ao sistema de ant-bot é banido do servidor?: '!quiz sim/não' apenas com 'sim' ou 'não'", } local resp = {"não", "sim", "não", "sim" , "sim", "não", "não"} local area = { ---- Area. {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, } function tableEquals(t1, t2, s) -- function by MatheusMkalo for i,x in pairs(not s and t1 or t2) do if (s and t1[i] ~= x or t2[i] ~= x) then s = false break end end return s == "end" and true or s == true and tableEquals(t1, t2, "end") or s == nil and tableEquals(t1, t2, true) or false end local extpos = {x=187, y=300, z=7} -- Posicao do primeiro sqm << /\ da area. local status = false for i,x in pairs(area) do for s, z in pairs(x) do local creature = getCreaturePosition(cid) if tableEquals({x=creature.x, y=creature.y, z=creature.z}, {x=extpos.x+s-1, y=extpos.y+i-1, z=extpos.z}) then status = true end end end if not status then return doPlayerSendCancel(cid, "Voce precisa estar na area correta.") end if param == '' then if getPlayerStorageValue(cid, 9845) == -1 then questionid = math.random(1,#perg) question = perg[questionid] doPlayerSendTextMessage(cid, 19, question) setPlayerStorageValue(cid, 9845, 1) else doPlayerSendTextMessage(cid, 18, "Você ja possui uma pergunta em mãos, use '!quiz reset' para resetar o sistema") end elseif param ~= '' then if getPlayerStorageValue(cid, 9845) == 1 then if param ~= 'reset' then if param == 'sim' or param == 'não' then if param == resp[questionid] then doPlayerSendTextMessage(cid, 27, "CORRETO, Sistema resetado!") setPlayerStorageValue(cid, 9845, -1) doPlayerAddItem(cid, 2160,1) questionid = nil question = nil else doPlayerSendTextMessage(cid, 18, "ERRADO, Sistema resetado!") setPlayerStorageValue(cid, 9845, -1) questionid = nil question = nil end else doPlayerSendTextMessage(cid, 18, "Use 'sim' ou 'não' para responder!") end else doPlayerSendTextMessage(cid, 19, "Sistema resetado, pode pegar outra questão.") setPlayerStorageValue(cid, 9845, -1) questionid = nil question = nil end else doPlayerSendTextMessage(cid, 18, "Você não possui pergunta em mãos, para conseguir uma, use '!quiz''") end end return TRUE end Configuraçao facil flws.
  3. Bugs foram retirados, e agora o script so esta disponivel na versao em mod, agora nao eh nescessariamente double exp, e sim exp potion, porque voce decide o quanto % vai dar a mais de exp. Funciona perfeitamente com outros sistemas de adicionar exp, e nao anulas-os.
  4. Agora o War Arena System esta disponivel em MOD, vale a pena conferir: http://www.xtibia.com/forum/topic/154487-war-arena-system/

  5. Versão em MOD adicionada ao topico, muito mais pratico, aproveitem!
  6. MatheusGlad

    [Pedido]

    Ja que eh akilo la mesmo. Segue os scripts e os locais onde eles devem ficar: Va em data/lib/000-constant.lua e adicione essa linha: GuildCastleScore = {} data/creaturescripts/scripts/CastleGenerator_Kill.lua: function haveCastleEventWinner() local a = 0 for i,x in pairs(GuildCastleScore) do a = a+x end return a >= 5 end function getGuildCastleEventWinner() local bestscore = 0 for i,x in pairs(GuildCastleScore) do if x > bestscore then bestscore = x GuildWinner = i end end return GuildWinner end function onKill(cid, target, lastHit) if getCreatureName(target) == "Castle Generator" then if lastHit then GuildCastleScore[getPlayerGuildName(cid)] = GuildCastleScore[getPlayerGuildName(cid)] and GuildCastleScore[getPlayerGuildName(cid)]+1 or 1 if haveCastleEventWinner() then doBroadcastMessage("[Castle_Event] A Guild " .. getGuildCastleEventWinner().. " dominou o castelo.") GuildCastleScore = {} end end end return TRUE end data/creaturescripts/creaturescripts.xml (Adicione a linha): <event type="kill" name="CastleGeneratorKill" event="script" value="CastleGenerator_Kill.lua"/> Agora va em data/creaturescripts/scripts/login.lua e procure (CTRL+F) por registerCreatureEvent voce vai achar varios bote entre eles essa linha: registerCreatureEvent(cid, "CastleGeneratorKill") data/movements/scripts/CastleSqm.lua: function onStepIn(cid, item, position, fromPosition) if getGlobalStorageValue(98741) >= 1 then if getPlayerGuildId(cid) > 0 then doPlayerSendCancel(cid, "Bem vindo ao castelo.") else doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "Voce precisa de uma guild para entrar no castelo.") end else doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "Não está acontecendo o evento ainda.") end return TRUE end data/movements/movements.xml (Adicione a linha): <movevent type="StepIn" actionid="66678" event="script" value="CastleSqm.lua"/> data/talkactions/scripts/CastleTalkaction.lua: function onSay(cid, words, param) if getGlobalStorageValue(98741) <= 0 then setGlobalStorageValue(98741, 1) doPlayerSendCancel(cid, "Voce abriu o evento do castelo.") doBroadcastMessage("[Castle_Event] O Evento de dominar o castelo esta aberto. Va e domine o castelo com sua guild.") else setGlobalStorageValue(98741, 0) return doPlayerSendCancel(cid, "Voce fexou o evento do castelo.") end return TRUE end data/talkactions/talkactions.xml (Adicione a linha): <talkaction log="yes" words="/castle" access="5" event="script" value="CastleTalkaction.lua"/> Agora adicione nos sqms da entrada do castle o actionid 66678 e bote pelo map editor 5 CASTLE GENERATORS dentro do castelo, em qualquer lugar do castelo. Para abrir o castelo eh so digitar /castle. Se voce quizer mais de 5 castle generators va no script CastleGenerator_Kill e mude: function haveCastleEventWinner() local a = 0 for i,x in pairs(GuildCastleScore) do a = a+x end return a >= 5 end Para: function haveCastleEventWinner() local a = 0 for i,x in pairs(GuildCastleScore) do a = a+x end return a >= NUMERO DE CASTLE GENERATORS end Castle Generator: <?xml version="1.0" encoding="UTF-8"?> <monster name="Castle Generator" nameDescription="a castle generator" race="undead" experience="0" speed="0" manacost="0"> <health now="100000" max="100000"/> <look typeex="9779" /> <defenses armor="10" defense="10"/> <immunities> <immunity physical="0"/> <immunity earth="0"/> <immunity death="0"/> <immunity lifedrain="0"/> <immunity paralyze="1"/> </immunities> </monster>
  7. MatheusGlad

    [Pedido]

    Mas enquanto o castelo for "virgem" ele nao vai ter dono e pode haver empate
  8. MatheusGlad

    [Pedido]

    Explique o sistema, o video esta muito cortado falta informaçoes. Exemplo: Oque acontece depois que uma guild domina o castelo? Porque o ultimo cristal eh diferente dos demais? Se der empate, oque acontece? ... Já fiz o script so falta essas informaçoes extras. Video:
  9. Nao da para entender nada que voce falou '-'
  10. Aceitando ideias para script via PM (Nao quer dizer que a sua vai ser feita)

  11. Affe ideias para script plz '-'

  12. data/actions/scripts/Alavanca.lua: function getItemCap(itemid, quant) -- function by MatheusMkalo return getItemInfo(itemid).weight*(quant or 1) end function onUse(cid, item, fromPosition, itemEx, toPosition) local items = { [2160] = 10, [2471] = 1, [2463] = 1, [2495] = 1, [9933] = 1, } local capneed = 0 for i,x in pairs(items) do capneed = capneed+getItemCap(i, x) end capneed = math.ceil(capneed)+18 if getPlayerFreeCap(cid) >= capneed then if getPlayerItemCount(cid, 12427) >= 30 then local backpack = doPlayerAddItem(cid, 2002) for i,x in pairs(items) do doAddContainerItem(backpack, i, x) end doPlayerRemoveItem(cid, 12427, 30) else return doPlayerSendCancel(cid, "You need 30 NOMEDOITEM.") end else return doPlayerSendCancel(cid, "You need " .. capneed .. " cap.") end return TRUE end data/actions/actions.xml (Adicione essa linha): <action actionid="45690" event="script" value="Alavanca.lua"/> Depois é so botar o ActionID 45690 na alavanca e pronto.
  13. Aaaa ja existem milhares de scripts sobre isso e talz mas eu tava fazendo um pedido me enrolei entendi errado e fiz merda entao eu vou postar somente porque ele tem um negocio de cap que precisa pra comprar e nao cair no chao e talz. data/actions/scripts/Alavancas.lua: function getItemCap(itemid, quant) -- function by MatheusMkalo return getItemInfo(itemid).weight*(quant or 1) end function onUse(cid, item, fromPosition, itemEx, toPosition) local configs = { [45690] = {itemid = 2160, quantperslot = 10, cost = 5, backpackid = 2002}, [45691] = {itemid = 2268, quantperslot = 50, cost = 2, backpackid = 2003}, } local coinid = 9971 -- Use o id da gold coin (2148) se voce quizer usar o sistema de dinheiro mesmo. (Caso o itemid for 2148 o cost sera de gps ou seja 30 = 30 gps) if configs[item.actionid] then if getPlayerFreeCap(cid) >= math.ceil((getItemCap(configs[item.actionid].itemid, configs[item.actionid].quantperslot)*20)+getItemCap(configs[item.actionid].backpackid)) then if coinid ~= 2148 and getPlayerItemCount(cid, coinid) >= configs[item.actionid].cost or doPlayerRemoveMoney(cid, configs[item.actionid].cost) then local backpack = doPlayerAddItem(cid, configs[item.actionid].backpackid) for i = 1, 20 do doAddContainerItem(backpack, configs[item.actionid].itemid, configs[item.actionid].quantperslot) end doPlayerRemoveItem(cid, coinid == 2148 and 0000 or coinid, configs[item.actionid].cost) else return doPlayerSendCancel(cid, ("You need " .. configs[item.actionid].cost) .. (coinid == 2148 and " gold coins" or (" " .. getItemPluralNameById(coinid):lower())) .. " to buy this item.") end else return doPlayerSendCancel(cid, "You need " .. math.ceil((getItemCap(configs[item.actionid].itemid, configs[item.actionid].quantperslot)*20)+getItemCap(configs[item.actionid].backpackid)) .. " cap for buy that.") end end return TRUE end data/actions/actions.xml (Adicione essa linha): <action actionid="45690;45691" event="script" value="Alavancas.lua"/> Configuraçao bem facil, mas como ainda tem gente que nao consegue intender entao: Negrito - Action Ids das alavancas que vao dar tals itens. (Eles devem estar na linha que voce adicionou no xml separados por ; "ponto e virgula", NAO VIRGULA, NAO PONTO, E SIM PONTO E VIRGULA O resto eu usei ingles entao acho que da pra ve, se nao souber vai testando ate consiguir champz.
  14. Nao intendi, explica denovo? Sao varias alavancas ou so 1?
  15. O maior problema seria mudar a fechadura, vou tentar fazer depois se tiver tempo.
  16. Alienado: Qual a funçao do script? Mkalo: Ela vai adicionando vida para o player ate ele ser atacado. (nao exatamente) Bem, como eu nao mexi na source pra fazer (eu nem sei como), a funçao pode ter seus fails classicos, porque ela funciona guardando a life antiga, se voce perder life e ficar com uma life menor que a life antiga, o script para. Bugs: Se voce healar sua vida com exura gran, e almentar 50 de life e voce perder 10 de life, o script nao ira parar. Function: function addHealth(cid, amount, times, interval, deny, s) return times > 0 and addEvent(function() if isCreature(cid) then if s == nil or s <= getCreatureHealth(cid) then doCreatureAddHealth(cid, amount) addHealth(cid, amount, times-1, interval, deny, getCreatureHealth(cid)) else doSendAnimatedText(getCreaturePos(cid), deny, 180) end end end, interval*1000) end Exemplo de uso: addHealth(cid, 100, 10, 2, "LOST", getCreatureHealth(cid)) o getCreatureHealth(cid) é opcional, mas impede possiveis bugs. Parametros: amount: Quanto de vida vai adicionar cada vez que for adicionar times: Quantas vezes vai adicionar vida interval: Intervalo em segundos de cada "adicionada" deny: Mensagem em vermelho que subira na cabeça do player (Max 9 letras eu acho) s: Nao use-o ou use com getCreatureHealth(cid) somente.
  17. Bem, o nome ja diz tudo, mas pra nao deixar duvidas: A função muda 2 letras de lugar, exemplo: str = "Matheus" result = letterReplace(str, 1, 5) no caso result = eathMus function letterReplace(str, place1, place2) a = place1 > place2 and place2 or place1 b = place2 < place1 and place1 or place2 return a ~= b and str:sub(1, a-1) .. str:sub(b, b) .. str:sub(a+1, b-1) .. str:sub(a, a) .. str:sub(b+1) or str end
  18. Humm... A ideia é boa mas o script podia ser melhor se voce usa-se in pairs Pra que botar function na lib? Soh sao 2 functions '-' Eu falei que ia refazer sou mal:
  19. Todos os scripts foram testados em um ot 8.6 Bem o script é auto-explicativo, e ainda tem um video do sistema, acho que nao preciso explicar o que faz ne? AGORA EM MOD, MUITO MAIS PRATICO DE INSTALAR. SE FOR USAR O MOD VA ATE O FINAL DO POST, É EXATAMENTE IGUAL A VERSAO NORMAL, SO QUE MAIS PRATICO. FUNCIONA DO MESMO JEITO. Video: obs: Veja em fullscreen para ver melhor as msgs que retornam. Vá em data/lib e adicione esse script.lua com o nome de WarArenaLib: -- [[ Area and Positions Infos ]] -- areaplayersteam = { {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1} } areateam1ext = {x=80, y=305, z=7} -- Ponta superior esquerda da area do time um areateam2ext = {x=87, y=305, z=7} -- Ponta superior esquerda da area do time dois leaderteam1pos = {x=83, y=307, z=7, stackpos=255} -- Posição do lider do time um (que puxara a alavanca) leaderteam2pos = {x=87, y=307, z=7, stackpos=255} -- Posição do lider do time dois (que puxara a alavanca) newplayersposteam1 = {x=67, y=300, z=7} -- Posição para onde os players do time um serao teleportados newplayersposteam2 = {x=67, y=330, z=7} -- Posição para onde os players do time dois serao teleportados team1leverpos = {x=84, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time um puxara team2leverpos = {x=86, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time dois puxara leverafter, leverbefore = 9825, 9826 -- Ids das alavancas antes de puxadas e depois, consecutivamente (9825 = antes; 9826 = depois) posbenterteam1 = {x=78, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 1 posbenterteam2 = {x=92, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 2 backteampos = {x=77, y=307, z=7} -- [[ Storage Infos ]] -- team1leverstorage = 123497 -- Storage que sera usado quando puxarem a alavanca do time 1 team2leverstorage = 123498 -- Storage que sera usado quando puxarem a alavanca do time 2 haveteaminarena = 123499 -- Storage que sera usado para ve se tem algum time lutando na arena storageteam1death = 123500 -- Storage usado para ver quantos morreram do time 1 storageteam2death = 123501 -- Storage usado para ver quantos morreram do time 2 storageteam1 = 123502 -- Storage usado para ver quantas pessoas entraram na arena no time 1 storageteam2 = 123503 -- Storage usado para ver quantas pessoas entraram na arena no time 2 storageleader1 = 123504 -- Storage onde ficara guardado o uid do lider do time 1 storageleader2 = 123505 -- Storage onde ficara guardado o uid do lider do time 2 storageplayersteam1 = 123506 -- Storage que todos os players do team 1 iram ter. storageplatersteam2 = 123507 -- Storage que todos os players do team 2 iram ter. -- [[ Player Infos ]] -- needlevelarena = 20 -- Level que os outros jogadores sem ser o lider teram que ter. leaderlevel = 4000 -- Level que o lider tera que ter. onlyguildwars = true -- Se os membros de um time tem que ser da mesma guild do lider. (Nesse caso somente o lider da guild podera puxar a alavanca.) needplayers = 2 -- Quantidade de players que cada time tem que ter. -- [[ Functions ]] -- function getUidsFromArea(firstpos, area) local result = {} for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then table.insert(result, getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) end end end return result end function teleportUidsToPos(uids, pos) for i,x in pairs(uids) do doTeleportThing(x, pos) end end function isAllUidsSameGuild(uids, guildid) for i,x in pairs(uids) do if not (getPlayerGuildId(x) == guildid) then return false end end return true end function isAllUidsLevel(uids, level) for i,x in pairs(uids) do if not (getPlayerLevel(x) >= level) then return false end end return true end function haveQuantPlayersInArea(firstpos, area, quant) local result = 0 for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then result = result+1 end end end return result >= quant end function addStorageToUids(uids, storage, value) for i,x in pairs(uids) do setPlayerStorageValue(x, storage, value) end end function checkPoses(pos1, pos2) if pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z then return true end return false end function startArena() setGlobalStorageValue(storageleader1, getThingFromPos(leaderteam1pos).uid) setGlobalStorageValue(storageleader2, getThingFromPos(leaderteam2pos).uid) addStorageToUids(team1uids, storageplayersteam1, 1) addStorageToUids(team2uids, storageplayersteam2, 1) teleportUidsToPos(team1uids, newplayersposteam1) teleportUidsToPos(team2uids, newplayersposteam2) setGlobalStorageValue(storageteam1, #team1uids) registerCreatureEventUids(team1uids, "DeathTeam1") registerCreatureEventUids(team2uids, "DeathTeam2") setGlobalStorageValue(storageteam2, #team2uids) setGlobalStorageValue(haveteaminarena, 1) setGlobalStorageValue(team1leverstorage, 0) setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end function haveTeamInArena() return getGlobalStorageValue(haveteaminarena) == 1 and true or false end function isSqmFromArea(firstpos, area, sqmpos) for i,x in pairs(area) do for s,z in pairs(x) do if sqmpos.x == firstpos.x+s-1 and sqmpos.y == firstpos.y+i-1 and sqmpos.z == firstpos.z then return true end end end return false end function registerCreatureEventUids(uids, event) for i,x in pairs(uids) do registerCreatureEvent(x, event) end end Agora vá em data/actions/scripts e adicione um script.lua com o nome de WarArenaLever: function onUse(cid, item, fromPosition, itemEx, toPosition) team1uids = getUidsFromArea(areateam1ext, areaplayersteam) team2uids = getUidsFromArea(areateam2ext, areaplayersteam) if haveTeamInArena() then return doPlayerSendCancel(cid, "Already have a team in arena.") end if checkPoses(toPosition, team1leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam1pos) then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) return doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team1uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team1uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team1leverstorage, 1) doTransformItem(getThingFromPos(team1leverpos).uid, leverbefore) if getGlobalStorageValue(team2leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end elseif checkPoses(toPosition, team2leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam2pos) then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) return doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team2uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team2uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team2leverstorage, 1) doTransformItem(getThingFromPos(team2leverpos).uid, leverbefore) if getGlobalStorageValue(team1leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end end return TRUE end E em actions.xml bote essa linha: <action actionid="12349" event="script" value="WarArenaLever.lua"/> Agora vá em data/creaturescripts/scripts e adicione dois scripts.lua com esses nomes: WarArenaDeathTeam1: function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam1, 0) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end WarArenaDeathTeam2: function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam2, 0) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end Agora abra o creaturescripts.xml e adicione essas linhas: <event type="death" name="DeathTeam1" event="script" value="WarArenaDeathTeam1.lua"/> <event type="death" name="DeathTeam2" event="script" value="WarArenaDeathTeam2.lua"/> Agora vá em data/movements/scripts e adicione tres scripts.lua com esses nomes: WarArenaMovement1: function onStepOut(cid, item, position, fromPosition) local team = (fromPosition.x == leaderteam1pos.x and fromPosition.y == leaderteam1pos.y and fromPosition.z == leaderteam1pos.z) and "team1" or (fromPosition.x == leaderteam2pos.x and fromPosition.y == leaderteam2pos.y and fromPosition.z == leaderteam2pos.z) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end WarArenaMovement2: function onStepIn(cid, item, position, fromPosition) local team = isSqmFromArea(areateam1ext, areaplayersteam, fromPosition) and "team1" or isSqmFromArea(areateam2ext, areaplayersteam, fromPosition) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end if getGlobalStorageValue(team1leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam1) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end elseif getGlobalStorageValue(team2leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam2) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end end end WarArenaMovement3: function onStepIn(cid, item, position, fromPosition) if getPlayerStorageValue(cid, storageplayersteam1) >= 1 then setPlayerStorageValue(cid, storageplayersteam1, 0) doTeleportThing(cid, posbenterteam1) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end elseif getPlayerStorageValue(cid, storageplayersteam2) >= 1 then setPlayerStorageValue(cid, storageplayersteam2, 0) doTeleportThing(cid, posbenterteam2) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end end return TRUE end E adicione essas linhas em movements.xml: <movevent type="StepOut" actionid="12350" event="script" value="WarArenaMovement1.lua"/> <movevent type="StepIn" actionid="12351" event="script" value="WarArenaMovement2.lua"/> <movevent type="StepIn" actionid="12352" event="script" value="WarArenaMovement3.lua"/> Pronto acabou rairiaria. Adicionando os Actions IDS: Nas 2 alavancas, adicione o actionid 12349. Nos 2 sqms que os players vao estar antes de entrar na arena adicione o actionid 12351. Nos 2 quadrados aonde os lideres irao ficar (na frente da alavanca) bote o actionid 12350. No sqm de sair da arena bote o actionid 12352. NA AREA DOS TIMES E NA ARENA, BOTE PELO MAP EDITOR PARA NAO PODER LOGAR. (Se voce nao fizer isso pode haver bugs.) Bem, se voce souber ler o script da lib, vai saber configura-lo para seu otserver. Versão MOD: (Abra o spoiler) O modo de configurar é exatamente igual ao normal. Flws. By MatheusMkalo
  20. Sim, existe para itens agrupaveis, mas nao funciona com os que nao sao, como a magic sword. Vou tentar bota pra adicionar tudo em uma bp so.
  21. function doPlayerAddManyItems(cid, itemid, quant) local amountadd, quebradinhos = math.floor(quant/100), quant%100 if not isItemStackable(itemid) then amountadd, quebradinhos = quant, quant%20 end local blabla = quebradinhos >= 1 and amountadd+1 or amountadd if blabla >= 20 then for s = 1, math.ceil(blabla/20) do local backpack = doPlayerAddItem(cid, 1988) for i = 1, amountadd do doAddContainerItem(backpack, itemid, isItemStackable(itemid) and 100 or 1) end amountadd = amountadd-20 if s == math.ceil(blabla/20) and isItemStackable(itemid) then doAddContainerItem(backpack, itemid, quebradinhos) end end else local backpack = doPlayerAddItem(cid, 1988) for i = 1, amountadd do doAddContainerItem(backpack, itemid, isItemStackable(itemid) and 100 or 1) end if isItemStackable(itemid) then doAddContainerItem(backpack, itemid, quebradinhos) end end return TRUE end Exemplo: Se voce botar doPlayerAddManyItems(cid, 2160, 4000) vai adicionar 2 bps, cada uma com 2000 crystal coins, ou seja, 20kk Exemplo2: Se voce botar doPlayerAddManyItems(cid, 2400, 41) vai adicionar 3 bps, duas com 20 magic swords e uma bp com apenas 1 magic sword Facilita um pouco.
  22. Fiz algumas modificaçoes, agora da pra usar com mais de uma letra mais ainda deve ter alguns bugs.
  23. Ela funciona como a funçao string.gsub so que nao funciona com patterns... function stringsub(s, str, repl, n) n = n ~= nil and n or "inf" lastpos = 1 for i = 1, #s do if s:sub(i, i+#str-1) == str then if n == "inf" then s = s:sub(lastpos, i-1) .. repl .. s:sub(i+#str) a = a ~= nil and a+1 or 1 else if a == nil or a < n then s = s:sub(lastpos, i-1) .. repl .. s:sub(i+#str) a = a ~= nil and a+1 or 1 else break end end end end return s , a end Eu sei que dava pra fazer usando string.find facilmente. Mas nao teria graça ne? xD
  24. Nao abandonei, mas nao mexo mais com pokemon. Pelo simples fato de eu ter postado os systems e quase ninguem ter usados.
  • Quem Está Navegando   0 membros estão online

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