Thread Rating:
  • 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,864 11-07-2013, 13:41
Last Post: Nekochan
  Our Level Fastfile is Different from the Server. CheeseToast 6 11,327 11-03-2013, 17:52
Last Post: CheeseToast
  Player can write Fl0w_.JACKDAN 2 3,349 09-19-2013, 16:36
Last Post: Fl0w_.JACKDAN
  Help choose 2 random players?(1 each team) 26hz 6 4,649 09-12-2013, 17:32
Last Post: Yamato
  Help Permissions DOESNT work Hallla 2 3,050 08-18-2013, 11:28
Last Post: hillbilly
  why permissions dont work. ? ExoGamer* 4 3,269 07-21-2013, 13:46
Last Post: X-Track
  [CoD 4] Trying to set a player -- DidUknowiPwn 7 5,845 07-03-2013, 21:58
Last Post: Pozzuh
  [Release] Black Ops Single Player/Zombie Trainer V3.6 Craig87 52 88,563 07-01-2013, 15:12
Last Post: explosivebanana55
Video Preview AIZombies eXtreme 2.0 / Zombie Player (Music Player) DidUknowiPwn 4 5,868 06-24-2013, 16:37
Last Post: DidUknowiPwn
  "VEH_LinkCommonChecks: Player already has an owner" - After long games akillj 4 3,595 06-07-2013, 11:38
Last Post: akillj

Forum Jump:


Users browsing this thread:
4 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.