SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 26/03/2017, 10:50 PM   #1
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default CreateDynamicMapIcon

I have this coordinates:

pawn Code:
new Float: WepShop[MAX_WEP_SHOPS][e_shops] =
{
{-85.2422, -1165.0312, 2.6328},
{-90.1406, -1176.6250, 2.6328},
{-92.1016, -1161.7891, 2.9609},
{1941.6562, -1778.4531, 14.1406}       
{2645.2500, 1111.7500, 11.2500}
};

I wanna use CreateDynamicMapIcon to create a map icon on all this coordinates without repeating code. How?
Face9000 is offline   Reply With Quote
Old 26/03/2017, 11:01 PM   #2
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,917
Reputation: 258
Default Re: CreateDynamicMapIcon

You can use a loop for that.
__________________
actor_plus - v5.0.2
I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath
Dayrion is offline   Reply With Quote
Old 26/03/2017, 11:16 PM   #3
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default Re: CreateDynamicMapIcon

Care to explain?
Face9000 is offline   Reply With Quote
Old 27/03/2017, 05:40 AM   #4
GoldenLion
Gangsta
 
GoldenLion's Avatar
 
Join Date: Sep 2014
Location: Estonia
Posts: 945
Reputation: 142
Default Re: CreateDynamicMapIcon

Loop through all the elements of the array like this:
Code:
for (new i; i < sizeof(WepShop); i++)
{
    //get the coordinates using WepShop[i][the thing from the enumerator here]
}
GoldenLion is offline   Reply With Quote
Old 28/03/2017, 07:43 PM   #5
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default Re: CreateDynamicMapIcon

Can you show me an example on how to use that loop?
Face9000 is offline   Reply With Quote
Old 28/03/2017, 09:26 PM   #6
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,067
Reputation: 106
Default Re: CreateDynamicMapIcon

Whats the point of it?
What will be different from 5 lines with coords and 5 lines with coords + CreateDynamicMapIcon?
I mean... Why?

Edit:

Try this:
PHP Code:
for (new isizeof(WepShop); i++)
{
    new 
Float:XFloat:YFloat:Z;
    
CreateDynamicMapIcon(XYZ,-1,-1,-1,-1,300);

jasperschellekens is online now   Reply With Quote
Old 29/03/2017, 08:18 AM   #7
jlalt
Banned
 
Join Date: Oct 2014
Location: Iran
Posts: 1,266
Reputation: 366
Default Re: CreateDynamicMapIcon

Well, when you do what you've did above you are actually inserting your data inside an enum variables.

so for example if you got:

PHP Code:
enum e_shops
{
    
Float:MapX,
    
Float:MapY,
    
Float:MapZ,
}; 
and then you insert the data into them like that:
PHP Code:
new FloatWepShop[][e_shops] =
{
    {-
85.2422, -1165.03122.6328},
    {-
90.1406, -1176.62502.6328},
    {-
92.1016, -1161.78912.9609},
    {
1941.6562, -1778.453114.1406},
    {
2645.25001111.750011.2500}
}; 
you would be able to loop by the size of WepShop, and use MapX, MapY, MapZ, to get the coords example:
PHP Code:
for(new 0sizeof WepShopi++)
{
    
printf("%f | %f | %f",WepShop[i][MapX],WepShop[i][MapY],WepShop[i][MapZ]);

Result you would get:
PHP Code:
-85.242202 | -1165.031250 2.632800
-90.140602 | -1176.625000 2.632800
-92.101600 | -1161.789062 2.960900
1941.656250 
| -1778.453125 14.140600
2645.250000 
1111.750000 11.250000 
jlalt is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CreateDynamicMapIcon help alishvasis Scripting Help 2 25/07/2016 12:53 PM
CreateDynamicMapIcon Banditukas Scripting Help 2 18/08/2014 03:10 PM
CreateDynamicMapIcon Banditukas Scripting Help 1 18/08/2014 11:19 AM
CreateDynamicMapIcon Banditukas Scripting Help 1 18/08/2014 08:14 AM
CreateDynamicMapIcon HELP ME PLEASE!!! [GM]GoGNi Help Archive 2 19/06/2011 11:53 AM


All times are GMT. The time now is 03:10 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.