CreateDynamicMapIcon headache...
#1

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
Reply
#2

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

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.
Reply
#4

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

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

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]);
}
Reply
#6

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

-Conroy
Reply
#7

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

Ive still got the problem
Reply
#8

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 ^^
Reply
#9

hehe
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)