12.08.2010, 21:54
pawn Код:
public OnGameModeInit()
{
SetTimer("ExplodePlayer",60000,false);
return 1;
}
public ExplodePlayer()
{
new conn_ID[MAX_PLAYERS],count;
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
conn_ID[count] = i;
count++;
}
if(count == 0) return 1; // No players were connected...
new Float:x,Float:y,Float:z;
GetPlayerPos(conn_ID[random(count)],x,y,z);
CreateExplosion(x, y, z, 5, 20); // Player goes boom
return 1;
}
![Smiley](images/smilies/smile.png)
Finding a random player to work with in the entire server is messy though, I can't think of another way to do it without looping through to make sure they're connected and build an array with the information in it.