Foreach (Looping)?
#1

Somehow when i setplayercolor onplayerconnect it sets player color to all except to me

everyone's color is white but my color on scoreboard is violet.
i don't know why but i try this

pawn Код:
SetPlayerColor(playerid, COLOR_WHITE);
but still the same i try to use foreach (a faster looping include)
but still the same look at the code

pawn Код:
foreach(Player, i)
    {
        TextDrawShowForPlayer(i, STime);
        TextDrawShowForPlayer(i, RandomT);
        SetPlayerColor(i, COLOR_WHITE);
        SetPlayerMapIcon(i, 0, 1753.7834,-1906.0804,13.5648, 55, 1, MAPICON_LOCAL); //LS Taxi Company
        SetPlayerMapIcon(i, 1, 2045.9188,-1913.0162,13.5469, 55, 1, MAPICON_LOCAL); //LS License Central
        SetPlayerMapIcon(i, 2, 2244.5542,-1664.9602,15.4766, 45, 1, MAPICON_LOCAL); //LS Clothe Shop
        SetPlayerMapIcon(i, 3, 1480.9535,-1770.7400,18.7958, 52, 1, MAPICON_LOCAL); //LS Bank Central
    }
i know its correct but can i use foreach for setting playermapicon/playercolor/playertextdraw?
Reply
#2

yes you can
foreach is just a loop replacement,
it will act just like a normal loop does so you can do anything in it you can do in a normal loop.


as far as the first question im not sure why your color is not being set,
i will try this in my gm and see what happens ill update this post with my results.
Reply
#3

Thanks johnny. well foreach is faster loop than the SAMP Normal Loop.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)