Ir para conteúdo
  • 0

Arruma fishing


Amantezinho

Pergunta

E ai galera, precisava de uma ajuda nesse script:

 

  • Colocar para trocar de outfit ao usar o item (estilo PXG, homem troca pra tal, mulher para tal)
  • Quando terminar de pescar, volta para a outfit anterior
  • Impedir que o player se mova enquanto pesca

 

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, 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)
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

 

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0
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.

Editado por Antharaz
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...