Tudo que zipter98 postou
-
(Resolvido)Adicionando Wild Na Frente?
Hm, editei o código. Tente novamente.
-
[SPELL] Magia De Trap em Area
Ops. Corrigido.
-
[SPELL] Magia De Trap em Area
local config = { wallArea = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, }, effect = xxx, --Efeito. wallId = xxx, --ID da parede. time = 5, --Duração da parede. cooldown = {20, 10}, --{sucessCooldown, failCooldown}, chance = 30, --Chance da spell funcionar. storage = 9571, } function isWalkable(pos, creature, proj, pz)-- by Nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and pz then return false, true end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function getPosfromArea(cid, area) --by Dokmos icenter = math.floor(table.getn(area)/2)+1 jcenter = math.floor(table.getn(area[1])/2)+1 center = area[icenter] ivar = table.getn(area) jvar = table.getn(area[1]) i = table.getn(area)^2 j = table.getn(area[1])^2 local mydir = isCreature(getCreatureTarget(cid)) and getCreatureDirectionToTarget(cid, getCreatureTarget(cid)) or getCreatureLookDir(cid) setPlayerStorageValue(cid, 21101, -1) if center[jcenter] == 3 then if mydir == 0 then signal = {-1,1,1,2} elseif mydir == 1 then signal = {1,-1,2,1} elseif mydir == 2 then signal = {1,-1,1,2} elseif mydir == 3 then signal = {-1,1,2,1} end else signal = {-1,1,1,2} end POSITIONS = {} P = 0 repeat pvar = {0,0} I = area[ivar] J = I[jvar] i = i-1 j = j-1 if J == 1 then if jvar < jcenter then pvar[signal[3]] = signal[1]*math.abs((jcenter-jvar)) elseif jvar > jcenter then pvar[signal[3]] = signal[2]*math.abs((jcenter-jvar)) end if ivar < icenter then pvar[signal[4]] = signal[1]*math.abs((icenter-ivar)) elseif ivar > icenter then pvar[signal[4]] = signal[2]*math.abs((icenter-ivar)) end end if jvar > 1 then jvar = (jvar-1) elseif ivar > 1 then jvar = table.getn(area[1]) ivar = (ivar-1) end local pos = getThingPos(cid) local areapos = {x=pos.x+(pvar[1]),y=pos.y+(pvar[2]),z=pos.z} if pos.x ~= areapos.x or pos.y ~= areapos.y then P = P+1 POSITIONS[P] = areapos end until i <= 0 and j <= 0 return POSITIONS end function onCastSpell(cid) if getPlayerStorageValue(cid, config.storage) > os.time() then doPlayerSendCancel(cid, "Wait "..getPlayerStorageValue(cid, config.storage) - os.time().." second(s).") else if math.random(1, 100) > config.chance then doPlayerSendCancel(cid, "Your spell failed.") doSendAnimatedText(getThingPos(cid), "FAIL!", 215) setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown[2]) else local positions = {} setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown[1]) for _, pos in pairs(getPosfromArea(cid, config.wallArea)) do if isWalkable(pos) and not getTileInfo(pos).protection then doCreateItem(config.wallId, 1, pos) doSendMagicEffect(pos, config.effect) table.insert(positions, pos) end end if #positions > 0 then addEvent(function() for i = 1, #positions do local item = getTileItemById(positions[i], config.wallId).uid if item > 0 then doRemoveItem(item) end end end, config.time * 1000) end end end return true end
-
(Resolvido)Adicionando Wild Na Frente?
Troque o código da função ShinyName por este: local function ShinyName(cid) if isCreature(cid) then local newName = "Wild "..getCreatureName(cid) if string.find(tostring(getCreatureName(cid)), "Shiny") then newName = newName:gsub("Shiny ", "") end doCreatureSetNick(cid, newName) if isMonster(cid) then doSetCreatureDropLoot(cid, false) end end end
-
!Items
local items = {{itemid, count}, {itemid, count}, {itemid, count}, ...} --{{ID_do_item, quantia_requerida}, {ID_do_item, quantia_requerida}, ...} function onSay(cid) local str = "" for _, item in pairs(items) do if str == "" then str = getItemNameById(item[1]).." - ["..getPlayerItemCount(cid, item[1]).."/"..item[2].."]" else str = str.."\n"..getItemNameById(item[1]).." - ["..getPlayerItemCount(cid, item[1]).."/"..item[2].."]" end end doPlayerPopupFYI(cid, "You have:\n"..str) return true end
-
[Pedido]Sistema de Loteria
Ah sim, não tinha visto isso. Erro corrigido. Já as outras modificações em ambas as versões do código, só terei meios de fazer quando tiver acesso a um notebook ou computador (que não é o caso). E poderia postar o código do NPC Banco? Ajudaria muito, visto que eu poderia sazer qual a função utilizada para depósitos.
-
[Pedido]Sistema de Loteria
Não conheço as funções do banco. Se esta não funcionou, então não sei. Sobre o nome não aparecer, alterei o da primeira página e esqueci desta. Corrigido. Já quando o comando é usado sem dinheiro, erros no console?
-
[Pedido]Sistema de Loteria
Corrigido.
-
[Pedido]Sistema de Loteria
Ops, como testei a loteria com apenas um vencedor, não presenciei este erro. Enfim, corrigido. Sobre as outras alterações, as farei e editarei os códigos. EDIT: Pronto, códigos alterados. Não se esqueça de adicionar a nova função.
-
[Pedido]Sistema de Loteria
Globalevent: local config = { cash = xxx, --Valor inicial da loteria. limit = {1, 200}, --Número mínimo e máximo da loteria. numbers = 3, --Quantos números o player deve escolher. startTime = 5, --Tempo para as apostas serem fechadas/anunciar vencedor, em minutos. messages = { --Mensagens. "A loteria está aberta, façam suas apostas! Tempo até fechar: %d minuto(s).\nDinheiro acumulado até agora: %s.", "A loteria está fechada!\nPrêmio (individual): %s gold. Vencedor%s: %s.", "Sem vencedores na loteria!\nDinheiro acumulado [total]: %s gold.", }, storages = {9571, 9572, 9573}, } function onThink() setGlobalStorageValue(config.storages[1], 1) if getGlobalStorageValue(config.storages[2]) < 0 then setGlobalStorageValue(config.storages[2], config.cash) end broadcastMessage(config.messages[1]:format(config.startTime, pointNumber(getGlobalStorageValue(config.storages[2]))), MESSAGE_INFO_DESCR) for i = 1, config.startTime do addEvent(function() if i ~= config.startTime then broadcastMessage(config.messages[1]:format(config.startTime - i), MESSAGE_INFO_DESCR) else local sortedNumbers = {} for i = 1, config.numbers do local value = math.random(config.limit[1], config.limit[2]) if isInArray(sortedNumbers, value) then while isInArray(sortedNumbers, value) do value = math.random(config.limit[1], config.limit[2]) end end table.insert(sortedNumbers, value) end setGlobalStorageValue(config.storages[1], -1) local winners, str = getLotteryWinners(sortedNumbers, config.numbers), "" local prize = math.floor(getGlobalStorageValue(config.storages[2]) / #winners) if #winners > 0 then for i = 1, #winners do if str == "" then str = getCreatureName(winners[i]) else str = str..(i == #winners and " e " or ", ")..getCreatureName(winners[i]) end end end if str == "" then broadcastMessage(config.messages[3]:format(pointNumber(getGlobalStorageValue(config.storages[2]))), MESSAGE_INFO_DESCR) else broadcastMessage(config.messages[2]:format(pointNumber(prize), #winners > 1 and "es" or "", str), MESSAGE_INFO_DESCR) setGlobalStorageValue(config.storages[2], -1) for i = 1, #winners do if isPlayer(winners[i]) then doPlayerDepositMoney(winners[i], prize) doPlayerSendTextMessage(winners[i], MESSAGE_STATUS_CONSOLE_ORANGE, "Por vencer a loteria, você recebeu: "..prize.." gold.") end end end resetStorage(config.storages[3], config.numbers) end end, i * 60 * 1000) end return true end Talkaction: local config = { limit = {1, 200}, --Número mínimo e máximo da loteria. numbers = 3, --Quantos números o player deve escolher. price = xxx, --Preço para participar da loteria. storages = {9571, 9572, 9573}, } function onSay(cid, words, param) if getGlobalStorageValue(config.storages[1]) < 1 then doPlayerSendCancel(cid, "A loteria está fechada.") elseif getPlayerStorageValue(cid, config.storages[3]) ~= -1 then doPlayerSendCancel(cid, "Você já fez sua aposta.") elseif param == "" then doPlayerSendCancel(cid, "!apostar number1 number2 number3") elseif getPlayerMoney(cid) < config.price then doPlayerSendCancel(cid, "Você precisa de, no mínimo, "..config.price.." gold para apostar.") else local numbers = param:explode(" ") if #numbers ~= config.numbers then doPlayerSendCancel(cid, "Escolha "..config.numbers.." números, entre "..config.limit[1].." - "..config.limit[2]..".") else local str = "" for i = 1, #numbers do numbers[i] = tonumber(numbers[i]) if not numbers[i] or numbers[i] < config.limit[1] or numbers[i] > config.limit[2] then return doPlayerSendCancel(cid, "Escolha números válidos ["..config.limit[1].." - "..config.limit[2].."].") end if str == "" then str = numbers[i] else str = str..(i == #numbers and " e " or ", ")..numbers[i] end end doPlayerRemoveMoney(cid, config.price) doPlayerSendTextMessage(cid, 27, "Você escolheu os números: "..str..".") for i = 0, config.numbers - 1 do setPlayerStorageValue(cid, config.storages[3] + i, numbers[i + 1]) end addGlobalStorageValue(config.storages[2], config.price) end end return true end Em 050-function.lua (data/lib), adicione mais esta função: function pointNumber(number) if not number or not tonumber(number) then return false end local d = tostring(number):reverse() local z = {} for i = 1, d:len(), 3 do table.insert(z, d:sub(i, i + 2)) end return table.concat(z, "."):reverse() end
-
[Pedido]Sistema de Loteria
Use o novo código, como informei no meu comentário anterior. Testei o sistema como foi pedido pelo autor, e funcionou perfeitamente. Poderia dar mais detalhes sobre a personalização que você pediu do código?
-
[Pedido]Sistema de Loteria
O primeiro erro já corrigi faz tempo, mas esqueci de alterar no código que postei (função addGlobalStorageValue). Sobre o segundo, ainda estou vendo o que é. EDIT: Devido a um erro chato que não estou com paciência de corrigir adequadamente, refiz algumas coisas no sistema. Se possível, substituam a antiga versão por esta nova. Agora vai funcionar tudo como deve, espero.
-
(Resolvido)Remover pedra, alavanca+iten
Ah, suponho que este código não funcione em versões mais novas. Como ainda não comecei a estudar suas funções, recomendo esperar alguma boa alma adaptar meu script.
-
(Resolvido)Remover pedra, alavanca+iten
Versão?
-
[Pedido]Sistema de Loteria
Ops, falta de atenção minha este erro. Inicialmente, pretendia deixar as funções no mesmo arquivo do globalevent. Por isso, esqueci de alterar uma informação. Código corrigido. Apenas coincidência. Para deixar 4 números (ou mais, ou menos), altere o item numbers, da tabela config. Sobre a alteração na talkaction, primeiramente deixarei este código totalmente funcional. Depois, farei esta modificação para você. Já a mensagem de fechamento, basta alterá-la no item messages, na tabela config (globalevent, apenas).
-
(Resolvido)Remover pedra, alavanca+iten
local config = { wall = { time = 5, --Tempo, em minutos, para a parede reaparecer. id = xxx, --ID da wall. pos = {x = x, y = y, z = z}, --Posição da wall. }, items = { {{x = x, y = y, z = z}, itemid}, --{{posição que o item deve estar}, itemid}, {{x = x, y = y, z = z}, itemid}, {{x = x, y = y, z = z}, itemid}, {{x = x, y = y, z = z}, itemid}, {{x = x, y = y, z = z}, itemid}, }, } function onUse(cid) local wall = getTileItemById(config.wall.pos, config.wall.id).uid if wall < 1 then return doPlayerSendCancel(cid, "The wall is already openned.") end for _, item in pairs(config.items) do if getTileItemById(item[1], item[2]).uid < 1 then return doPlayerSendCancel(cid, "One or more items are missing or aren't in the correct position.") end end doRemoveItem(wall) addEvent(function() doCreateItem(config.wall.id, 1, config.wall.pos) end, config.wall.time * 60 * 1000) return true end
-
[Pedido]Sistema de Loteria
Em data/lib/050-function.lua, coloque as seguintes funções: function compareTables(c, d) for i = 1, #c do if not isInArray(d, c[i]) then return false end end return true end function addGlobalStorageValue(key, addValue) local result = db.getResult("SELECT value FROM global_storage WHERE key = "..key) setGlobalStorageValue(key, getGlobalStorageValue(key) + addValue) if result:getID() ~= -1 then db.executeQuery("UPDATE global_storage SET value = value + "..addValue.." WHERE key = "..key) result:free() else db.executeQuery("INSERT INTO global_storage VALUES ("..key..", 0, "..addValue..")") end end function resetStorage(key, count) local result = db.getResult("SELECT id FROM players WHERE online < 1") if result:getID() ~= -1 then repeat for i = 0, count - 1 do db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..key + i.." AND player_id = "..result:getDataInt("id").." AND value != -1") end until not result:next() result:free() end for _, pid in pairs(getPlayersOnline()) do for i = 0, count - 1 do if getPlayerStorageValue(pid, key + i) ~= -1 then setPlayerStorageValue(pid, key + i, -1) end end end end function getLotteryWinners(n, count) local baseStorage, winners, cidNumbers = 9573, {}, {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, baseStorage) ~= -1 then cidNumbers[cid] = {} for i = 0, count - 1 do table.insert(cidNumbers[cid], getPlayerStorageValue(cid, baseStorage + i)) end if compareTables(cidNumbers[cid], n) then table.insert(winners, cid) end end end return winners end Depois, em data/globalevents/scripts: local config = { limit = {1, 200}, --Número mínimo e máximo da loteria. numbers = 3, --Quantos números o player deve escolher. startTime = 5, --Tempo para as apostas serem fechadas/anunciar vencedor, em minutos. messages = { --Mensagens. "A loteria está aberta, façam suas apostas! Tempo até fechar: %d minuto(s).", "A loteria está fechada!\nPrêmio (individual): %d gold. Vencedor%s: %s.", "Sem vencedores na loteria!\nDinheiro acumulado [total]: %d gold.", }, storages = {9571, 9572, 9573}, } function onThink() broadcastMessage(config.messages[1]:format(config.startTime), MESSAGE_INFO_DESCR) setGlobalStorageValue(config.storages[1], 1) if getGlobalStorageValue(config.storages[2]) < 0 then setGlobalStorageValue(config.storages[2], 0) end for i = 1, config.startTime do addEvent(function() if i ~= config.startTime then broadcastMessage(config.messages[1]:format(config.startTime - i), MESSAGE_INFO_DESCR) else local sortedNumbers = {} for i = 1, config.numbers do local value = math.random(config.limit[1], config.limit[2]) if isInArray(sortedNumbers, value) then while isInArray(sortedNumbers, value) do value = math.random(config.limit[1], config.limit[2]) end end table.insert(sortedNumbers, value) end setGlobalStorageValue(config.storages[1], -1) local winners, str = getLotteryWinners(sortedNumbers, config.numbers), "" local prize = math.floor(getGlobalStorageValue(config.storages[2]) / #winners) if #winners > 0 then for i = 1, #winners do if str == "" then str = getCreatureName(winners[i]) else str = str..(i == #winners and " e " or ", ")..getCreatureName(winners[i]) end end end if str == "" then broadcastMessage(config.messages[3]:format(getGlobalStorageValue(config.storages[2])), MESSAGE_INFO_DESCR) else broadcastMessage(config.messages[2]:format(prize, #winners > 1 and "es" or "", str), MESSAGE_INFO_DESCR) setGlobalStorageValue(config.storages[2], -1) for i = 1, #winners do if isPlayer(winners[i]) then doPlayerAddMoney(winners[i], prize) doPlayerSendTextMessage(winners[i], MESSAGE_STATUS_CONSOLE_ORANGE, "Por vencer a loteria, você recebeu: "..prize.." gold.") end end end resetStorage(config.storages[3], config.numbers) end end, i * 60 * 1000) end return true end Tag: <globalevent name="Loteria" interval="10800" event="script" value="nome_do_arquivo.lua"/> Já em data/talkactions/scripts: local config = { limit = {1, 200}, --Número mínimo e máximo da loteria. numbers = 3, --Quantos números o player deve escolher. minCash = 5000, --Quantia mínima para apostar. storages = {9571, 9572, 9573}, } function onSay(cid, words, param) if getGlobalStorageValue(config.storages[1]) < 1 then doPlayerSendCancel(cid, "A loteria está fechada.") elseif getPlayerStorageValue(cid, config.storages[3]) ~= -1 then doPlayerSendCancel(cid, "Você já fez sua aposta.") elseif param == "" then doPlayerSendCancel(cid, "!apostar cash,number1 number2 number3") elseif getPlayerMoney(cid) < config.minCash then doPlayerSendCancel(cid, "Você precisa de, no mínimo, "..config.minCash.." gold para apostar.") else param = param:explode(",") if #param ~= 2 then doPlayerSendCancel(cid, "!apostar cash,number1 number2 number3") else local cash, numbers = tonumber(param[1]), param[2]:explode(" ") if not cash then doPlayerSendCancel(cid, "Aposte uma quantia númerica.") elseif cash < config.minCash then doPlayerSendCancel(cid, "Esta quantia é muito pequena. Min. gold: "..config.minCash..".") elseif getPlayerMoney(cid) < cash then doPlayerSendCancel(cid, "Aposte uma quantia que você tenha.") else if not numbers or #numbers ~= config.numbers then doPlayerSendCancel(cid, "Escolha "..config.numbers.." números, entre "..config.limit[1].." - "..config.limit[2]..".") else local str = "" for i = 1, #numbers do numbers[i] = tonumber(numbers[i]) if not numbers[i] or numbers[i] < config.limit[1] or numbers[i] > config.limit[2] then return doPlayerSendCancel(cid, "Escolha números válidos ["..config.limit[1].." - "..config.limit[2].."].") end if str == "" then str = numbers[i] else str = str..(i == #numbers and " e " or ", ")..numbers[i] end end doPlayerRemoveMoney(cid, cash) doPlayerSendTextMessage(cid, 27, "Você apostou "..cash.." gold e escolheu os números: "..str..".") for i = 0, config.numbers - 1 do setPlayerStorageValue(cid, config.storages[3] + i, numbers[i + 1]) end addGlobalStorageValue(config.storages[2], cash) end end end end return true end Tag: <talkaction words="!apostar" event="script" value="nome_do_arquivo.lua"/> Comando: !apostar cash,number1 number2 number3 Ex.: !apostar 450000,78 43 185
-
[Pedido]Sistema de Loteria
Há uma quantia mínima para apostar? E, num mesmo comando, o jogador escolheria os 3 números + a quantia que pretende apostar? Ou o dinheiro que deve ser apostado é constante? Digo, o mesmo para todos?
-
[Pedido]Sistema de Loteria
E se tiver mais de um ganhador?
-
(Resolvido)Remover pedra, alavanca+iten
A ordem dos items faz diferença? Digo, cada item deve estar em sua posição específica?
-
(Resolvido)[PEDIDO] Uma arma, várias munições.
Quando você tenta atirar de longe no target, o que acontece? O jogador anda até ele ou aparece alguma mensagem? Sobre os efeitos, eu nunca mexi com conditions no Tibia. Qualquer coisa, eu procuro depois como elas funcionam e altero o código.
-
(Resolvido)Anunciar quando nascer o monstro !
local shinys = { "Venusaur", "Charizard", "Blastoise", "Butterfree", "Beedrill", "Pidgeot", "Rattata", "Raticate", "Raichu", "Zubat", "Golbat", "Paras", "Parasect", "Venonat", "Venomoth", "Growlithe", "Arcanine", "Abra", "Alakazam", "Tentacool", "Tentacruel", "Farfetch'd", "Grimer", "Muk", "Gengar", "Onix", "Krabby", "Kingler", "Voltorb", "Electrode", "Cubone", "Marowak", "Hitmonlee", "Hitmonchan", "Tangela", "Horsea", "Seadra", "Scyther", "Jynx", "Electabuzz", "Pinsir", "Magikarp", "Gyarados", "Snorlax", "Dragonair", "Dratini"} local raros = {"Dragonite"} local mName = "name" --Nome do monstro que será anunciado ao nascer. local function ShinyName(cid) if isCreature(cid) then if string.find(tostring(getCreatureName(cid)), "Shiny") then local newName = tostring(getCreatureName(cid)):match("Shiny (.*)") doCreatureSetNick(cid, newName) if isMonster(cid) then doSetCreatureDropLoot(cid, false) end end end end local function doSetRandomGender(cid) if not isCreature(cid) then return true end if isSummon(cid) then return true end local gender = 0 local name = getCreatureName(cid) if not newpokedex[name] then return true end local rate = newpokedex[name].gender if rate == 0 then gender = 3 elseif rate == 1000 then gender = 4 elseif rate == -1 then gender = 0 elseif math.random(1, 1000) <= rate then gender = 4 else gender = 3 end doCreatureSetSkullType(cid, gender) end local function doShiny(cid) if isCreature(cid) then if isSummon(cid) then return true end if getPlayerStorageValue(cid, 74469) >= 1 then return true end if getPlayerStorageValue(cid, 22546) >= 1 then return true end if isNpcSummon(cid) then return true end if getPlayerStorageValue(cid, 637500) >= 1 then return true end --alterado v1.9 if isInArray(shinys, getCreatureName(cid)) then --alterado v1.9 \/ chance = 6 --1% chance elseif isInArray(raros, getCreatureName(cid)) then --n coloquem valores menores que 0.1 !! chance = 6 --1% chance else return true end if math.random(1, 1000) <= chance*10 then doSendMagicEffect(getThingPos(cid), 18) local name, pos = "Shiny ".. getCreatureName(cid), getThingPos(cid) doRemoveCreature(cid) local shi = doCreateMonster(name, pos, false) setPlayerStorageValue(shi, 74469, 1) else setPlayerStorageValue(cid, 74469, 1) end --/\ else return true end end function onSpawn(cid) registerCreatureEvent(cid, "Experience") registerCreatureEvent(cid, "GeneralConfiguration") registerCreatureEvent(cid, "DirectionSystem") registerCreatureEvent(cid, "CastSystem") if isSummon(cid) then registerCreatureEvent(cid, "SummonDeath") return true end if getCreatureName(cid) == mName then broadcastMessage(mName.." spawned!") end addEvent(doSetRandomGender, 5, cid) addEvent(doShiny, 10, cid) addEvent(ShinyName, 15, cid) addEvent(adjustWildPoke, 5, cid) return true end
-
(Resolvido)Anunciar quando nascer o monstro !
Pode postar o conteúdo do arquivo spawn.lua (data/creaturescripts/scripts)?
-
Remover X Item em X quantidades de todos os players do OT
nvm já postaram
-
(Resolvido)[PEDIDO] Uma arma, várias munições.
local ar1 = createCombatArea{ {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 1, 3, 1, 0, 0}, {0, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0} } local ar2 = createCombatArea{ {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, {1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1}, {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0} } local ar3 = createCombatArea{ {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 1, 1, 1, 1, 0, 0}, {0, 0, 1, 1, 3, 1, 1, 0, 0}, {0, 0, 1, 1, 1, 1, 1, 0, 0}, {0, 0, 0, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0} } function doPlayerShootBazooka(cid, target, times, delay, area, min, max, effect, dist_effect, exhaust, rounds) if rounds == nil then rounds = 1 end exhaustion.set(cid, 57193, exhaust) doSendDistanceShoot(getCreaturePosition(cid), getThingPos(target), dist_effect) doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, getThingPos(target), area, -min, -max, effect) if rounds == times then return true end addEvent(doPlayerShootBazooka, shots_delay, cid, target, times, delay, area, min, max, effect, dist_effect, exhaust, rounds+1) end function onUse(cid, item, fromPosition, itemEx, toPosition) local weapons = { -- [ID da arma] = {tiros, delay_dos_tiros, ammo, area, dano_min, dano_max, efeito, distance_effect, exhaustion}, [2449] = { shots = 1, shots_delay = 50, area = ar1, exha = 5, ammo = { --Configure aqui as munições da arma. [11399] = {min = 25600, max = 35720, effect = 23, dist_effect = 35}, [itemid] = {min = minDamage, max = maxDamage, effect = effect, dist_effect = distanceEffect}, [itemid] = {min = minDamage, max = maxDamage, effect = effect, dist_effect = distanceEffect}, [itemid] = {min = minDamage, max = maxDamage, effect = effect, dist_effect = distanceEffect}, }, }, } local gun = weapons[item.itemid] if gun then if getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid ~= item.itemid then doPlayerSendCancel(cid, "O lançador deve estar equipado no slot da arma.") return true elseif getPlayerStorageValue(cid, 18391) == 1 then doPlayerSendCancel(cid, "Você não pode atirar enquanto dirige.") return true elseif getPlayerStorageValue(cid, 18393) == 1 then doPlayerSendCancel(cid, "Você não pode atirar com o capacete.") return true elseif exhaustion.check(cid, 57193) then doPlayerSendCancel(cid, "Você está exausto.") return true elseif getPlayerSlotItem(cid, CONST_SLOT_AMMO).uid < 1 then return doPlayerSendCancel(cid, "A munição deve estar equipada no slot da munição.") elseif not gun.ammo[getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid] then return doPlayerSendCancel(cid, "Wrong ammo for this gun.") elseif getPlayerItemCount(cid, getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid) < gun.shots then doPlayerSendCancel(cid, "Você não possui munição.") return true end local ammo = gun.ammo[getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid] doPlayerRemoveItem(cid, getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid, gun.shots) doPlayerShootBazooka(cid, itemEx.uid, gun.shots, gun.shots_delay, gun.area, ammo.min, ammo.max, ammo.effect, ammo.dist_effect, gun.exha) end return true end