Jump to content

MTA doesn't recognize my image as a blip


Lord Henry

Recommended Posts

  • Other Languages Moderators

Hello everyone.

I programmed a script that create VIP houses and when it does, it creates a green house blip on the map where the house was created. When this house is bought out by someone, the blip is changed to red house blip.
But I want to keep an Yellow House blip instead of the green house blip.

The blips only appear on the map when I hold the key " i "

2fa5b1da4a3b4c82b228ff33a8e87057.png  (example of how it should appear)

The script calls the blips with this:

bindKey( 'i', 'both', function( key, keyState )
  if keyState == 'down' then
    for k, v in ipairs ( getElementsByType( 'marker', getResourceRootElement() ) ) do
      if getElementData( v, 'HSV_INFO' ) and getElementData( v, 'HSV_INFO' )[7] then
        if getElementData( v, 'HSV_INFO' )[7] ~= '' then
          createBlipAttachedTo( v, 32 ); --Red house blip
        else
          createBlipAttachedTo( v, 31 ); --Green house blip
	--createBlipAttachedTo( v, 64 ); --Yellow house blip
        end;
      end;
    end;
  else
    for k, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do
      if getElementData( v, 'HSV_INFO' ) then
        for k, elem in ipairs( getAttachedElements( v ) ) do
          if getElementType( elem ) == 'blip' then
            destroyElement( elem );
          end;
        end;
      end;
    end;
  end;
end );

I tried to create a new blip and call him, but the MTA doesn't recognize it and send a white square  instead of my new blip.

038aa767fa4d4f60805d32b093f8c714.png

Any idea?

Link to comment

In the code above ^ you're checking if the client pressed 'i' key, if so, the blips would show. Else if the state of the key is 'up' or 'released' then it would destroy those blips. Also, by replacing green house blip with yellow house blip, it will only change the blip for you, not for other players. Adding a blip won't work unless you make your own radar.

Link to comment
  • Other Languages Moderators
On 12/11/2016 at 2:29 PM, Gravestone said:

In the code above ^ you're checking if the client pressed 'i' key, if so, the blips would show. Else if the state of the key is 'up' or 'released' then it would destroy those blips. Also, by replacing green house blip with yellow house blip, it will only change the blip for you, not for other players. Adding a blip won't work unless you make your own radar.

Oh...
Thanks by the information, even if I could change that blip, it will show only to me, but I need to show to all players.
I will search a tutorial about creating my own radar.

Link to comment
  • Other Languages Moderators
1 hour ago, Gravestone said:

Is this code client sided? If so, make it server sided or you can use setElementVisibleTo and loop through all the players setting the blip visible to each.

Yes...

The resource have a client sided script and a server sided script. It calls the blips on the client sided script.

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