exit_pvp.lua

main 38 lines · 1.4 KB Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1local function onLoadPVPRoom(cid)
2 local player = Player(cid)
3 if player then
4 local A = Game.getStorageValue(_PVP_ROOM[01].CONTAGEM_PLAYER) or 0
5 local B = Game.getStorageValue(_PVP_ROOM[02].CONTAGEM_PLAYER) or 0
6 local C = Game.getStorageValue(_PVP_ROOM[03].CONTAGEM_PLAYER) or 0
7 local D = Game.getStorageValue(_PVP_ROOM[04].CONTAGEM_PLAYER) or 0
8 local E = Game.getStorageValue(_PVP_ROOM[05].CONTAGEM_PLAYER) or 0
9 local F = Game.getStorageValue(_PVP_ROOM[06].CONTAGEM_PLAYER) or 0
10
11 local players = Game.getPlayers()
12 for _, targetPlayer in ipairs(players) do
13 targetPlayer:sendCancelMessage("@LoadPVP 01 " ..A.. " " ..B.. " " ..C.. " " ..D.. " " ..E.. " " ..F)
14 end
15 end
16 return false
17end
18function onStepIn(creature, item, position, fromPosition)
19 if creature:isPlayer() then
20 local PVP_ROOM = creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID)
21 local COUNT_PLAYER = Game.getStorageValue(_PVP_ROOM[PVP_ROOM].CONTAGEM_PLAYER) or 00
22 if COUNT_PLAYER < 00 then
23 COUNT_PLAYER = 00
24 end
25
26 creature:setTown(Town(01))
27 creature:sendCancelMessage("@NoTeleport 00")
28 creature:sendCancelMessage("@CronOff")
29 Game.setStorageValue(_PVP_ROOM[PVP_ROOM].CONTAGEM_PLAYER, (COUNT_PLAYER - 01))
30 creature:setStorageValue(_PVP_ROOM[00].PVP_SALA_ID, nil)
31 creature:setStorageValue(_PVP_ROOM[00].TIME_ID, nil)
32 creature:teleportTo({x=3999, y=991, z=7})
33 creature:getPosition():sendMagicEffect(11)
34 onLoadPVPRoom(creature)
35 end
36 return true
37end
38
Top