SetPlayerMapIcon
From SA-MP Wiki
(Difference between revisions)
Revision as of 03:30, 11 March 2015 Kilou (Talk | contribs) ← Previous diff |
Revision as of 00:06, 13 May 2015 MP2 (Talk | contribs) Next diff → |
||
Line 1: | Line 1: | ||
{{Scripting}} | {{Scripting}} | ||
- | {{Description|This function allows you to place your own icons on the map, enabling you to emphasise the locations of banks, airports or whatever else you want. A total of 63 icons are available in GTA: San Andreas, all of which can be used using this function. You can also specify the color of the icon, which allows you to change the square icon (ID: 0)}} | + | {{Description|Place an icon/marker on a player's map. Can be used to mark locations such as banks and hospitals to players.}} |
{{Parameters|playerid, iconid, Float:x, Float:y, Float:z, markertype, color, style}} | {{Parameters|playerid, iconid, Float:x, Float:y, Float:z, markertype, color, style}} | ||
{{Param|playerid|The ID of the player to set the map icon for.}} | {{Param|playerid|The ID of the player to set the map icon for.}} | ||
- | {{Param|iconid|The player's icon ID, ranging from 0 to 99, to be used in RemovePlayerMapIcon.}} | + | {{Param|iconid|The player's icon ID, ranging from 0 to 99. This means there is a maximum of 100 map icons. ID can be used in [[RemovePlayerMapIcon]].}} |
- | {{Param|Float:x|The X coordinate of the place where you want the icon to be.}} | + | {{Param|Float:x|The X coordinate to place the map icon at.}} |
- | {{Param|Float:y|The Y coordinate of the place where you want the icon to be.}} | + | {{Param|Float:y|The Y coordinate to place the map icon at.}} |
- | {{Param|Float:z|The Z coordinate of the place where you want the icon to be.}} | + | {{Param|Float:z|The Z coordinate to place the map icon at.}} |
{{Param|markertype|The [[MapIcons|icon]] to set.}} | {{Param|markertype|The [[MapIcons|icon]] to set.}} | ||
- | {{Param|color|The color of the icon, this should only be used with the square icon (ID: 0).}} | + | {{Param|color|The color of the icon. This should only be used with the square icon (ID: 0).}} |
{{Param|style|The [[MapIconStyle|style]] of icon.}} | {{Param|style|The [[MapIconStyle|style]] of icon.}} | ||
- | {{Return|This function returns 1 if it was successful, and 0 otherwise (e.g. the player isn't connected).}} | + | {{ReturnsSuccess||Player is not connected.}} |
{{note|If you use an invalid icon ID, it will create ID 1 (White Square)}} | {{note|If you use an invalid icon ID, it will create ID 1 (White Square)}} | ||
- | {{note2|You can only have 100 mapicons!}} | + | |
+ | {{notes2| | ||
+ | * You can only have 100 map icons! | ||
+ | * Map icon ID 1 ([[Image:Icon_1.gif]]), 2 ([[Image:Icon_2.gif]]), 4 ([[Image:Icon_4.gif]]), and 56 ([[Image:Icon_56.gif]]) will cause your game to crash if you have map legends enabled while viewing the map. | ||
+ | }} | ||
<pawn> | <pawn> | ||
Line 23: | Line 27: | ||
// This example demonstrates how to create a dollar-icon on top of a 24/7 located | // This example demonstrates how to create a dollar-icon on top of a 24/7 located | ||
// in Las Venturas. This way new players know where to go with their money! | // in Las Venturas. This way new players know where to go with their money! | ||
- | SetPlayerMapIcon( playerid, 12, 2204.9468, 1986.2877, 16.7380, 52, 0, MAPICON_LOCAL ); | + | SetPlayerMapIcon(playerid, 12, 2204.9468, 1986.2877, 16.7380, 52, 0, MAPICON_LOCAL); |
} | } | ||
</pawn> | </pawn> |
Revision as of 00:06, 13 May 2015
Description:
Place an icon/marker on a player's map. Can be used to mark locations such as banks and hospitals to players.
(playerid, iconid, Float:x, Float:y, Float:z, markertype, color, style)
playerid | The ID of the player to set the map icon for. |
iconid | The player's icon ID, ranging from 0 to 99. This means there is a maximum of 100 map icons. ID can be used in RemovePlayerMapIcon. |
Float:x | The X coordinate to place the map icon at. |
Float:y | The Y coordinate to place the map icon at. |
Float:z | The Z coordinate to place the map icon at. |
markertype | The icon to set. |
color | The color of the icon. This should only be used with the square icon (ID: 0). |
style | The style of icon. |
Return Values:
- 1: The function executed successfully.
- 0: The function failed to execute. Player is not connected.
public OnPlayerConnect( playerid ) { // This example demonstrates how to create a dollar-icon on top of a 24/7 located // in Las Venturas. This way new players know where to go with their money! SetPlayerMapIcon(playerid, 12, 2204.9468, 1986.2877, 16.7380, 52, 0, MAPICON_LOCAL); }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- RemovePlayerMapIcon: Remove a map icon for a player.
- SetPlayerMarkerForPlayer: Set a player's marker.