[Help} How can i hide a blip for some players but not others?


#1

As the tittle says

Thanks :smiley:


#2

Anyone know?

20Characters


#3

Yeah learn Lua. https://wiki.fivem.net/wiki/Main_Page

Use this as a reference - [Release] Disable Player Blips & Overhead Names


[Help] Criminal Blips filtering out Police job
#4

im asking like what natives cause thats what i cant figure out

Like how do i hide it and show it at the same time


#5

Look, into that script, I’m sure there is an easier way. Look around the forums for other scripts.


#6

Depends on what permission you use, if is steamid, modelskin, esx or vrp.

local blips = {
    -- Example {title="", colour=, id=, x=, y=, z=},
	{title="name", colour=29, blip=60, x=1853.1070556641, y=3687.4230957031, z=34.267078399658},	
  }

Citizen.CreateThread(function()
  if Player == ? then
    for _, info in pairs(blips) do
      info.blip = AddBlipForCoord(info.x, info.y, info.z)
      SetBlipSprite(info.blip, info.id)
	  SetBlipDisplay(info.blip, 4)
      SetBlipScale(info.blip, 0.9)
      SetBlipColour(info.blip, info.colour)
      SetBlipAsShortRange(info.blip, true)
      BeginTextCommandSetBlipName("STRING")
      AddTextComponentString(info.title)
      EndTextCommandSetBlipName(info.blip)
    end
  end
end)

Change this to your permissions

if Player == ? then

#7

yeah im using esx and im trying to make it so cops can see eachother

thanks


#8

This in the top of the client

ESX 			    			= nil
local PlayerData 				= {}

Citizen.CreateThread(function()
    while ESX == nil do
        TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
        Citizen.Wait(0)
    end
end)

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
  PlayerData = xPlayer
end)

RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
  PlayerData.job = job
end)

Change

if Player == ? then

to

if PlayerData.job.name == 'police'


#9

and just change the add blip to add it to the player right?


#10
local blipspolice = {
    -- Example {title="", colour=, id=, x=, y=, z=},
	{title="name", colour=29, blip=60, x=1853.1070556641, y=3687.4230957031, z=34.267078399658},	
  }

local blipsambulance = {
    -- Example {title="", colour=, id=, x=, y=, z=},
	{title="name", colour=29, blip=60, x=1853.1070556641, y=3687.4230957031, z=34.267078399658},	
  }
Citizen.CreateThread(function()
  if PlayerData.job.name == 'police' then
    for _, info in pairs(blipspolice) do
      info.blip = AddBlipForCoord(info.x, info.y, info.z)
      SetBlipSprite(info.blip, info.id)
	  SetBlipDisplay(info.blip, 4)
      SetBlipScale(info.blip, 0.9)
      SetBlipColour(info.blip, info.colour)
      SetBlipAsShortRange(info.blip, true)
      BeginTextCommandSetBlipName("STRING")
      AddTextComponentString(info.title)
      EndTextCommandSetBlipName(info.blip)
    end
  end

  if PlayerData.job.name == 'ambulance' then
    for _, info in pairs(blipsambulance) do
      info.blip = AddBlipForCoord(info.x, info.y, info.z)
      SetBlipSprite(info.blip, info.id)
	  SetBlipDisplay(info.blip, 4)
      SetBlipScale(info.blip, 0.9)
      SetBlipColour(info.blip, info.colour)
      SetBlipAsShortRange(info.blip, true)
      BeginTextCommandSetBlipName("STRING")
      AddTextComponentString(info.title)
      EndTextCommandSetBlipName(info.blip)
    end
  end
end)

#11

well i want it like on the police players not the police station


#12

so other cops can see eachother


#13

Hello, I’am trying to achieve something really similar and was told to move my topic here for help.

I’am having trouble with making some blips invisible to the police job.

The troublesome code for client/main.lua

ESX 			    			= nil
local PlayerData 				= {}

Citizen.CreateThread(function()
    while ESX == nil do
        TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
        Citizen.Wait(0)
    end
end)

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
  PlayerData = xPlayer
end)

RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
  PlayerData.job = job
end)

Citizen.CreateThread(function() --Blips
	
	if PlayerData.job.name == "police" then
		Citizen.Wait(0)
	else
		for i=1, #Config.Map, 1 do
		local crimblip = AddBlipForCoord(Config.Map[i].x, Config.Map[i].y, Config.Map[i].z)
		SetBlipSprite (crimblip, Config.Map[i].id)
		SetBlipScale  (crimblip, 0.9)
		SetBlipDisplay(crimblip, 4)
		SetBlipColour (crimblip, Config.Map[i].color)
		SetBlipAsShortRange(crimblip, true)

		BeginTextCommandSetBlipName("STRING")
		AddTextComponentString(Config.Map[i].name)
		EndTextCommandSetBlipName(crimblip)
	  end
	end
end)

but nothing happens, nothing is showing for everyone including cops.

This is the config.lua:

Config = {}

Config.Map = {
  {name="Yacht",color=15, id=410, x=-2045.800, y=-1031.200, z=11.900},
  {name="Coke Picking",color=4, id=501, x=2448.92, y=-1836.80, z=51.95},
  {name="Coke Processing",color=4, id=475, x=-458.13, y=-2278.61, z=7.51},
  {name="Coke Resell",color=4, id=434, x=-1756.19, y=427.31, z=126.68},
  {name="Meth Pickup",color=4, id=501, x=1525.29, y=1710.02, z=109.01},
  {name="Meth Processing",color=4, id=499, x=-1001.41, y=4848.01, z=274.01},
  {name="Meth Resell",color=4, id=434, x=-63.59, y=-1224.07, z=27.77},
  {name="Weed Picking",color=2, id=496, x=1609.125, y=6663.59, z=20.96},
  {name="Weed Processing",color=2, id=514, x=91.06, y=3750.03, z=39.77},
  {name="Weed Dropoff",color=2, id=434, x=-54.24, y=-1443.36, z=31.06},
  {name="Opium Pickup",color=7, id=501, x=1971.26, y=3823.17,  z=32.36},
  {name="Opium Processing",color=7, id=514, x=971.86,y=-2157.61, z=28.47},
  {name="Opium Dropoff",color=7, id=434, x=2331.08, y=2570.22, z=46.68}
}

Everything works fine as:

Citizen.CreateThread(function()
	
	for i=1, #Config.Map, 1 do
		
		local blip = AddBlipForCoord(Config.Map[i].x, Config.Map[i].y, Config.Map[i].z)
		SetBlipSprite (blip, Config.Map[i].id)
		SetBlipDisplay(blip, 4)
		SetBlipColour (blip, Config.Map[i].color)
		SetBlipAsShortRange(blip, true)

		BeginTextCommandSetBlipName("STRING")
		AddTextComponentString(Config.Map[i].name)
		EndTextCommandSetBlipName(blip)
	end

end)

Topic with stuff I have tried: Original post I made

Anyways,
your help is much appreciated, thanks for your time.