Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

tile = {

pos1 = {
{x = 60, y = 47},
{x = 61, y = 47},
{x = 62, y = 47}
},
pos2 = {
{x = 66, y = 47},
{x = 67, y = 47},
{x = 68, y = 47}
}
}

Count = 0
data = {}

function collectzz()
for _, obj in pairs(GetObjectList()) do
for _, tiles in pairs(tile.pos1) do
if obj.itemid == 112 and (obj.posX)//32 == tiles.x and (obj.posY)//32 == tiles.y
then
Count = Count + obj.amount
local pkt = {}
pkt.type = 11
pkt.value = obj.id
pkt.x = obj.posX
pkt.y = obj.posY
SendPacketRaw(false, pkt)
end
end
end
table.insert(data, Count)
Count = 0
for _, obj in pairs(GetObjectList()) do
for _, tiles in pairs(tile.pos2) do
if obj.itemid == 112 and (obj.posX)//32 == tiles.x and (obj.posY)//32 == tiles.y
then
local pkt = {}
pkt.type = 11
pkt.value = obj.id
pkt.x = obj.posX
pkt.y = obj.posY
SendPacketRaw(false, pkt)
Count = Count + obj.amount
end
end
end
table.insert(data, Count)
Count = 0

if data[1] > data[2] then


SendPacket(2, "action|input\n|text|`0[`2Win`0] `1G`3e`5m`#s `w: "..data[1].."(gems)
`0Vs `0[`4Lose`0] `1G`3e`5m`#s `w: "..data[2].."(gems)")
elseif data[1] == data[2] then
SendPacket(2, "action|input\n|text|`1G`3e`5m`#s `w: "..data[1].."(gems) `0[ `bTie
`0] `1G`3e`5m`#s `w: "..data[2].. "(gems)")
else
SendPacket(2, "action|input\n|text|`0[`4Lose`0] `1G`3e`5m`#s `w:
"..data[1].."(gems) `0Vs `0[`2Win`0] `1G`3e`5m`#s `w: "..data[2].. "(gems)")
end
data = {}
end

AddHook(function(type, packet)
if packet:find("/g") then
collectzz()
return true
end
return false
end, "OnSendPacket")

You might also like