Remove player blips without disabling scripthook

ah, I was gonna say thought my life was a lie haha

This is what Iā€™m working with at the moment

Citizen.CreateThread(function()
    
     while true do
    local blipIterator = GetBlipInfoIdIterator()
    local blip = GetFirstBlipInfoId(blipIterator)
    
     while DoesBlipExist(blip) do
           -- check if player
          local entity = GetBlipInfoIdEntityIndex(blip)
          if entity then -- it is attached to entity?
               if IsEntityAPed(entity) and IsPedAPlayer(GetPedFromEntityIndex(entity)) then -- is a player?
				   SetBlipScale(blip,0.0)
               end
          end
          blip = GetNextBlipInfoId(blipIterator)
     end
 Citizen.Wait(0)
  end

end)

Put the citizen.wait after the while true loop

Citizen.CreateThread(function()

    while true do
    Citizen.Wait(0)
    local blipIterator = GetBlipInfoIdIterator()
    local blip = GetFirstBlipInfoId(blipIterator)

     while DoesBlipExist(blip) do
           -- check if player
          local entity = GetBlipInfoIdEntityIndex(blip)
          if entity then -- it is attached to entity?
               if IsEntityAPed(entity) and IsPedAPlayer(GetPedFromEntityIndex(entity)) then -- is a player?
				   SetBlipScale(blip,0.0)
               end
          end
          blip = GetNextBlipInfoId(blipIterator)
     end
  end
end)



Shouldnā€™t matter if its at the end or beginning of the loop :stuck_out_tongue:

1 Like

oh okay, i just usually put it at the beginning just so i dont forget it

im probably gonna set this up with a command too

What would be the purpose of a command if you want to remove blips from a server? Unless, you made an admin command to toggle the blips being removed.

Was this working for you, by the way? Testing now and itā€™s not working

well our vps broke so i cant really test but ive started up my server locally and getting someone in

Yeah, doesnt work for me either

Ok so, it appears I gave you some false information 2 weeks ago :cry:

Try the following and tell me if it works:

Citizen.CreateThread(function()

    while true do
		Citizen.Wait(0)
		local blip = GetFirstBlipInfoId(8) -- 8 is the ID of player sprites :)

		while DoesBlipExist(blip) do
		    -- No need to check if player :D
			SetBlipAlpha(blip, 0)
			
			blip = GetNextBlipInfoId(8)
		end
	end
end)

Haha, saw something about that in the scripting channel, my friends just installing fivem so i will test it then :smiley: Thanks!

Just tested, and unfortunately didnā€™t work :confused:

Thatā€™s because Iā€™m an idiotā€¦ Iā€™ve been coding too long today :frowning:

This should work (Iā€™m like 90% certain):

Citizen.CreateThread(function()

   while true do
   	Citizen.Wait(0)
    local playerSprite = 6 -- look at http://gtaxscripting.blogspot.co.uk/2016/05/gta-v-blips-id-and-image.html and double check for me :)
   	local blip = GetFirstBlipInfoId(playerSprite)

   	while DoesBlipExist(blip) do
   	    -- No need to check if player :D
   		SetBlipAlpha(blip, 0)
   		
   		blip = GetNextBlipInfoId(playerSprite)
   	end
   end
end)
1 Like

Alright, will check in a few

Iā€™ve tried different ways, setting the alpha, changing the location, deleting it, nothing works :frowning:

From what I have seen in another topic, itā€™s not possible, because Lambda just constantly recreates the blips every tick.

Turns out, LambdaMenu uses a different blip IDs (changing based on vehicle)ā€¦

You might have to loop through them and check if itā€™s a playerā€¦

local blipIds = {
	1,274,421,424,423,422,
	426,404,308,427,226,56,
	198,67,68,318,225,274
}

function isBlipAttachedToPlayer( blip )
	local entity = GetBlipInfoIdEntityIndex(blip)
	if entity then -- it is attached to entity?
		if IsEntityAPed(entity) and IsPedAPlayer(GetPedIndexFromEntityIndex(entity)) then -- is a player?
			return true
		end
	end
	
	return false
end

Citizen.CreateThread(function()
    while true do
		Citizen.Wait(0)
		
		for _,v in pairs(blipIds) do
			local blip = GetFirstBlipInfoId(v)

			while DoesBlipExist(blip) do
				if isBlipAttachedToPlayer(blip) then
					SetBlipAlpha(blip, 0) -- Lambda doesn't touch alpha, it's safe to set it :)
				end
				
				blip = GetNextBlipInfoId(v)
			end

		end
	end
end)

Edit:
It doesnā€™t look like it ā€œconstantlyā€ re-created a blip, only when itā€™s removed. So, setting the alpha (the scale is changed by lambda so, changing that wouldnā€™t work) should stop it from showing. You could probably add a check to make sure blipā€™s apha only getā€™s set to 0 once (save on resources?)

Edit 2:
Or, the ā€œplayerSpriteā€ could just be 1ā€¦

Used your latest, and this is the error in the f8 console:

1 Like

Yeaā€¦ My bad, the native is GetPedIndexFromEntityIndex