Hello.
I need some help on a script.
When the player disconnects I want all the threads to be stoped and the entities attached to him deleted.
I know I could use the endon("disconnect");
but im trying to find another way
all my threads end on "stop_portal"
and I have this function threaded
Portal_Stop()
{
self common_scripts\utility::waittill_any("death","disconnect","joined_spectators","spawned");
self notify("stop_portal");
}
My Question now is, if the player (self) disconnects, will it still be able to notify self with "stop_portal", or will it be a script error (only on lan, so I cant test for sure)
And also i have another function, which is:
waitfor_Delete_Portals()
{
self waittill("stop_portal");
Delete_portals();
}
In Delete_Portals() it will delete the entities attached to self.
But will it work even if the player disconnected?
Or is there a workaround
End thread on disconnect *help*
Moderator: Core Staff
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: End thread on disconnect *help*
Attached entities should delete when a player disconnects...
Why not just run a test, using either a dedi server, a bot or a friend...
If "delete_portals()" does not require a entity to be named or threaded...
You could maybe try:
self waittill("disconnect");
delete_portals();
Why not just run a test, using either a dedi server, a bot or a friend...
If "delete_portals()" does not require a entity to be named or threaded...
You could maybe try:
self waittill("disconnect");
delete_portals();

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: End thread on disconnect *help*
so if i have something like self.ent it will delete itself ingame?
Will it do the same for a effect on self?
and im assuming the script wont give any errors, but ill test it out sometime.
Will it do the same for a effect on self?
and im assuming the script wont give any errors, but ill test it out sometime.
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: End thread on disconnect *help*
ITs not somethign I have needed to ever test, but as long as you do not set up infinite loops on top of attached entities, then I cannot see any problems occuring.
Just simple create two entities (one a child of the other [self and self.child], attach them together and delete the parent ent and see what happens.
Just simple create two entities (one a child of the other [self and self.child], attach them together and delete the parent ent and see what happens.

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Who is online
Users browsing this forum: No registered users and 3 guests