• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
foreach( player in level.players ) don't work !
#1
How to walk "foreach (player in level.players)"?

Run this example:

foreach (player in level.players)
{
player iPrintLnBold("ItsMods");
player PlayLocalSound("flag_spawned");
}

Thx
  Reply
#2
for(i=0;i<level.players.size;i++)
{
player = level.players[i];
player iPrintLnBold("ItsMods");
player PlayLocalSound("flag_spawned");
}
helped ya? rep me +
  Reply
#3
Thx Smile
No, don't work.
uninitialised variable "player"
  Reply
#4
player = undefined;
for(i=0;i<level.players.size;i++)
{
player = level.players[i];
player iPrintLnBold("ItsMods");
player PlayLocalSound("flag_spawned");
}

or

for(i=0;i<level.players.size;i++)
{
level.players[i] iPrintLnBold("ItsMods");
level.players[i] PlayLocalSound("flag_spawned");
}
helped ya? rep me +
  Reply
#5
player = undefined;
for(i=0;i<level.players.size;i++)
{
player = level.players[i];
player iPrintLnBold("ItsMods");
player PlayLocalSound("flag_spawned");
}

WORKS ! Big thanks Smile
  Reply
#6
How do you use an if statement in this?

I tried this for example:
Code:
player = undefined;
    for(i=0;i<level.players.size;i++)
    {
        player = level.players[i];
        if (is_bot(player))
        {
            player takeAllWeapons();
        }
    }
But that doesn't do anything.
  Reply
#7
trolololol
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Sentry Gun kill = Player kill Snake 8 5,414 11-07-2013, 13:41
Last Post: Nekochan
  Our Level Fastfile is Different from the Server. CheeseToast 6 10,552 11-03-2013, 17:52
Last Post: CheeseToast
  Player can write Fl0w_.JACKDAN 2 3,086 09-19-2013, 16:36
Last Post: Fl0w_.JACKDAN
  Help choose 2 random players?(1 each team) 26hz 6 4,300 09-12-2013, 17:32
Last Post: Yamato
  Help Permissions DOESNT work Hallla 2 2,802 08-18-2013, 11:28
Last Post: hillbilly
  why permissions dont work. ? ExoGamer* 4 3,010 07-21-2013, 13:46
Last Post: X-Track
  [CoD 4] Trying to set a player -- DidUknowiPwn 7 5,234 07-03-2013, 21:58
Last Post: Pozzuh
  [Release] Black Ops Single Player/Zombie Trainer V3.6 Craig87 52 79,407 07-01-2013, 15:12
Last Post: explosivebanana55
Video Preview AIZombies eXtreme 2.0 / Zombie Player (Music Player) DidUknowiPwn 4 5,398 06-24-2013, 16:37
Last Post: DidUknowiPwn
  "VEH_LinkCommonChecks: Player already has an owner" - After long games akillj 4 3,192 06-07-2013, 11:38
Last Post: akillj

Forum Jump:


Users browsing this thread: 1 Guest(s)