Jump to content
×
×
  • Create New...
  • 0

Erro no remove creature da alavanca


carlinhoo0ww
 Share

Question

Versão do Servidor: TFS - 0.4
Tipo de Script: actions
Código:
 
-- Diiego Liima

local posInicio = {x = 1353, y = 908, z = 6} --pos inicio da sala
local posFim = {x = 1371, y = 921, z = 6}--pos final inicio da sala
local posExitTime = {x = 1358, y = 915, z = 7}-- pos para onde o player vai sair

local function verificaPlayers()
    for x = posInicio.x, posFim.x do
        for y = posInicio.y, posFim.y do
               if isPlayer(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then
                return 1
            end
        end
    end
end

local function verificaBoss()
    for x = posInicio.x, posFim.x  do
        for y = posInicio.y, posFim.y do
            if isMonster(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid) then
                doRemoveCreature(getThingFromPos({x = x, y = y, z = posInicio.z, stackpos = 253}).uid)
            end
        end
    end
end

local function removePlayersTime()
    for x = posInicio.x, posFim.x  do
        for y = posInicio.y, posFim.y do
            local remove, clean = true, true
            local pos = {x = x, y = y, z = posInicio.z}
            local m = getTopCreature(pos).uid
            if m ~= 0 and isPlayer(m) then
                doTeleportThing(m, posExitTime)
            end
        end
    end
    doSendMagicEffect(posExitTime, 10)
    return true
end

function onUse(cid, item, frompos, item2, topos)

    -- Lever Boss
    if item.aid == 2320 then -- action id da alavanca
        local playerChecked = false
        local teleportToRoom = false

        local stoExhaust = 5534241 -- staorage de segurança para exhaust
        local stoExhaustPlayer = getPlayerStorageValue(cid, stoExhaust)
        if stoExhaustPlayer > os.time() then
            doPlayerSendCancel(cid, "You have to wait " .. stoExhaustPlayer - os.time() .. " seconds to try again.")
            return true
        end
        if verificaPlayers() then
            doPlayerSendCancel(cid, "There are other players inside the room at the moment.")
            doSendMagicEffect(topos,2)
            setPlayerStorageValue(cid, stoExhaust, os.time()+5)
            return true
        end

        local config = {
            [1] = {pos = {x = 1356, y = 915, z = 7}}, --posições dos pisos
            [2] = {pos = {x = 1357, y = 915, z = 7}},
            [3] = {pos = {x = 1358, y = 915, z = 7}},
            [4] = {pos = {x = 1359, y = 915, z = 7}},
            [5] = {pos = {x = 1360, y = 915, z = 7}},
        }

        local storageTime = 5534240 -- storage de tempo
        

        for i, v in pairs(config) do
            if isPlayer(getTopCreature(config[i].pos).uid) then
                player = getTopCreature(config[i].pos).uid
                if getPlayerStorageValue(player, storageTime) > os.time() then
                    time = (getPlayerStorageValue(player, storageTime)-os.time())/60
                    str = "minutes"
                    if time > 60 then
                        time = time/60
                        str = "hours"
                        end
                    if player == cid then name = "You" else name = getCreatureName(player) end
                    doPlayerSendCancel(cid, name .. " need to wait more " .. math.floor(time+0.5) .. " " .. str .. " to do again.")
                    doSendMagicEffect(topos,2)
                    return true
                end
                if player == cid then
                    playerChecked = true
                end
            end
        end

        if playerChecked then
            for i, v in pairs(config) do
                if isPlayer(getTopCreature(config[i].pos).uid) then
                    player = getTopCreature(config[i].pos).uid
                    doSendMagicEffect(getCreaturePosition(player), 2)
                    doTeleportThing(player, {x = 1358, y = 917, z = 6}) -- posiçao que player vai cair dentro da sala
                    setPlayerStorageValue(player, storageTime, os.time()+72000) -- 20 horas
                    teleportToRoom = true
                end
            end

            if teleportToRoom then
                stopEvent(ResetArea)
                verificaBoss()
                doSendMagicEffect({x = 1357, y = 914, z = 6}, 10) -- efeito aonde o boss nasce
                doCreateMonster("Brother Freeze", {x = 1357, y = 914, z = 6}) -- onde o boss nasce
                ResetArea = addEvent(function()
                    removePlayersTime()
                end, 20 * 60 * 1000) -- tempo dentro da sala
                return false
            end
        else
            doPlayerSendCancel(cid, "Wouldn't you like to go too?")
            doSendMagicEffect(topos,2)
        end

        return true
    end

end

alguém poderia me ajudar com esse script PF

Esse script funciona como um boss room, tudo está 100%, menos a parte do remover a criatura

que ao puxar a alavanca novamente ele cria uma nova e nao remove a que está na sala

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share