loops :Somethread()
{
if(something)
{
waittillspawn();
waittillprematch();
}
}
waittillprematch()
{
for(;;)
{
level waittill("prematch_over");
DoSomething();
}
}
waittillspawn()
{
for(;;)
{
foreach(player in level.players)
{
player waittill("spawned_player");
DoSomething();
}
}
}
Somethread()
{
if(something)
{
[level, player or self] thread waittillspawn();
[level, player or self] thread waittillprematch();
}
}
self waittill_any("death", "disconnect");
Somethread()
{
if(something)
{
self thread waittillspawn();
wait 0.6; //doesn't really matter of a ms, it's still less than a sec, so it's fast
self thread waittillprematch();
}
}
level thread
waittillspawn()
{
level waittill("prematch_over");
self thread DoSomething();
}