local function onLoadPVPRoom(cid, step) local player = Player(cid) if player then local A = Game.getStorageValue(_PVP_ROOM[01].CONTAGEM_PLAYER) or 0 local B = Game.getStorageValue(_PVP_ROOM[02].CONTAGEM_PLAYER) or 0 local C = Game.getStorageValue(_PVP_ROOM[03].CONTAGEM_PLAYER) or 0 local D = Game.getStorageValue(_PVP_ROOM[04].CONTAGEM_PLAYER) or 0 local E = Game.getStorageValue(_PVP_ROOM[05].CONTAGEM_PLAYER) or 0 local F = Game.getStorageValue(_PVP_ROOM[06].CONTAGEM_PLAYER) or 0 if step == 00 then player:sendCancelMessage("@LoadPVP 01 " ..A.. " " ..B.. " " ..C.. " " ..D.. " " ..E.. " " ..F) return false end if step == 01 then if EnableLoad then local players = Game.getPlayers() for _, targetPlayer in ipairs(players) do targetPlayer:sendCancelMessage("@LoadPVP 01 " ..A.. " " ..B.. " " ..C.. " " ..D.. " " ..E.. " " ..F) end else onLoadPVPRoom(player, 00) end return false end end return false end function onStepIn(creature, item, position, fromPosition) if creature:isPlayer() then local PVP_ROOM = creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) if PVP_ROOM > 00 then if PVP_ROOM == 02 then if creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == 01 then creature:teleportTo(_PVP_ROOM[PVP_ROOM].ARENA_POS[05]) else creature:teleportTo(_PVP_ROOM[PVP_ROOM].ARENA_POS[06]) end elseif PVP_ROOM == 03 then if creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == 01 then creature:teleportTo(_PVP_ROOM[PVP_ROOM].ARENA_POS[01]) else creature:teleportTo(_PVP_ROOM[PVP_ROOM].ARENA_POS[02]) end elseif PVP_ROOM == 04 then if Game.getStorageValue(_PVP_ROOM[00].BATTLE_PLAYER) ~= nil then Game.setStorageValue(_PVP_ROOM[00].BATTLE_PLAYER, (Game.getStorageValue(_PVP_ROOM[00].BATTLE_PLAYER) - 01)) end creature:setTown(Town(01)) creature:sendCancelMessage("@NoTeleport 00") creature:sendCancelMessage("@CronOff") creature:setStorageValue(_PVP_ROOM[00].PVP_SALA_ID, nil) creature:setStorageValue(_PVP_ROOM[00].TIME_ID, nil) creature:teleportTo({x=3999, y=991, z=7}) creature:getPosition():sendMagicEffect(11) onLoadPVPRoom(creature, 00) return true else creature:teleportTo(_PVP_ROOM[PVP_ROOM].ARENA_POS[math.random(01, #_PVP_ROOM[PVP_ROOM].ARENA_POS)]) end creature:getPosition():sendMagicEffect(11) if PVP_ROOM == 03 or PVP_ROOM == 06 then return true end if creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == 01 then _PVP_ROOM[PVP_ROOM].PLACAR[01] = _PVP_ROOM[PVP_ROOM].PLACAR[01] + 01 else _PVP_ROOM[PVP_ROOM].PLACAR[02] = _PVP_ROOM[PVP_ROOM].PLACAR[02] + 01 end local from = _PVP_ROOM[PVP_ROOM].ARENA_POS[00].POS_X local to = _PVP_ROOM[PVP_ROOM].ARENA_POS[00].POS_Y for A = from.x, to.x do for B = from.y, to.y do for C = from.z, to.z do local tile = Tile(A, B, C) if tile then local creature = tile:getTopCreature() if creature and creature:isPlayer() then creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "[PLACAR] RED (" .._PVP_ROOM[PVP_ROOM].PLACAR[01].. ") | (" .._PVP_ROOM[PVP_ROOM].PLACAR[02].. ") BLUE") end end end end end end end return true end