start thread after spawn of player

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
sg.Pepper
Second Lieutenant
Posts: 152
Joined: Tue Jan 13, 2004 2:47 pm
Location: Czrch Republic
Contact:

start thread after spawn of player

Post 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?
strafer
Captain
Posts: 237
Joined: Sat Jan 31, 2004 11:29 pm
Location: The Motherland..
Contact:

Post 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:
Image
Post Reply