Desaster Posted November 9, 2013 Share Posted November 9, 2013 (edited) how to create blips and to remove them with the same function Edited November 12, 2013 by Guest Link to comment
Castillo Posted November 9, 2013 Share Posted November 9, 2013 Check if the blip exists, if so, remove it, else, create it. Link to comment
Desaster Posted November 9, 2013 Author Share Posted November 9, 2013 (edited) I did so but the problem was I think bad element pointer 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 November 10, 2013 by Guest Link to comment
tosfera Posted November 9, 2013 Share Posted November 9, 2013 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
Desaster Posted November 10, 2013 Author Share Posted November 10, 2013 still nothing Link to comment
tosfera Posted November 10, 2013 Share Posted November 10, 2013 You want them when the resource starts or with a command, or when an event get triggered? Link to comment
Desaster Posted November 10, 2013 Author Share Posted November 10, 2013 I want them just with the same command put them or remove them depents on their stat example of my table : local bankMarkers = { {562.79998779297, -1254.5999755859, 16.89999961853, 284}, {1001.700012207, -929.40002441406, 41.799999237061, 278.74658203125}, } Link to comment
xXMADEXx Posted November 10, 2013 Share Posted November 10, 2013 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
Desaster Posted November 11, 2013 Author Share Posted November 11, 2013 your one xXMADEXx create 1 blips every time i type /showatm and another one if I re-type it I want just with /showatm to crate all blips and to remove them after Link to comment
Desaster Posted November 11, 2013 Author Share Posted November 11, 2013 really no one can help me ? Link to comment
Sasu Posted November 12, 2013 Share Posted November 12, 2013 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
Desaster Posted November 12, 2013 Author Share Posted November 12, 2013 thnx finally sloved Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now