• 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.
[-] The following 1 user says Thank You to Cyborgking for this post:
  • Romuald27
  Reply
#7
trolololol
  Reply


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

Forum Jump:


Users browsing this thread: 1 Guest(s)