How to get 1 player with foreach
#1

Solved
Reply
#2

SetPlayerColor ( i, COLOR_TEAM_BLUE );
Reply
#3

Quote:
Originally Posted by Kitten
Посмотреть сообщение
How would i get 1 player to be set there color to blue like

using foreach was the best i think

for example

pawn Код:
foreach(Player,i)
{
    how would i do it to get 1 player to set there color to blue
    SetPlayerColor(playerid,COLOR_TEAM_BLUE);
}
Try to explain a bit better.

Trying to make an random dude blue?
Reply
#4

Solved
Reply
#5

pawn Код:
stock SelectPlayer()
{
    new ID;
    Start:
    ID = random(MAX_PLAYERS);
    goto Check;
    Check:
    if(!IsPlayerConnected(id)) goto Start;
    else return ID;
}

SetPlayerColor(SelectPlayer(), COLOR_TEAM_BLUE);
Reply
#6

Iter_Random(Player);
Reply
#7

Solved
Reply
#8

No, just SPC?

SetPlayerColor ( Iter_Random ( Player ), COLOR_TEAM_BLUE );
Reply
#9

Quote:
Originally Posted by Kitten
Посмотреть сообщение
so like this?
pawn Код:
foreach(Player,i)
{
    Iter_Random(Player);
    SetPlayerColor(Player,COLOR_TEAM_BLUE)
}
pawn Код:
stock RandomBlue()
{
    new Random = Iter_Random(Player);
    SetPlayerColor(Random, COLOR_TEAM_BLUE)
}
Reply
#10

pawn Код:
new ID = Iter_Random(Player);
SetPlayerColor(ID, COLOR_TEAM_BLUE)
Edit: Emm.. late.. also, you can make a stock to get a random player id:

pawn Код:
stock RandomPlayer()
{
    return Iter_Random(Player);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)