function onRecvRpc(id, data, size)
if id == 156 then
local bs = bitStreamInit(data, size)
interior = bitStreamReadByte(bs)
bitStreamDelete(bs)
end
end
function onSetPosition(a, s, d)
x, y, z = a, s, d
local px, py, pz = getPosition()
if px == x and py == y and pz ~= z and state == 0 then
if mode == 2 and tonumber(interior) > 1 then
printLog("Обнаружен SLAP в интерьере!")
x2, y2, z2 = getPosition()
if z > 1504 and point_dist(x, y, x2, y2) <= 5 then
z2 = 1505.0173
end
state = 1
elseif mode == 2 and tonumber(interior) < 1 then
printLog("Обнаружен SLAP вне интерьера!")
x2, y2, z2 = getPosition()
state = 1
elseif mode == 1 then
printLog("Обнаружен SLAP игнорируем его")
return true
end
end
end
function point_dist(a, b, a1, b1)
return math.abs(math.sqrt((a1-a)^2+(b1-b)^2))
end