Dude: foreach YSI. - 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: Dude: foreach YSI. (
/showthread.php?tid=584262)
Dude: foreach YSI. -
Unrea1 - 03.08.2015
Hello,
I wonder if the execution is good to know if this is what is causing me crash:
pawn Код:
foreach (new i : Player)
{
foreach(new j : Bot)
{
/* code */...
}
}
If the case were that this gives crash, how iteration "Character" would be used in this case ?, because I want to acknowledge on one side the players and on the other NPCs.
Код:
Iterators:
Player - List of all players connected.
Bot - List of all bots (npcs) connected.
NPC - Alias of Bot.
Character - All players and bots.
****** translator.., thanks for viewing.
AW: Dude: foreach YSI. -
Kaliber - 03.08.2015
Do just this:
PHP код:
foreach (new i : Character)
{
if(IsPlayerNPC(i))
{
//Here it is a NPC
continue;
}
//Here it is a Player
}
Re: Dude: foreach YSI. -
liquor - 03.08.2015
pawn Код:
foreach(Bot,i)
{
}
foreach(Character,i)
{
}
foreach(Player,i)
{
}
Re: Dude: foreach YSI. -
J0sh... - 03.08.2015
Quote:
Originally Posted by liquor
pawn Код:
foreach(Bot,i) {
}
foreach(Character,i) {
}
foreach(Player,i) {
}
|
New foreach versions now use stuff like new i : Player, i : Player ^that is the old syntax.