Jump to content

help me in blips [sloved]


Desaster

Recommended Posts

I did so but the problem was I think bad element pointer :P idk why

  
function showblips()  
    for ID in pairs(bankMarkers) do  
        if not (blip) then 
            x, y, z = bankMarkers[ID][1], bankMarkers[ID][2], bankMarkers[ID][3] 
            blip = createBlip ( x, y, z, 52, 2, 255, 0, 0, 255, 0, 200 ) 
        else 
            destroyElement(ID) 
        end 
    end 
end 
addCommandHandler("showatm", showblips) 

Edited by Guest
Link to comment

Try this;

local blips = {}; 
  
addCommandHandler ( "showatm", 
    function () 
        for index, blip in ipairs ( bankMarkers ) do 
            if not ( #blips > 0 ) then 
                table.insert ( blips, { blipid, bankMarkers[1], bankMarkers[2], bankMarkers[3] }; 
            else 
                destroyElement ( blips ); 
            end 
        end 
         
        for i, b in ipairs ( blips ) do 
            createBlip ( b[1], b[2], b[3], b[4] ); 
        end 
    end 
); 

Link to comment

Well, this is kind of a weird way of doing it but im sure it would work.

[[NOT TESTED]]

local bankMarkers = {  
    {562.79998779297, -1254.5999755859, 16.89999961853, 284, false}, 
    {1001.700012207, -929.40002441406, 41.799999237061, 278.74658203125, false}  
} 
local blips = { } 
  
function executeCheck ( ) 
    for i, v in ipairs ( bankMarkers ) do 
        local str = table.concat ( { v[1], v[2], v[3], v[4] }, "," ) 
        if ( v[5] ) then 
            bankMarkers[i][5] = false 
            if ( isElement ( blips[str] ) ) then 
                destroyElement ( blips[str] ) 
            end 
        else 
            bankMarkers[i][5] = true 
            if ( not isElement ( blips[str] ) ) then 
                blip[str] = createBlip ( v[1], v[2], v[3] ) 
            end 
        end 
    end 
end 

Link to comment

Try this:

local bankMarkers = { 
    {562.79998779297, -1254.5999755859, 16.89999961853, 284, false}, 
    {1001.700012207, -929.40002441406, 41.799999237061, 278.74658203125, false} 
} 
local blips = { } 
local isViewingBlip = {} 
  
function executeCheck ( source ) 
    if isViewingBlip[source] then 
        for i,v in ipairs(blips[source]) do 
            if isElement(v) then 
                destroyElement(v) 
            end 
        end 
        blips[source] = {} 
        isViewingBlip[source] = false 
    else 
        if not blips[source] then 
            blips[source] = {} 
        end 
        for i,v in ipairs(bankMarkers) do 
            local id,x,y,z = unpack(v) 
            local b = createBlip(id, x, y, z) 
            table.insert(blips[source], b) 
        end 
    isViewingBlip[source] = true 
    end 
end 
addCommandHandler("showatm", executeCheck) 

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