Jump to content

blips moving


MOGA672002

Recommended Posts

local blipTable = {}
meleeBlips = {
  {1833.703, -1842.807},
  {1352.487, -1758.57},
  {1315.459, -898.688},
  {-1562.522, -2733.185},
  {-2442.557, 754.996},
  {2194.932, 1988.895},
  {2099.141, 2224.299},
  {1937.835, 2305.65},
  {2246.179, 2396.23},
  {2454.381, 2065.184},
  {2547.9677, 1972.663},
  {2885.638, 2455.107},
  {-180.894, 1033.388},
  {999.837, -921.802},
}
ammublips = {
  {1369, -1279},
  {2400, -1981},
  {-2625, 208},
  {-2099, -2469},
  {2539, 2082},
  {2159, 941},
  {777, 1871},
  {-315, 832},
  {240, -178},
  {-1508, 2608},
  {2335, 61},
}
bikeBlips = {
  {2230.491, 1400.998},
}
gymBlips = {
  {
    2228.623,
    -1722.583,
    13.554
  },
  {
    -2269.058,
    -155.894,
    35.32
  },
  {
    1968.712,
    2295.872,
    16.455
  },
  {
    654.065,
    -1869.551,
    4.5
  }
}
cluckinBlips = {
  {172, 1176},
  {-1213, 1830},
  {-2155, -2460},
  {2419, -1509},
  {2397, -1898},
  {928, -1352},
  {-1815, 618},
  {-2671, 258},
  {2638, 1671},
  {2393, 2041},
  {2838, 2407},
  {2102, 2228},
  {-3667, -383},
  {-5206, 52}
}
carShops = {
  {-1667.2753, 1206.4147},
  {-1961.498, 287.344},
  {-1706.175, 407.25},
  {552.82, -1261.418},
  {2294.025, -2324.841},
  {-1534.272, 2626.144},
  {1273.746, 187.222},
  {-2097.08, -2258.84},
  {1952.82, 2039.7199},
  {2131.88, -1149.31},
  {1658.332, 2195.125},
}
planeShops = {
  {-1675, -404},
  {1581, 1648},
  {1939, -2285},
  {374, 2542},
}
boatShops = {
  {2293.6, 532.18}
}
modShopBlips = {
  {-2723, 217},
  {1990, 2056},
  {1041, -1018},
  {-1936, 245},
  {2412, -2471},
  {-1561, 1247},
  {1643, -1516},
  {1431, -2439},
  {-1598, -631},
  {1409, 1811},
  {-3723, -440}
}
local fsc = {
  {1937.16, -1769.35},
  {-2238, -2563},
  {-1613, -2723},
  {2142, 2747},
  {616, 1690},
  {2120, 920},
  {2643, 1106},
  {2203, 2471},
  {-1330, 2672},
  {-1477, 1864},
  {-1681, 408},
  {-2406, 970},
  {78, 1217},
  {1386, 461},
  {653, -559},
  {1009, -933},
  {2155, -1153},
  {2581, 57},
  {2530, -1520},
  {286, -1788},
  {1980, -2635},
  {2464, -2243},
  {-479, -502},
  {1592, 2200},
  {-1721, -452},
  {-2225, -216},
  {
    -2873,
    439,
    5
  },
  {-2238, 2291},
  {69, 2045},
  {1282, 1422},
  {-89, -1163},
  {989, -1304},
  {-3480, -370},
  {-5380, -18},
  {-5152, 24}
}
function blipCreate()
  local drugBlip = exports.CRGcustomblips:createCustomBlip(2540, -1307, 13, 9, "blips/Drug_Pill.png", 180)
  exports.CRGcustomblips:setCustomBlipRadarScale(drugBlip, 1)
  for key, mblips in pairs(meleeBlips) do
    local meleeBlip = exports.CRGcustomblips:createCustomBlip(mblips[1], mblips[2], 20, 20, "blips/Hammer-icon.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(meleeBlip, 1)
    blipTable[meleeBlip] = "store"
  end
  for key, ablips in pairs(ammublips) do
    local ammuBlip = exports.CRGcustomblips:createCustomBlip(ablips[1], ablips[2], 25, 25, "blips/ammu.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(ammuBlip, 1)
    blipTable[ammuBlip] = "ammu"
  end
  for key, bblips in pairs(bikeBlips) do
    local bikeBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 20, 20, "blips/mc.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(bikeBlip, 1)
    blipTable[bikeBlip] = "vehshop"
  end
  for key, bblips in pairs(carShops) do
    local carBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 20, 20, "blips/Blipid55.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(carBlip, 1)
    blipTable[carBlip] = "vehshop"
  end
  for key, bblips in pairs(planeShops) do
    local planeBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 20, 20, "blips/Blipid5.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(planeBlip, 1)
    blipTable[planeBlip] = "vehshop"
  end
  for key, bblips in pairs(boatShops) do
    local boatBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 20, 20, "blips/Blipid9.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(boatBlip, 1)
    blipTable[boatBlip] = "vehshop"
  end
  for key, bblips in pairs(burgerBlips) do
    local burgBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 20, 20, "blips/Blipid10.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(burgBlip, 1)
    blipTable[burgBlip] = "food"
  end
  for key, bblips in pairs(pizzaBlips) do
    local pizzaBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 20, 20, "blips/Blipid29.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(pizzaBlip, 1)
    blipTable[pizzaBlip] = "food"
  end
  for key, bblips in pairs(cluckinBlips) do
    local cluckinBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 20, 20, "blips/Blipid14.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(cluckinBlip, 1)
    blipTable[cluckinBlip] = "food"
  end
  for key, bblips in pairs(restaurantBlips) do
    local restBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 20, 20, "blips/Blipid50.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(restBlip, 1)
    blipTable[restBlip] = "food"
  end
  for key, bblips in pairs(modShopBlips) do
    local modBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 20, 20, "blips/Blipid27.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(modBlip, 1)
    blipTable[modBlip] = "repairmod"
  end
  for key, gymblip in pairs(gymBlips) do
    local gymBlip = createBlip(gymblip[1], gymblip[2], gymblip[3], 54, 2, 0, 0, 0, 255, 0, 230)
  end
  local LSbank = exports.CRGcustomblips:createCustomBlip(1462.4, -1012.1, 20, 20, "blips/Blipid52.png", 400)
  local SFbank = exports.CRGcustomblips:createCustomBlip(-1882.5, 718.7, 20, 20, "blips/Blipid52.png", 400)
  exports.CRGcustomblips:setCustomBlipRadarScale(LSbank, 1)
  exports.CRGcustomblips:setCustomBlipRadarScale(SFbank, 1)
  for key, ent in pairs(fsc) do
    local fuelBlip = exports.CRGcustomblips:createCustomBlip(ent[1], ent[2], 20, 20, "gas.png", 200)
    exports.CRGcustomblips:setCustomBlipRadarScale(fuelBlip, 1)
    blipTable[fuelBlip] = "fuel"
  end
  startClientGangBlips()
end
addEventHandler("onClientResourceStart", resourceRoot, blipCreate, true, "low")
function toggleBlipsCITPhone(blipType, alpha)
  for blip, btype in pairs(blipTable) do
    if blipType == btype then
      exports.CRGcustomblips:setCustomBlipAlpha(blip, alpha)
    end
  end
end
addEvent("CITblips.blipOn", true)
addEventHandler("CITblips.blipOn", root, toggleBlipsCITPhone)

function toggleBlipsSetting (blipTType, oldsadasd, typee)
if  typee == "No" then
  for blip, btype in pairs(blipTable) do
    if blipTType == btype then
exports.CRGcustomblips:setCustomBlipAlpha(blip, 0)
end
end

end
end
addEventHandler("onClientSettingChange", root, toggleBlipsSetting)

function toggleBlipsSetting3 (blipTType, oldsadasd, typee)
if blipTType ~= "radarBlips" then return end
if  typee == "No" then
  for blip123, btype123 in pairs(blipTable) do
exports.CRGcustomblips:setCustomBlipRadarScale(blip123, 1)
end
-- Retrieve a table containing all the blips that exist
blips = getElementsByType ( "blip" )
-- Loop through the list, storing the blip from the table in the variable blipValue
for blipKey, blipValue in ipairs(blips) do
	-- Retrieve the blip's icon into the variable 'blipIcon'
	blipIcon = getBlipIcon ( blipValue )
	-- If the blip's icon wasn't the default already
	if ( blipIcon ~= 0 ) then
		-- Set the blip's icon to the default
		setBlipVisibleDistance ( blipValue, getElementData(blipValue,"visnum") )
	end
end

end
end
addEventHandler("onClientSettingChange", root, toggleBlipsSetting3)

function toggleBlipsSetting4 (blipTType, oldsadasd, typee)
if blipTType ~= "radarBlips" then return end
if  typee == "Yes" then
  for blip123, btype123 in pairs(blipTable) do
exports.CRGcustomblips:setCustomBlipRadarScale(blip123, 0)
end
-- Retrieve a table containing all the blips that exist
blips = getElementsByType ( "blip" )
-- Loop through the list, storing the blip from the table in the variable blipValue
for blipKey, blipValue in ipairs(blips) do
	-- Retrieve the blip's icon into the variable 'blipIcon'
	blipIcon = getBlipIcon ( blipValue )
	-- If the blip's icon wasn't the default already
	if ( blipIcon ~= 0 ) then
	setElementData(blipValue,"visnum",getBlipVisibleDistance(blipValue))
		-- Set the blip's icon to the default
		setBlipVisibleDistance ( blipValue, 0 )
	end
end

end
end
addEventHandler("onClientSettingChange", root, toggleBlipsSetting4)

function toggleBlipsSetting2 (blipTType, oldsadasd, typee)
if  typee == "Yes" then
  for blip, btype in pairs(blipTable) do
    if blipTType == btype then
exports.CRGcustomblips:setCustomBlipAlpha(blip, 1)
end
end

end
end
addEventHandler("onClientSettingChange", root, toggleBlipsSetting2)
local friendBlips = {}
local viewBlips = true
local allyList = {}
function doThisWhenRestStarted()
  local alliedGroups = xmlLoadFile("alliedgroups.xml")
  alliedGroups = alliedGroups or xmlCreateFile("alliedgroups.xml", "allies")
  local allyNodes = xmlNodeGetChildren(alliedGroups)
  local allianceGroups = exports.CRGalliance:getAllianceGroups() or {}
  for index, node in pairs(allyNodes) do
    local ally = xmlNodeGetValue(node)
    for i, ally2 in pairs(allianceGroups) do
      if ally2 == ally then
        allyList[ally] = true
      end
    end
  end
end
setTimer(doThisWhenRestStarted, 5000, 1)
function isInSameAlliance(plr)
  local ally = getElementData(plr, "g")
  local found = false
  for i, ally2 in pairs(exports.CRGalliance:getAllianceGroups()) do
    if ally2 == ally then
      return true
    end
  end
  return false
end
function addAllyCommand(cmd, ...)
  local ally = table.concat({
    ...
  }, " ")
  if ally then
    local found = false
    for i, ally2 in pairs(exports.CRGalliance:getAllianceGroups()) do
      if ally2 == ally then
        found = true
        break
      end
    end
    if not found then
      exports.CRGtexts:output("You are not in an alliance with " .. ally, 255, 0, 0)
      return
    end
    allyList[ally] = true
    local child = xmlCreateChild(alliedGroups, "ally")
    xmlNodeSetValue(child, ally)
    xmlSaveFile(alliedGroups)
    for index, player in pairs(getElementsByType("player")) do
      if ally == getElementData(player, "g") and player ~= localPlayer and not friendBlips[player] and isPlayerNametagShowing(player) then
        friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
        exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "allianceMember", player)
        exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
        exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
        local r, g, b = getBlipColor(getAttachedElements(player)[1])
        setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
      end
    end
    outputChatBox("Added " .. ally .. " members to your radar", 0, 255, 0)
  else
    outputChatBox("Usage /addally group name", 255, 0, 0)
  end
end
addCommandHandler("addally", addAllyCommand)
function deleteAllyCommand(cmd, ...)
  local ally = table.concat({
    ...
  }, " ")
  if not ally then
    outputChatBox("Usage /deleteally group name", 255, 0, 0)
    return
  end
  allyList[ally] = nil
  local allyNodes = xmlNodeGetChildren(alliedGroups)
  for index, node in pairs(allyNodes) do
    if xmlNodeGetValue(node) == ally then
      xmlDestroyNode(node)
    end
  end
  xmlSaveFile(alliedGroups)
  for index, player in pairs(getElementsByType("player")) do
    if ally == getElementData(player, "g") and friendBlips[player] then
      exports.CRGcustomblips:destroyCustomBlip(friendBlips[player])
      friendBlips[player] = nil
    end
  end
  outputChatBox("Removed " .. ally .. " members to your radar", 0, 255, 0)
end
addCommandHandler("deleteally", deleteAllyCommand)
function startClientGangBlips()
  local myGang = getElementData(localPlayer, "g")
  if not myGang then
    return
  end
  for index, player in pairs(getElementsByType("player")) do
    if myGang == getElementData(player, "g") and player ~= localPlayer then
      friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "groupMember", player)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
      local r, g, b = getBlipColor(getAttachedElements(player)[1])
      setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
    elseif allyList[getElementData(player, "g")] and player ~= localPlayer then
      friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "allianceMember", player)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
      local r, g, b = getBlipColor(getAttachedElements(player)[1])
      setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
    end
  end
      for i, ally22 in pairs(exports.CRGalliance:getAllianceGroups()) do
if ally22 then
 for index, player in pairs(getElementsByType("player")) do
    if ally22 == getElementData(player, "g") and player ~= localPlayer and getElementData(player,"g") ~= getElementData(localPlayer,"g") then
	      friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "allianceMember", player)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
      local r, g, b = getBlipColor(getAttachedElements(player)[1])
      setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
	end
end
    end
  
  
end
end
function clientChange(dataName, oldValue)
  if dataName ~= "g" then
    return
  end
  if not viewBlips then
    return
  end
  local myGang = getElementData(localPlayer, "g")
  if not myGang then
    return
  end
  if not isPlayerNametagShowing(source) then
    return
  end
  if source == localPlayer then
    for index, player in pairs(getElementsByType("player")) do
      if myGang == getElementData(player, "g") and player ~= localPlayer then
        friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20.png", 400)
        exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "groupMember", player)
        exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
        exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
        local r, g, b = getBlipColor(getAttachedElements(player)[1])
        setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
      elseif allyList[getElementData(player, "g")] and player ~= localPlayer then
        friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
        exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "allianceMember", player)
        exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
        exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
        local r, g, b = getBlipColor(getAttachedElements(player)[1])
        setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
      end
    end
  else
    local theirGang = getElementData(source, "g")
    if theirGang == myGang then
      friendBlips[source] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[source], "groupMember", source)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[source], source)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[source], 1)
      local r, g, b = getBlipColor(getAttachedElements(source)[1])
      setBlipColor(getAttachedElements(source)[1], r, g, b, 0)
    elseif allyList[theirGang] then
      friendBlips[source] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[source], "allianceMember", source)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[source], source)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[source], 1)
      local r, g, b = getBlipColor(getAttachedElements(source)[1])
      setBlipColor(getAttachedElements(source)[1], r, g, b, 0)
    elseif (oldValue == myGang or allyList[theirGang]) and friendBlips[source] then
      exports.CRGcustomblips:destroyCustomBlip(friendBlips[source])
      friendBlips[source] = nil
      local r, g, b = getBlipColor(getAttachedElements(source)[1])
      setBlipColor(getAttachedElements(source)[1], r, g, b, 255)
    end
  end
end
addEventHandler("onClientElementDataChange", root, clientChange)
function setGroupBlipsVisible()
end
fileDelete("blips.lua")

thats my code please tell me which line and which word should i edit ?

Link to comment
1 hour ago, MOGA672002 said:

local blipTable = {}
meleeBlips = {
  {1833.703, -1842.807},
  {1352.487, -1758.57},
  {1315.459, -898.688},
  {-1562.522, -2733.185},
  {-2442.557, 754.996},
  {2194.932, 1988.895},
  {2099.141, 2224.299},
  {1937.835, 2305.65},
  {2246.179, 2396.23},
  {2454.381, 2065.184},
  {2547.9677, 1972.663},
  {2885.638, 2455.107},
  {-180.894, 1033.388},
  {999.837, -921.802},
}
ammublips = {
  {1369, -1279},
  {2400, -1981},
  {-2625, 208},
  {-2099, -2469},
  {2539, 2082},
  {2159, 941},
  {777, 1871},
  {-315, 832},
  {240, -178},
  {-1508, 2608},
  {2335, 61},
}
bikeBlips = {
  {2230.491, 1400.998},
}
gymBlips = {
  {
    2228.623,
    -1722.583,
    13.554
  },
  {
    -2269.058,
    -155.894,
    35.32
  },
  {
    1968.712,
    2295.872,
    16.455
  },
  {
    654.065,
    -1869.551,
    4.5
  }
}
cluckinBlips = {
  {172, 1176},
  {-1213, 1830},
  {-2155, -2460},
  {2419, -1509},
  {2397, -1898},
  {928, -1352},
  {-1815, 618},
  {-2671, 258},
  {2638, 1671},
  {2393, 2041},
  {2838, 2407},
  {2102, 2228},
  {-3667, -383},
  {-5206, 52}
}
carShops = {
  {-1667.2753, 1206.4147},
  {-1961.498, 287.344},
  {-1706.175, 407.25},
  {552.82, -1261.418},
  {2294.025, -2324.841},
  {-1534.272, 2626.144},
  {1273.746, 187.222},
  {-2097.08, -2258.84},
  {1952.82, 2039.7199},
  {2131.88, -1149.31},
  {1658.332, 2195.125},
}
planeShops = {
  {-1675, -404},
  {1581, 1648},
  {1939, -2285},
  {374, 2542},
}
boatShops = {
  {2293.6, 532.18}
}
modShopBlips = {
  {-2723, 217},
  {1990, 2056},
  {1041, -1018},
  {-1936, 245},
  {2412, -2471},
  {-1561, 1247},
  {1643, -1516},
  {1431, -2439},
  {-1598, -631},
  {1409, 1811},
  {-3723, -440}
}
local fsc = {
  {1937.16, -1769.35},
  {-2238, -2563},
  {-1613, -2723},
  {2142, 2747},
  {616, 1690},
  {2120, 920},
  {2643, 1106},
  {2203, 2471},
  {-1330, 2672},
  {-1477, 1864},
  {-1681, 408},
  {-2406, 970},
  {78, 1217},
  {1386, 461},
  {653, -559},
  {1009, -933},
  {2155, -1153},
  {2581, 57},
  {2530, -1520},
  {286, -1788},
  {1980, -2635},
  {2464, -2243},
  {-479, -502},
  {1592, 2200},
  {-1721, -452},
  {-2225, -216},
  {
    -2873,
    439,
    5
  },
  {-2238, 2291},
  {69, 2045},
  {1282, 1422},
  {-89, -1163},
  {989, -1304},
  {-3480, -370},
  {-5380, -18},
  {-5152, 24}
}
function blipCreate()
  local drugBlip = exports.CRGcustomblips:createCustomBlip(2540, -1307, 9, 9, "blips/Drug_Pill.png", 180)
  exports.CRGcustomblips:setCustomBlipRadarScale(drugBlip, 1)
  for key, mblips in pairs(meleeBlips) do
    local meleeBlip = exports.CRGcustomblips:createCustomBlip(mblips[1], mblips[2], 9, 9, "blips/Hammer-icon.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(meleeBlip, 1)
    blipTable[meleeBlip] = "store"
  end
  for key, ablips in pairs(ammublips) do
    local ammuBlip = exports.CRGcustomblips:createCustomBlip(ablips[1], ablips[2], 9, 9, "blips/ammu.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(ammuBlip, 1)
    blipTable[ammuBlip] = "ammu"
  end
  for key, bblips in pairs(bikeBlips) do
    local bikeBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 9, 9, "blips/mc.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(bikeBlip, 1)
    blipTable[bikeBlip] = "vehshop"
  end
  for key, bblips in pairs(carShops) do
    local carBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 9, 9, "blips/Blipid55.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(carBlip, 1)
    blipTable[carBlip] = "vehshop"
  end
  for key, bblips in pairs(planeShops) do
    local planeBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 9, 9, "blips/Blipid5.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(planeBlip, 1)
    blipTable[planeBlip] = "vehshop"
  end
  for key, bblips in pairs(boatShops) do
    local boatBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 9, 9, "blips/Blipid9.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(boatBlip, 1)
    blipTable[boatBlip] = "vehshop"
  end
  for key, bblips in pairs(burgerBlips) do
    local burgBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 9,9, "blips/Blipid10.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(burgBlip, 1)
    blipTable[burgBlip] = "food"
  end
  for key, bblips in pairs(pizzaBlips) do
    local pizzaBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 9, 9, "blips/Blipid29.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(pizzaBlip, 1)
    blipTable[pizzaBlip] = "food"
  end
  for key, bblips in pairs(cluckinBlips) do
    local cluckinBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 9, 9, "blips/Blipid14.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(cluckinBlip, 1)
    blipTable[cluckinBlip] = "food"
  end
  for key, bblips in pairs(restaurantBlips) do
    local restBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 9, 9, "blips/Blipid50.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(restBlip, 1)
    blipTable[restBlip] = "food"
  end
  for key, bblips in pairs(modShopBlips) do
    local modBlip = exports.CRGcustomblips:createCustomBlip(bblips[1], bblips[2], 9, 9, "blips/Blipid27.png", 180)
    exports.CRGcustomblips:setCustomBlipRadarScale(modBlip, 1)
    blipTable[modBlip] = "repairmod"
  end
  for key, gymblip in pairs(gymBlips) do
    local gymBlip = createBlip(gymblip[1], gymblip[2], gymblip[3], 54, 2, 0, 0, 0, 255, 0, 230)
  end
  local LSbank = exports.CRGcustomblips:createCustomBlip(1462.4, -1012.1, 9, 9, "blips/Blipid52.png", 400)
  local SFbank = exports.CRGcustomblips:createCustomBlip(-1882.5, 718.7, 9, 9, "blips/Blipid52.png", 400)
  exports.CRGcustomblips:setCustomBlipRadarScale(LSbank, 1)
  exports.CRGcustomblips:setCustomBlipRadarScale(SFbank, 1)
  for key, ent in pairs(fsc) do
    local fuelBlip = exports.CRGcustomblips:createCustomBlip(ent[1], ent[2], 9, 9, "gas.png", 200)
    exports.CRGcustomblips:setCustomBlipRadarScale(fuelBlip, 1)
    blipTable[fuelBlip] = "fuel"
  end
  startClientGangBlips()
end
addEventHandler("onClientResourceStart", resourceRoot, blipCreate, true, "low")
function toggleBlipsCITPhone(blipType, alpha)
  for blip, btype in pairs(blipTable) do
    if blipType == btype then
      exports.CRGcustomblips:setCustomBlipAlpha(blip, alpha)
    end
  end
end
addEvent("CITblips.blipOn", true)
addEventHandler("CITblips.blipOn", root, toggleBlipsCITPhone)

function toggleBlipsSetting (blipTType, oldsadasd, typee)
if  typee == "No" then
  for blip, btype in pairs(blipTable) do
    if blipTType == btype then
exports.CRGcustomblips:setCustomBlipAlpha(blip, 0)
end
end

end
end
addEventHandler("onClientSettingChange", root, toggleBlipsSetting)

function toggleBlipsSetting3 (blipTType, oldsadasd, typee)
if blipTType ~= "radarBlips" then return end
if  typee == "No" then
  for blip123, btype123 in pairs(blipTable) do
exports.CRGcustomblips:setCustomBlipRadarScale(blip123, 1)
end
-- Retrieve a table containing all the blips that exist
blips = getElementsByType ( "blip" )
-- Loop through the list, storing the blip from the table in the variable blipValue
for blipKey, blipValue in ipairs(blips) do
	-- Retrieve the blip's icon into the variable 'blipIcon'
	blipIcon = getBlipIcon ( blipValue )
	-- If the blip's icon wasn't the default already
	if ( blipIcon ~= 0 ) then
		-- Set the blip's icon to the default
		setBlipVisibleDistance ( blipValue, getElementData(blipValue,"visnum") )
	end
end

end
end
addEventHandler("onClientSettingChange", root, toggleBlipsSetting3)

function toggleBlipsSetting4 (blipTType, oldsadasd, typee)
if blipTType ~= "radarBlips" then return end
if  typee == "Yes" then
  for blip123, btype123 in pairs(blipTable) do
exports.CRGcustomblips:setCustomBlipRadarScale(blip123, 0)
end
-- Retrieve a table containing all the blips that exist
blips = getElementsByType ( "blip" )
-- Loop through the list, storing the blip from the table in the variable blipValue
for blipKey, blipValue in ipairs(blips) do
	-- Retrieve the blip's icon into the variable 'blipIcon'
	blipIcon = getBlipIcon ( blipValue )
	-- If the blip's icon wasn't the default already
	if ( blipIcon ~= 0 ) then
	setElementData(blipValue,"visnum",getBlipVisibleDistance(blipValue))
		-- Set the blip's icon to the default
		setBlipVisibleDistance ( blipValue, 0 )
	end
end

end
end
addEventHandler("onClientSettingChange", root, toggleBlipsSetting4)

function toggleBlipsSetting2 (blipTType, oldsadasd, typee)
if  typee == "Yes" then
  for blip, btype in pairs(blipTable) do
    if blipTType == btype then
exports.CRGcustomblips:setCustomBlipAlpha(blip, 1)
end
end

end
end
addEventHandler("onClientSettingChange", root, toggleBlipsSetting2)
local friendBlips = {}
local viewBlips = true
local allyList = {}
function doThisWhenRestStarted()
  local alliedGroups = xmlLoadFile("alliedgroups.xml")
  alliedGroups = alliedGroups or xmlCreateFile("alliedgroups.xml", "allies")
  local allyNodes = xmlNodeGetChildren(alliedGroups)
  local allianceGroups = exports.CRGalliance:getAllianceGroups() or {}
  for index, node in pairs(allyNodes) do
    local ally = xmlNodeGetValue(node)
    for i, ally2 in pairs(allianceGroups) do
      if ally2 == ally then
        allyList[ally] = true
      end
    end
  end
end
setTimer(doThisWhenRestStarted, 5000, 1)
function isInSameAlliance(plr)
  local ally = getElementData(plr, "g")
  local found = false
  for i, ally2 in pairs(exports.CRGalliance:getAllianceGroups()) do
    if ally2 == ally then
      return true
    end
  end
  return false
end
function addAllyCommand(cmd, ...)
  local ally = table.concat({
    ...
  }, " ")
  if ally then
    local found = false
    for i, ally2 in pairs(exports.CRGalliance:getAllianceGroups()) do
      if ally2 == ally then
        found = true
        break
      end
    end
    if not found then
      exports.CRGtexts:output("You are not in an alliance with " .. ally, 255, 0, 0)
      return
    end
    allyList[ally] = true
    local child = xmlCreateChild(alliedGroups, "ally")
    xmlNodeSetValue(child, ally)
    xmlSaveFile(alliedGroups)
    for index, player in pairs(getElementsByType("player")) do
      if ally == getElementData(player, "g") and player ~= localPlayer and not friendBlips[player] and isPlayerNametagShowing(player) then
        friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
        exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "allianceMember", player)
        exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
        exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
        local r, g, b = getBlipColor(getAttachedElements(player)[1])
        setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
      end
    end
    outputChatBox("Added " .. ally .. " members to your radar", 0, 255, 0)
  else
    outputChatBox("Usage /addally group name", 255, 0, 0)
  end
end
addCommandHandler("addally", addAllyCommand)
function deleteAllyCommand(cmd, ...)
  local ally = table.concat({
    ...
  }, " ")
  if not ally then
    outputChatBox("Usage /deleteally group name", 255, 0, 0)
    return
  end
  allyList[ally] = nil
  local allyNodes = xmlNodeGetChildren(alliedGroups)
  for index, node in pairs(allyNodes) do
    if xmlNodeGetValue(node) == ally then
      xmlDestroyNode(node)
    end
  end
  xmlSaveFile(alliedGroups)
  for index, player in pairs(getElementsByType("player")) do
    if ally == getElementData(player, "g") and friendBlips[player] then
      exports.CRGcustomblips:destroyCustomBlip(friendBlips[player])
      friendBlips[player] = nil
    end
  end
  outputChatBox("Removed " .. ally .. " members to your radar", 0, 255, 0)
end
addCommandHandler("deleteally", deleteAllyCommand)
function startClientGangBlips()
  local myGang = getElementData(localPlayer, "g")
  if not myGang then
    return
  end
  for index, player in pairs(getElementsByType("player")) do
    if myGang == getElementData(player, "g") and player ~= localPlayer then
      friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "groupMember", player)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
      local r, g, b = getBlipColor(getAttachedElements(player)[1])
      setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
    elseif allyList[getElementData(player, "g")] and player ~= localPlayer then
      friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "allianceMember", player)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
      local r, g, b = getBlipColor(getAttachedElements(player)[1])
      setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
    end
  end
      for i, ally22 in pairs(exports.CRGalliance:getAllianceGroups()) do
if ally22 then
 for index, player in pairs(getElementsByType("player")) do
    if ally22 == getElementData(player, "g") and player ~= localPlayer and getElementData(player,"g") ~= getElementData(localPlayer,"g") then
	      friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "allianceMember", player)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
      local r, g, b = getBlipColor(getAttachedElements(player)[1])
      setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
	end
end
    end
  
  
end
end
function clientChange(dataName, oldValue)
  if dataName ~= "g" then
    return
  end
  if not viewBlips then
    return
  end
  local myGang = getElementData(localPlayer, "g")
  if not myGang then
    return
  end
  if not isPlayerNametagShowing(source) then
    return
  end
  if source == localPlayer then
    for index, player in pairs(getElementsByType("player")) do
      if myGang == getElementData(player, "g") and player ~= localPlayer then
        friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20.png", 400)
        exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "groupMember", player)
        exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
        exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
        local r, g, b = getBlipColor(getAttachedElements(player)[1])
        setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
      elseif allyList[getElementData(player, "g")] and player ~= localPlayer then
        friendBlips[player] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
        exports.CRGcustomblips:setCustomBlipData(friendBlips[player], "allianceMember", player)
        exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[player], player)
        exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[player], 1)
        local r, g, b = getBlipColor(getAttachedElements(player)[1])
        setBlipColor(getAttachedElements(player)[1], r, g, b, 0)
      end
    end
  else
    local theirGang = getElementData(source, "g")
    if theirGang == myGang then
      friendBlips[source] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[source], "groupMember", source)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[source], source)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[source], 1)
      local r, g, b = getBlipColor(getAttachedElements(source)[1])
      setBlipColor(getAttachedElements(source)[1], r, g, b, 0)
    elseif allyList[theirGang] then
      friendBlips[source] = exports.CRGcustomblips:createCustomBlip(0, 0, 15, 15, "blips/Blipid20Green.png", 400)
      exports.CRGcustomblips:setCustomBlipData(friendBlips[source], "allianceMember", source)
      exports.CRGcustomblips:attachCustomBlipToElement(friendBlips[source], source)
      exports.CRGcustomblips:setCustomBlipRadarScale(friendBlips[source], 1)
      local r, g, b = getBlipColor(getAttachedElements(source)[1])
      setBlipColor(getAttachedElements(source)[1], r, g, b, 0)
    elseif (oldValue == myGang or allyList[theirGang]) and friendBlips[source] then
      exports.CRGcustomblips:destroyCustomBlip(friendBlips[source])
      friendBlips[source] = nil
      local r, g, b = getBlipColor(getAttachedElements(source)[1])
      setBlipColor(getAttachedElements(source)[1], r, g, b, 255)
    end
  end
end
addEventHandler("onClientElementDataChange", root, clientChange)
function setGroupBlipsVisible()
end
fileDelete("blips.lua")

try it now

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...