Giving goods to random player from team.
#1

Hello, how do I make that code picks a player randomly from TEAM_ONE and gives him extra goods, like armour, skin or something like that?
Reply
#2

pawn Код:
new PlayerList[MAX_PLAYERS];
new idx;
for(new i=0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(GetPlayerTeam(i) == TEAM_ONE)
        {
            PlayerList[idx] = i;
            idx++;
        }
    }
}
new randomplayer = PlayerList[random(idx)];
GivePlayerMoney(randomplayer, 10000);
SetPlayerArmour(randomplayer, 100);
Reply
#3

Thank you very much, I guess it worked.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)