Page 1 of 1

start thread after spawn of player

Posted: Mon Nov 29, 2004 8:13 pm
by sg.Pepper
hi, i want to start some thread after player spawn again to mp game, when he was killd before;
because this thread need targetname $player to work ;
how can i do it?

Posted: Mon Nov 29, 2004 9:01 pm
by strafer
I think I know what you are asking. Here is what I think:

Code: Select all

while(1)
	{
		for(local.i=1;local.i<=$player.size;local.i++)
		{
                    if(isAlive $player[local.i])
                    {
                        //do nothing
                    }
                    else
                    {
                        thread my_thread
                    }
        }
end
That starts the thread after the player died. If you want to wait until they spawn then try this:

Code: Select all

while(1)
	{
		for(local.i=1;local.i<=$player.size;local.i++)
		{
                    if(isAlive $player[local.i])
                    {
                        $player[local.i].dead = 0
                    }
                    else
                    {
                        $player[local.i].dead = 1
                        thread my_thread
                    }
        }
end

my_thread:

         waittill isAlive $player[local.i]

        //Put what you want to do here.

end

This is 100% untested so that is up to you. Post again if you need any more help. Hope this helps.

:wink: