PDA

View Full Version : Random Player


BuLLeT[LTU]
23/02/2010, 12:01 PM
Jau isspresta, uz tai dekui Blantui. Turetu atrodyti mazdaug taip:


new UsedID[MAX_PLAYERS] = 0;
stock GenerateRandomPlayer()
{
new NewPlayerID = random(MAX_PLAYERS);
while(UsedID[NewPlayerID] == 1 || !IsPlayerConnected(NewPlayerID)) NewPlayerID = random(MAX_PLAYERS);
UsedID[NewPlayerID] = 1;
return NewPlayerID;
}

public OnPlayerConnect(playerid)
{
UsedID[playerid] = 0;
return 1;
}

Blantas
23/02/2010, 01:56 PM
new LastPlayerID;

stock GenerateRandomPlayer()
{
new NewPlayerID = random(MAX_PLAYERS);
while(NewPlayerID == LastPlayerID || !IsPlayerConnected(NewPlayerID)) NewPlayerID = random(MAX_PLAYERS);
LastPlayerID = NewPlayerID;
return NewPlayerID;
}

Kažkas pan...

BuLLeT[LTU]
23/02/2010, 02:14 PM
Ok, dekui, dabar jau tureciau pasidaryti kaip reikia.