Jump to content

[HELP] Set Marker Invisible


opnaiC

Recommended Posts

Posted

Can anybody help me to set the marker "gasstationmarkes" invisible for players?

I know I need

setElementVisibleTo 

but I tried to inject it into the script but it dont worked for me!?

The marker is on the bottom of the script.

Here is the script:

local carFuel = {}; 
local gasStations = {}; 
local gasStationsBlip = {}; 
local gasStationsMarkers = {}; 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
    function() 
        local xml = xmlLoadFile("carData.xml"); 
        local xmlNodes = xmlNodeGetChildren(xml); 
        for i,node in ipairs(xmlNodes) do 
           carFuel[tonumber(xmlNodeGetAttribute(node,'id'))] = tonumber(xmlNodeGetAttribute(node,'fuel')); 
        end 
        xmlUnloadFile(xml); 
        local xml = xmlLoadFile("garageData.xml"); 
        local xmlNodes = xmlNodeGetChildren(xml); 
        for i,node in ipairs(xmlNodes) do 
            local name = xmlNodeGetAttribute(node,'name'); 
            local x = tonumber(xmlNodeGetAttribute(node,'x')); 
            local y = tonumber(xmlNodeGetAttribute(node,'y')); 
            local z = tonumber(xmlNodeGetAttribute(node,'z')); 
            gasStationsBlip[name] = createBlip(x,y,z,51,0,0,0,0,0,0,450); 
            local moreKids = xmlNodeGetChildren(node); 
            gasStationsMarkers[name] = {}; 
            for i,v in ipairs(moreKids) do 
                local mx = tonumber(xmlNodeGetAttribute(v,'x')); 
                local my = tonumber(xmlNodeGetAttribute(v,'y')); 
                local mz = tonumber(xmlNodeGetAttribute(v,'z')); 
                gasStationsMarkers[name][i] = createMarker(mx,my,mz,'corona',3,128,128,0,128); 
                setElementData(gasStationsMarkers[name][i],'gasStation',true); 
            end 
        end 
        xmlUnloadFile(xml); 
    end 
) 

Posted

createMarker comes with an argument called visibleTo, serversided.

visibleTo: This defines which elements can see the marker. Defaults to visible to everyone. See visibility.

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted
createMarker comes with an argument called visibleTo, serversided.
visibleTo: This defines which elements can see the marker. Defaults to visible to everyone. See visibility.

So this would be that the player can see it right?

 gasStationsMarkers[name][i] = createMarker(mx,my,mz,'corona',3,128,128,0,128,getRootElement(player)); 

How I can setup it that nobody can see it ?

Posted

if no-one should be able to see it I suggest turning down the alpha to 0

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

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