PDA

View Full Version : [Tutorial] How to add map icons.


captainjohn
21/02/2011, 06:07 PM
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.
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
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:
SetPlayerMapIcon(playerid, 1,
SetPlayerMapIcon(playerid, 2,
SetPlayerMapIcon(playerid, 3,

So now it will look like this.
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.
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)

SetPlayerMapIcon(playerid, 1, -2185.1511, 2412.7346,

Now for Float Z, just repeat the above step.
Again add the comma and space.
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) http://wiki.sa-mp.com/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.
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.
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 ;

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.

Stigg
21/02/2011, 07:13 PM
Edit: delete me.

captainjohn
21/02/2011, 10:13 PM
Fail.

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

http://wiki.sa-mp.com/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.

alpha500delta
21/02/2011, 10:20 PM
Shouldnt it be MAPICON_LOCAL instead of 0?

captainjohn
21/02/2011, 10:38 PM
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.

Stigg
21/02/2011, 11:26 PM
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:

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

captainjohn
21/02/2011, 11:28 PM
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.

Stigg
21/02/2011, 11:42 PM
Edit: delete me.

alpha500delta
22/02/2011, 10:28 AM
And what if you want to create multiple? you should explain that you cannot do this 2 times:

SetPlayerMapIcon(playerid, 1, //ID must be changed :p

captainjohn
22/02/2011, 11:29 AM
And what if you want to create multiple? you should explain that you cannot do this 2 times:

SetPlayerMapIcon(playerid, 1, //ID must be changed :p

I will edit my post and put that, I completely forgot about this.

KyleSmith
22/02/2011, 11:32 AM
Stigg, I suggest you be quite. All he is doing is trying to teach others. Unlike you where you have made no contribution to the community.

kthxbai.

Stigg
22/02/2011, 11:41 AM
Edit: delete me.

captainjohn
22/02/2011, 11:23 PM
As long as I have taught someone something new, I am happy.

KyleSmith
24/02/2011, 12:55 AM
Why a personal dig at me. How do you know what i've done and what i hav'nt done.
I've helped many people. I voiced my opinion, or is'nt that allowed!

Keep your kneb out m8.

Peace...

one word. lul.

bousla7e
20/04/2011, 02:44 PM
thanx captain john u really helped me :)

GangsTa_
20/04/2011, 03:19 PM
At least he noticed that there are no tutorials regarding the map icons.

TheArcher
20/04/2011, 03:28 PM
I think for beginners is better that they go on wiki as i said in some topics. This is very easy so dont needs tutorial like this. But anyways good job for efort

captainjohn
22/04/2011, 02:36 PM
I think for beginners is better that they go on wiki as i said in some topics. This is very easy so dont needs tutorial like this. But anyways good job for efort

Yes well sometimes the wiki isn't clear enough for some players, so this is why I created this.

TheArcher
22/04/2011, 02:52 PM
Yes well sometimes the wiki isn't clear enough for some players, so this is why I created this.

Yes you right about that, some exemple scripts on wiki are difficult to learn, and yes this tutorial may be useful.

devilsnightmare
27/05/2011, 11:33 AM
why the space after each comma works fine without it for me

BASITJALIL
28/05/2011, 02:35 AM
Nice work

SRB
01/01/2014, 11:55 PM
i got a bug

SetPlayerMapIcon(playerid, 1, 1568.5, -1693.5, 6.0, 30, 0 );
SetPlayerMapIcon(playerid, 2, -1590.0, 716.25, -5.0, 30, 0 );
SetPlayerMapIcon(playerid, 3, 2275.0, 2460.0, 10.9, 30, 0 );
SetPlayerMapIcon(playerid, 4, -525.0, -502.0, 26.0, 60, 0 );
SetPlayerMapIcon(playerid, 5, -74.7, -1137.5, 4.5, 60, 0 );
SetPlayerMapIcon(playerid, 6, 1457.0, 975.5, 11.0, 60, 0 );
SetPlayerMapIcon(playerid, 7, -2136.0, -247.5, 36.5, 60, 0 );
SetPlayerMapIcon(playerid, 8, 1766.5, -2040.7, 14.0, 60, 0 );
SetPlayerMapIcon(playerid, 9, -546.0, 2594.0, 54.0, 60, 0 );
SetPlayerMapIcon(playerid, 10, 332.0, 900.0, 25.0, 60, 0 );
SetPlayerMapIcon(playerid, 11, -1575.0, -2724.0, 49.0, 60, 0 );
SetPlayerMapIcon(playerid, 12, 2919.66, 2118.16, 17.89, 60, 0 );
SetPlayerMapIcon(playerid, 13, -2231.9080, 2326.6833, 7.5469, 60, 0 );

From 1 - 3 you can see the icons in 2 sec when yous spawn and then they're gone

shubham20
11/04/2014, 01:22 PM
Dude I have a moneybag script I want the map icon to change every time a new moneybag hunt starts.
How can i do that?????