SA-MP Forums Archive
[Tutorial] How to add map icons. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to add map icons. (/showthread.php?tid=229400)



How to add map icons. - captainjohn - 21.02.2011

I have noticed that quite alot of people are having problems with adding icons to there map.
I will teach you.

First of all open your filterscript you are wanting to add your map icon to.

Then search for this.
pawn Код:
public OnPlayerConnect(playerid)
{
Then anywere in this, we will add the map icons, I like to add them at the top of it.

First of all, we make a new line under OnPlayerConnect.
Then add this
pawn Код:
SetPlayerMapIcon(playerid,
After were it says playerid, hit your spacebar once, to create a space.
Now add your ID you want (in my case it is ID 1) This ID is used in if you want to remove your map icon or make a command to remove the map icon. After you enter your ID put a comma next to it and then hit the spacebar again.

Please remember, if you are using more than one icon, to change the ID each time.
For example:
pawn Код:
SetPlayerMapIcon(playerid, 1,
SetPlayerMapIcon(playerid, 2,
SetPlayerMapIcon(playerid, 3,
So now it will look like this.
pawn Код:
SetPlayerMapIcon(playerid, 1,
Now we want to add the icons location.
In my case I am going to add the map icon at Bayside Marina.

The location is divided down into 3 categories.
Float X
Float Y
Float Z

Here is mine.
Float X = -2185.1511
Float Y = 2412.7346
Float Z = 5.1563

Now we are going to add the locations in our icon code.
After the space which we created above, we will add Float x.

Once again put a comma and hit space bar again.
pawn Код:
SetPlayerMapIcon(playerid, 1, -2185.1511,
Now for Float Y. Repeat the above step but add your Float Y. (don't forget to add the comma and space)

pawn Код:
SetPlayerMapIcon(playerid, 1, -2185.1511, 2412.7346,
Now for Float Z, just repeat the above step.
Again add the comma and space.
pawn Код:
SetPlayerMapIcon(playerid, 1, -2185.1511, 2412.7346, 5.1563,
Now we have added the location into it, we will go onto the ID for your icon.
Visit this webpage for a list of icons (with thumbnails) https://sampwiki.blast.hk/wiki/MapIcons . Choose your ID you want.
For this tutorial I will choose, ID number 9 (boat yard). Now this ID is important, without the ID you won't get the icon in-game.

Once you have your ID, put the ID after Float Z.
Remember to add your comma and space.
pawn Код:
SetPlayerMapIcon(playerid, 1, -2185.1511, 2412.7346, 5.1563, 9,
Now the last bit.
After the icon ID, put a 0 there. If you are using icon ID 1 (white square), you can add different numbers which will resemble different colours for the white square. I won't go into all the colours, as I don't see a point.

Now your code should look like this.
pawn Код:
SetPlayerMapIcon(playerid, 1, -2185.1511, 2412.7346, 5.1563, 9, 0
Now all you need to do is add another space and a closed bracet ) following a semi-colon ;

pawn Код:
SetPlayerMapIcon(playerid, 1, -2185.1511, 2412.7346, 5.1563, 9, 0 );
Now we have finished.




I hope I helped you, who needed help on map icons.


Re: How to add map icons. - Stigg - 21.02.2011

Edit: delete me.


Re: How to add map icons. - captainjohn - 21.02.2011

Quote:
Originally Posted by Stigg
Посмотреть сообщение
Fail.

Thats a out dated tutorial on map icons. Here is all you need to know.

https://sampwiki.blast.hk/wiki/SetPlayerMapIcon

Peace...
How is it out of date?

Everything in my thread and that page are done the same way, so I don't see how it's out of date.


Re: How to add map icons. - alpha500delta - 21.02.2011

Shouldnt it be MAPICON_LOCAL instead of 0?


Re: How to add map icons. - captainjohn - 21.02.2011

Quote:
Originally Posted by alpha500delta
Посмотреть сообщение
Shouldnt it be MAPICON_LOCAL instead of 0?
That ID 0 is for no colour, you can only add colour to the White square icon. So all other icons apart from the White square must have ID 0 at the end.


Re: How to add map icons. - Stigg - 21.02.2011

Quote:
Originally Posted by captainjohn
Посмотреть сообщение
How is it out of date?

Everything in my thread and that page are done the same way, so I don't see how it's out of date.
So what about:

pawn Код:
0: MAPICON_LOCAL                        Display in the player's local area
1: MAPICON_GLOBAL                      Display always
2: MAPICON_LOCAL_CHECKPOINT     Display in the player'
s local area and has a checkpoint marker
3: MAPICON_GLOBAL_CHECKPOINT    Display always and has a checkpoint marker
I dont see that info in your tut.

Peace...


Re: How to add map icons. - captainjohn - 21.02.2011

That is optional at the end, I didn't go into that detail I didn't think it was needed as this is a tutorial for beginner people.


Re: How to add map icons. - Stigg - 21.02.2011

Edit: delete me.


Re: How to add map icons. - alpha500delta - 22.02.2011

And what if you want to create multiple? you should explain that you cannot do this 2 times:

pawn Код:
SetPlayerMapIcon(playerid, 1, //ID must be changed :p



Re: How to add map icons. - captainjohn - 22.02.2011

Quote:
Originally Posted by alpha500delta
Посмотреть сообщение
And what if you want to create multiple? you should explain that you cannot do this 2 times:

pawn Код:
SetPlayerMapIcon(playerid, 1, //ID must be changed :p
I will edit my post and put that, I completely forgot about this.