Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- activeBlips = {}
- function hashPos(pos)
- x = math.floor(pos.x) * 2^12
- y = math.floor(pos.y) * 2^6
- z = math.floor(pos.z)
- return x+y+z
- end
- RegisterServerEvent("atc:flashingBlip")
- AddEventHandler("atc:flashingBlip", function(posv, blipid, time, col)
- TriggerClientEvent("atc:startFlashingBlip", -1, posv, blipid, time, col)
- local pos = hashPos(posv)
- if activeBlips[pos] == nil then
- activeBlips[pos] = 0
- elseif activeBlips[pos] > 0 then
- TriggerClientEvent("atc:warning", source)
- print("[ATC] warning player "..source.." for calling out at "..pos)
- print("[ATC] current state:")
- for k,v in next, activeBlips do
- print(k.." = "..v)
- end
- end
- activeBlips[pos] = activeBlips[pos] + 1
- --print("[atc] added blip "..pos.." = "..activeBlips[pos])
- SetTimeout(time * 1000, function()
- activeBlips[pos] = activeBlips[pos] - 1
- --print("[atc] removed blip "..pos.." = "..activeBlips[pos])
- if activeBlips[pos] < 0 then
- print("[ATC] Bug or race condition detected... Resetting.")
- activeBlips[pos] = 0
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement