SA-MP Forums Archive
SetMapIcon - 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: SetMapIcon (/showthread.php?tid=122911)



SetMapIcon - nesty - 23.01.2010

Simple question i hope How can I set a Map Icon for everybody?

pawn Код:
SetPlayerMapIcon(playerid, 1,326.3,-35.2,3.3, 30, 0 );



Re: SetMapIcon - Butilka - 23.01.2010

Use looping.
Код:
for(new i = 0; i <= GetMaxPlayers(); i++) SetPlayerMapIcon(i,1,326.3,-35.2,3.3,30,0);



Re: SetMapIcon - Streetplaya - 23.01.2010

Quote:
Originally Posted by E1edge
Use looping.
Код:
for(new i = 0; i <= GetMaxPlayers(); i++) SetPlayerMapIcon(i,1,326.3,-35.2,3.3,30,0);
that's one iteration too much.. use
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
  SetPlayerMapIcon(i,1,326.3,-35.2,3.3,30,0);
}



Re: SetMapIcon - Butilka - 23.01.2010

There is no need to add brackets.


Re: SetMapIcon - nesty - 23.01.2010

thanks for the replies but it still doesn't work maybe i didn't see the mistake so i've presented the code:

pawn Код:
public Conquersystem(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if((CONQUERED_BASE_PD==0)||(CONQUERED_BASE_PD==2))
{
    CONQUERED_BASE_PD = 1;
    SendClientMessageToAll(COLOR_RED,"TEAM BLUE has conquered the PD!");
    SetPlayerMapIcon(i, 1,326.3,-35.2,3.3, 30, 0 );
    RemovePlayerMapIcon(i, 2);
    PercentConquered[playerid] = 0;
}
}
}
hope someone find the problem


Re: SetMapIcon - Vetle - 23.01.2010

pawn Код:
public Conquersystem(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if((CONQUERED_BASE_PD==0)||(CONQUERED_BASE_PD==2))
        {
            CONQUERED_BASE_PD = 1;
            SendClientMessageToAll(COLOR_RED,"TEAM BLUE has conquered the PD!");
            for(new i; i < MAX_PLAYERS; i++)
            {
                SetPlayerMapIcon(i, 1,326.3,-35.2,3.3, 30, 0);
                RemovePlayerMapIcon(i, 2);
            }
            PercentConquered[playerid] = 0;
        }
    }
}



Re: SetMapIcon - nesty - 23.01.2010

lol thanks but if i add these lines to my script a warning appears:
pawn Код:
warning 219: local variable "i" shadows a variable at a preceding level
and when i play the game the synchronization breaks down but why?
and how can i fix this warning?


Re: SetMapIcon - Vetle - 24.01.2010

pawn Код:
public Conquersystem(playerid)
{
    if((CONQUERED_BASE_PD==0)||(CONQUERED_BASE_PD==2))
    {
        CONQUERED_BASE_PD = 1;
        SendClientMessageToAll(COLOR_RED,"TEAM BLUE has conquered the PD!");
        for(new i; i < MAX_PLAYERS; i++)
        {
            SetPlayerMapIcon(i, 1,326.3,-35.2,3.3, 30, 0);
            RemovePlayerMapIcon(i, 2);
        }
        PercentConquered[playerid] = 0;
    }
}
there