<commit_before>
local client_areas = {}

-- free client areas when leaving
AddEventHandler("vRP:playerLeave",function(user_id,source)
  -- leave areas
  local areas = client_areas[source]
  if areas then
    for k,area in pairs(areas) do
      if area.inside then
        area.leave(source,k)
      end
    end
  end

  client_areas[source] = nil 
end)

-- create/update a player area
function vRP.setArea(source,name,x,y,z,radius,height,cb_enter,cb_leave)
  local areas = client_areas[source] or {}
  client_areas[source] = areas

  areas[name] = {enter=cb_enter,leave=cb_leave}
  vRPclient._setArea(source,name,x,y,z,radius,height)
end

-- check if a player is in an area
function vRP.inArea(source,name)
  local areas = client_areas[source]
  if areas then
    local area = areas[name]
    if area then return area.inside end
  end
end

-- delete a player area
function vRP.removeArea(source,name)
  -- delete remote area
  vRPclient._removeArea(source,name)

  -- delete local area
  local areas = client_areas[source]
  if areas then
    areas[name] = nil
  end
end

-- TUNNER SERVER API

function tvRP.enterArea(name)
  local areas = client_areas[source]
  if areas then
    local area = areas[name] 
    if area and area.enter and not area.inside then -- trigger enter callback
      area.inside = true
      area.enter(source,name)
    end
  end
end

function tvRP.leaveArea(name)
  local areas = client_areas[source]

  if areas then
    local area = areas[name] 
    if area and area.leave and area.inside then -- trigger leave callback
      area.inside = false
      area.leave(source,name)
    end
  end
end


local cfg = module("cfg/blips_markers")

-- add additional static blips/markers
AddEventHandler("vRP:playerSpawn",function(user_id, source, first_spawn)
  if first_spawn then<commit_msg>Fix more area issues with nil callbacks.<commit_after>
local client_areas = {}

-- free client areas when leaving
AddEventHandler("vRP:playerLeave",function(user_id,source)
  -- leave areas
  local areas = client_areas[source]
  if areas then
    for k,area in pairs(areas) do
      if area.inside and area.leave then
        area.leave(source,k)
      end
    end
  end

  client_areas[source] = nil 
end)

-- create/update a player area
function vRP.setArea(source,name,x,y,z,radius,height,cb_enter,cb_leave)
  local areas = client_areas[source] or {}
  client_areas[source] = areas

  areas[name] = {enter=cb_enter,leave=cb_leave}
  vRPclient._setArea(source,name,x,y,z,radius,height)
end

-- check if a player is in an area
function vRP.inArea(source,name)
  local areas = client_areas[source]
  if areas then
    local area = areas[name]
    if area then return area.inside end
  end
end

-- delete a player area
function vRP.removeArea(source,name)
  -- delete remote area
  vRPclient._removeArea(source,name)

  -- delete local area
  local areas = client_areas[source]
  if areas then
    local area = areas[name] 
    if area and area.inside then
      if area.leave then
        area.leave(source,name)
      end

      areas[name] = nil
    end
  end
end

-- TUNNER SERVER API

function tvRP.enterArea(name)
  local areas = client_areas[source]
  if areas then
    local area = areas[name] 
    if area and not area.inside then -- trigger enter callback
      area.inside = true
      if area.enter then
        area.enter(source,name)
      end
    end
  end
end

function tvRP.leaveArea(name)
  local areas = client_areas[source]

  if areas then
    local area = areas[name] 
    if area and area.inside then -- trigger leave callback
      area.inside = false
      if area.leave then
        area.leave(source,name)
      end
    end
  end
end


local cfg = module("cfg/blips_markers")

-- add additional static blips/markers
AddEventHandler("vRP:playerSpawn",function(user_id, source, first_spawn)
  if first_spawn then
{'fraction_non_alphanumeric': 0.08764629388816644, 'fraction_numerical': 0.0, 'mean_word_length': 3.326209223847019, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1833857', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1256, 'n_words': 363}