Líderes
Conteúdo Popular
Exibindo conteúdo com a maior reputação em 10/30/15 em %
-
Monster Hunter Event Como não tive tempo para trazer um script semana passada, criei um bem legal para essa semana. Para ver os outros scripts de terça, clique aqui. Vídeo demonstrativo: Explicação detalhada: O evento possui duas versões: automática (globalevent) e manual (talkaction). Quando o evento inicia, é sorteado um monstro e um intervalo de tempo, por exemplo: Hydra e 15 minutos. Seguindo esse exemplo, os jogadores terão 15 minutos para matar hydras, no final dos 15 minutos, aquele que tiver matado mais hydras será o vencedor e receberá um prêmio. - É tudo configurável. Instalação: Crie Monster Hunter.lua em data/creaturescripts/scripts e coloque: -- Monster Hunter Event feito por Killua, XTibia.com function onKill(cid, target, lastHit) if isPlayer(cid) and isMonster(target) then if getCreatureMaster(target) ~= nil then return true end local name = getGlobalStorageValue(1919211) if string.lower(getCreatureName(target)) == string.lower(name) then doPlayerSetStorageValue(cid, 1814210, getPlayerStorageValue(cid, 1814210) + 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Monster Hunter Event] Voce ja matou "..getPlayerStorageValue(cid, 1814210).." "..name.."s! Continue matando para ser o vencedor!") end end return true end function onLogin(cid) if getGlobalStorageValue(1919211) == 0 then doPlayerSetStorageValue(cid, 1814210, 0) end registerCreatureEvent(cid, "Monster Hunter") return true end Em data/creaturescripts/creaturescripts.xml adicione essas TAGs: <event type="kill" name="Monster Hunter" event="script" value="Monster Hunter.lua"/> <event type="login" name="Monster Hunterl" event="script" value="Monster Hunter.lua"/> A próxima parte irá depender de qual versão escolher Versão manual (talkaction) Versão automática (globalevent) Configuração: local monsters = {"Demon", "Rat", "Hydra", "Dragon Lord", "Ancient Scarab"} -- Monstros que podem ser sorteados local time_min, max = 10, 15 -- Em minutos local premios, gold = {{2160, 10}, {2157, 5}}, 10000 -- {id do item, quantidade} que o jogador ganha e quantia de gold Em monsters, coloque o nome dos monstros que poderão ser sorteados no evento. Em time_min, max, coloque o tempo mínimo e o tempo máximo de duração do evento. em premios, gold adicione os itens e a quantidade de gold que o vencedor receberá (seguindo o modelo apresentado). TAG no Globalevents.xml (versão automática): <globalevent name="Monster Hunter Event" interval="3600000" event="script" value="Monster Hunter.lua"/> interval é o intervalo entre as execuções do evento, coloquei 3600000, que equivale a 1 hora (1000 = 1 segundo). Se seu servidor NÃO for em milissegundos, use 1 = 1 segundo, logo 1 hora = 3600. TAG no Talkactions.xml (versão manual): <talkaction log="yes" access="5" words="/monsterhunter" event="script" value="Monster Hunter.lua"/> Em access coloque o núemero de acesso mínimo para poder usar o comando. 5 = somente gods podem usar. Para iniciar o evento na maneira manual, basta usar /monsterhunter Para iniciar o evento na maneira automática, basta aguardar o tempo configurado.1 ponto
-
Arruma fishing
Amantezinho reagiu a Antharaz por uma questão
local outfit = {{[1]= {lookType = 223 , lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}, [2]={lookType = 222 , lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}}, TEMPO = 5000} local waterIDs = {11673, 11675} local config = { {level = {10,15}, fishes = {12087}, maxFish = 1, chance = 40}, -- {level = {Do level, Até o level}, fishes = {id dos peixes que podem vir}, maxFish = quantidade máxima de peixes que podem vir, chance = chance em % {level = {16,20}, fishes = {12087}, maxFish = 1, chance = 50}, {level = {21,25}, fishes = {12087}, maxFish = 2, chance = 55}, {level = {26,35}, fishes = {12087}, maxFish = 2, chance = 60}, {level = {36,59}, fishes = {12087}, maxFish = 2, chance = 70}, {level = {60,69}, fishes = {12087}, maxFish = 3, chance = 70}, {level = {70,79}, fishes = {12087}, maxFish = 3, chance = 80}, {level = {80,math.huge}, fishes = {12087}, maxFish = 3, chance = 85} } function onUse(cid, item, fromPosition, itemEx, toPosition) local worms = math.random(1, 1) if getPlayerStorageValue(cid, 381921) < os.time() then if isInArray(waterIDs, itemEx.itemid) then if getPlayerItemCount(cid, 12073) >= worms then doPlayerRemoveItem(cid, 12073, worms) doSendMagicEffect(toPosition, 1) local times = {3900, 4100, 4300, 4500, 4700, 4900, 5000} for i = 1, #times do addEvent(doSendMagicEffect, times[i], toPosition, 1) end addEvent(function() local random = math.random(1, 100) for _, fishing in pairs(config) do if random <= fishing.chance then if getPlayerSkillLevel(cid, 6) >= fishing.level[1] and getPlayerSkillLevel(cid, 6) <= fishing.level[2] then doPlayerAddItem(cid, fishing.fishes[math.random(1, #fishing.fishes)], math.random(1, fishing.maxFish)) doPlayerAddSkillTry(cid, 6, 6) doSendMagicEffect(toPosition, 53) break end else doSendMagicEffect(toPosition, 25) doPlayerAddSkillTry(cid, 6, 1) end end end, 4000) doPlayerSetStorageValue(cid, 381921, os.time() + 5) local sex = getPlayerSex(cid) local out = outfit[1][sex] doSetCreatureOutfit(cid,out, outfit.TEMPO) mayNotMove(cid,true) addEvent(mayNotMove, outfit.TEMPO, cid, false) else doPlayerSendCancel(cid, "You need more worms!") end else doPlayerSendCancel(cid, "You can't fish here") end else doPlayerSendCancel(cid, "You're already fishing!") end return true end Em [1]= {lookType = 223 , lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0} você coloca o outfit para sex 1, em [2]={lookType = 222 , lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0} coloca o outfit para sex 2 e em TEMPO = 5000 coloca o tempo que dura a pesca.1 ponto -
converter código em uma função ajuda
Bennyhappy reagiu a Antharaz por uma questão
Na verdade, eu só botei return total no final, antes do último end e deu certo... deste seu jeito vai retornar apenas o valor do primeiro item porque você deixou o return dentro do loop. local slots = { ['head'] = CONST_SLOT_HEAD, ['armor'] = CONST_SLOT_ARMOR, ['legs'] = CONST_SLOT_LEGS, ['feet'] = CONST_SLOT_FEET, ['left'] = CONST_SLOT_LEFT, ['right'] = CONST_SLOT_RIGHT } local itemSlots, total = {}, 0 function getPlayerProtection(cid, param) for slot, const in pairs(slots) do local hasItemOn = getPlayerSlotItem(cid, const).uid if hasItemOn ~= 0 then itemSlots[slot] = hasItemOn end end for slot, slottedItem in pairs(itemSlots) do local temp = getItemAttribute(slottedItem, param) total = total + (temp ~= nil and temp or 0 ) end return total end No TFS 0.3.7 funcionou...1 ponto -
converter código em uma função ajuda
Bennyhappy reagiu a Antharaz por uma questão
local slots = { ['head'] = CONST_SLOT_HEAD, ['armor'] = CONST_SLOT_ARMOR, ['legs'] = CONST_SLOT_LEGS, ['feet'] = CONST_SLOT_FEET, ['left'] = CONST_SLOT_LEFT, ['right'] = CONST_SLOT_RIGHT } local itemSlots, total = {}, 0 function getPlayerProtection(cid, param) for slot, const in pairs(slots) do local hasItemOn = getPlayerSlotItem(cid, const).uid if hasItemOn ~= 0 then itemSlots[slot] = hasItemOn end end for slot, slottedItem in pairs(itemSlots) do local temp = getItemAttribute(slottedItem, param) total = total + (temp ~= nil and temp or 0 ) end end Transformando somente em function é isto...1 ponto -
Isso de "a so passo as sources bla, bla ,bla" já e meio chato.Vamos imaginar ja tem a base das souces do dash a 5 anos vazado na net essas funçoes que vc coloco ja tem em varios link entao qualquer um com um minimo de inteligencia pode adicionar todas as funçoes nas souces sem precisar disso aqueles que nao tem capacidade disso vai querer o que com as sources? Mas cada um e cada um. E quem quiser as sources do dash e querer aprender ou então meter a cara e deixar de ficar esperando pelos outros eu tenho uma aqui limpa do Ricardo de 5 anos atrás só me mandar pm e final de semana eu passo. Não estou aqui pra discutir com o dono do tópico, ele faz o que quiser e só minha opinião.1 ponto
-
(Duvida) OtClient
Gokussj5 reagiu a BananaFight por uma questão
pra tirar port ip é aqui > otclient\modules\client_entergame\entergame.lua embaixo de : if g_app.isRunning() and not g_game.isOnline() then enterGame:show() end Adc isso: EnterGame.setUniqueServer(hostName, port, protocolVersion, windowWidth, windowHeight) EnterGame.setUniqueServer('127.0.0.1', 7171, 862, 270, 210)1 ponto
Líderes está configurado para São Paulo/GMT-03:00
