Hello.
You can use gettileseffect() to return effects on sqm located in your screen, maybe that effect can be detected by gettileseffects(), but you need to try out.
gettileeffect(number posx, number posy, number posz) [table]: Return a table with effects on this tile.
gettileseffect() [table]: Return a table with tiles that has at least one effect
.posx [number]
.posy [number]
.posz [number]
.effects [table(number)] -> Table with effects ids
Example:
|Only Registered members can see download links. | Click here to buy subscription or here to register.
So the final script would be something like this, but i didn't tested and not sure if that's your goal.
It will search for effects on "EFFECTS" table. If finds an effect on a different sqm and there's no effect on your sqm then play sound, flash client, disable listed tools, reach location then wait until there's no more effects on sqm you are standing.
local CONFIG = {
Effects = {11}, -- Effects ids
Tools = {
"Looter/Enabled",
"Cavebot/Enabled",
"Targeting/Enabled"
},
DisableTools = true,
EnableTools = true
}
if connected() then
local sqms = {}
local player_x, player_y, player_z = posx(), posy(), posz()
local tilesEffects = gettileseffect()
for _, tile in ipairs(tilesEffects) do
local flag = false
for __, effect in ipairs(tile.effects) do
if table.find(CONFIG.Effects, effect) ~= nil then
flag = true
break
end
end
if flag then
if player_x == tile.posx and player_y == tile.posy and player_z == tile.posz then
sqms = nil
break
end
table.insert(sqms, {x = tile.posx, y = tile.posy, z = tile.posz})
end
end
if sqms ~= nil and #sqms > 0 then
playsound("alert_gmdetected")
flashclient()
if CONFIG.DisableTools then
for _, tool in ipairs(CONFIG.Tools) do
setsettings(tool, false)
end
end
reachlocation(sqms[1].x, sqms[1].y, sqms[1].z, true, true)
wait(300, 500)
local foundEffect = true
while posx() == sqms[1].x and posy() == sqms[1].y and posz() == sqms[1].z and foundEffect do
wait(500, 1200)
foundEffect = false
local effects = gettileeffect(sqms[1].x, sqms[1].y, sqms[1].z)
for _, effect in ipairs(effects) do
if table.find(CONFIG.Effects, effect) ~= nil then
foundEffect = true
break
end
end
end
if CONFIG.EnableTools then
for _, tool in ipairs(CONFIG.Tools) do
setsettings(tool, true)
end
end
end
end