Jump to content

Help "blip vehicle visible for gang" help pls :C


araiza12

Recommended Posts

I'm using the datas of gang no of team

ex:

 

vehicles_blips = {}
root = getRootElement()
function blip ()
pla = getElementsByType ( "player" )
for k,x in ipairs(pla) do
if ( getElementData (x, "gang" ) == "123" )then
blip = createBlipAttachedTo(MiAuto,2,2,255,55,0,255)
vehicles_blips[MiAuto] = blip
setElementVisibleTo (blip,x, true )
end
end
end
setTimer(blip,3000,1)

function destroyb(player)
play = getElementsByType ( "player" )
for k,z in ipairs(play) do
if ( getElementData (z, "gang" ) == "None" )then
 local blip = vehicles_blips[MiAuto]
 destroyElement(blip) 
 vehicles_blips[MiAuto] = nil
end
end
end
setTimer(destroyb,3000,0)

it's not deleted when leaving the gang :c and try everytring helpme pls

not work

Edited by araiza12
Link to comment

There's and 'visibleTo' argument already in "createBlipAttachedTo" function.

Server Side :-

vehicles_blips = {}

function blip ()
  local pla = getElementsByType ( "player" )
    for k,x in ipairs (pla) do
        if ( getElementData (x, "gang" ) == "123" )then
            vehicles_blips[MiAuto] = createBlipAttachedTo(MiAuto,2,2,255,55,0,255,0,1000,x)
        end
    end
end
setTimer(blip,3000,1)
 
function destroyb(player)
  local play = getElementsByType ( "player" )
    for k,z in ipairs (play) do
        if ( getElementData (z, "gang" ) == "None" )then
          local blip = vehicles_blips[MiAuto]
            destroyElement(blip)
            vehicles_blips[MiAuto] = nil
        end
	end
end
setTimer(destroyb,3000,0)

 

Edited by DeadthStrock
Link to comment

check that element exists !

vehicles_blips = {}

function blip ()
  local pla = getElementsByType ( "player" )
    for k,x in ipairs (pla) do
        if ( getElementData (x, "gang" ) == "123" )then
            vehicles_blips[MiAuto] = createBlipAttachedTo(MiAuto,2,2,255,55,0,255,0,1000,x)
        end
    end
end
setTimer(blip,3000,1)
 
function destroyb(player)
  local play = getElementsByType ( "player" )
    for k,z in ipairs (play) do
        if ( getElementData (z, "gang" ) ~= "123" )then
          local blip = vehicles_blips[MiAuto]
		    if isElement(blip) then
                destroyElement(blip)
                vehicles_blips[MiAuto] = nil
			end
        end
	end
end
setTimer(destroyb,3000,0)

 

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...