Foreach (Looping)? - 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)
+--- Thread: Foreach (Looping)? (
/showthread.php?tid=329537)
Foreach (Looping)? -
Reklez - 29.03.2012
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?
Re: Foreach (Looping)? -
Jonny5 - 29.03.2012
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.
Re: Foreach (Looping)? -
Reklez - 29.03.2012
Thanks johnny. well foreach is faster loop than the SAMP Normal Loop.