SA-MP Forums Archive
CreateDynamicMapIcon headache... - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: CreateDynamicMapIcon headache... (/showthread.php?tid=177017)



CreateDynamicMapIcon headache... - Ash. - 15.09.2010

Hi all,
Im really tired tonight so it might be my stupid mistake somewhere but can someone take a look at this:

I am trying to set a players map icon using CreateDynamicMapIcon from Incognitos Streamer. I also use the streamer for objects and they're all fine so i know the streamer is loading. The map icons (map icon: 52) works perfectly on a windows server (0.3b R2 build) however, on linux (0.3b R2 build) it doesnt work.

I basically have an array, full of x, y, and z co-ordinates. And am creating the map icons like so:

pawn Код:
public OnPlayerSpawn(playerid)
{
     for(new a; a < sizeof(pickups); a++) //pickups being my array name
     {
         CreateDynamicMapIcon(pickups[a][fx], pickups[a][fy], pickups[a][fz], 56, 0, 0, 0, playerid, 100.0);
             Streamer_Update(playerid); //Just to make sure :)
     }
}
I just cannot see whats going wrong.

Does somebody know how to resolve this?

Thanks
Ash


Re: CreateDynamicMapIcon headache... - willsuckformoney - 15.09.2010

pawn Код:
for(new a=0;a<MAX_PICKUPS;a++)
    {



Re: CreateDynamicMapIcon headache... - Ash. - 15.09.2010

Surely that just changes the number defined in "a" and so it doesnt really matter? as "pickups" will be less then "MAX_PICKUPS"

That also means that im looping through the code more times than neccessary.

This forum requires that you wait 120 seconds between posts. Please try again in 4 seconds.


Re: CreateDynamicMapIcon headache... - Conroy - 15.09.2010

for(new a; a < sizeof(pickups); a++) will not include the last pickup.

for(new a; a <= sizeof(pickups); a++) will.


Re: CreateDynamicMapIcon headache... - Vince - 15.09.2010

You should never use '<=' in this case. This is a common OOB (Out Of Bounds) error.

pawn Код:
new array[5] = {1, 2, ...};

/*
    sizeof(array) is clearly 5, so when using the <= operator,
    You're trying to access array[5], which doesn't exist.
*/


for(new i; i < sizeof(array); i++)
{
    printf("%d", array[i]);
}



Re: CreateDynamicMapIcon headache... - Conroy - 16.09.2010

Oh, I forgot the array rule. Starts at 0. Thanks for reminding me.

-Conroy


Re: CreateDynamicMapIcon headache... - Ash. - 18.09.2010

Soo then, does anyone have a fix? Sorry i havent been checking this thread, ive been at school

Ive still got the problem


Re: CreateDynamicMapIcon headache... - nemesis_567 - 14.04.2011

CreateDynamicMapIcon is not player dependent so there is no point in placing it in such a callback. OnGameModeInit is a good idea.

EDIT: LOL, just noticed this is from 2010 ^^


Re: CreateDynamicMapIcon headache... - sciman001 - 23.04.2011

hehe