I used listeners to players to detect players who left, join, die and everithing..well do you remember what I was trying to do with struct(when I asked if it's possible use it in moh scripts), whell I've used another way...this one:
Code: Select all
....
....
....
players_list_connector: //connection between players and list
for(local.i = 1; local.i <= $player.size; local.i++)
{
if($player[local.i].listener == NIL)
{
$player[local.i] waitthread list_creation
}
}
end
list_creation: // creating the listener
local.player = self
local.listener = spawn listener
local.listener.targetname = "PlayerListener"
local.listener.player = local.player
local.player.listener = local.listener
local.listener.player.name = local.player.netname
local.listener.player.team = ""
local.listener.player.status = ""
local.listener.player.team = local.player.dmteam
if(level.spawnpool_mode == 1)
local.listener.player.pool = 10
else
local.listener.player.pool = NIL
//player joined
end
....
....
....
that's the first time I use listeners, and I also used them to underseand them...hope to have done everything good!
Code: Select all
Code:
while($PlayerListener[local.i].player.health > 0)
waitframe
ahahah lol, you're right! that's simpler..and more efficient!
