Jump to content

Need help with player "unspawning"


jkub

Recommended Posts

I am rewriting my entire spawn system on my server for about the ten millionith time, and I was needing to know if there was a way to "unspawn" a player after he logs out of his account. For example, if you connect to a server with no gamemode or resources running, it is a strait black screen where the player is not in the actual world yet.

Reason being is that once a player logs out in my server, he will be returned to a "login screen" and he is not allowed to do anything until he logs in. So if he still has a character spawned in the world, he can still be killed or manipulated. That will not only be annoying, but it will interfere with other scripts and in turn screw up my login system.

So instead of "patching" it up I was looking for a 1 shot fix.

I am shooting for something like that after logging out. But I looked in the wiki and saw nothing that would work.

I was also wondering if there was a function that checks if a player is spawned into the world or not, I looked for that also but to my luck nothing turned up.

I would appreciate any help with this, and thanks for any help I can get.

Link to comment

I dont think there is such a thing as 'despawned'. When you join a server with no resources running and get a black screen, if you use runcode to fade the camera and set the local player as the camera target, your character is just frozen at 0,0,0. You are always spawned in the world, you just arent looking at yourself

Link to comment
I dont think there is such a thing as 'despawned'. When you join a server with no resources running and get a black screen, if you use runcode to fade the camera and set the local player as the camera target, your character is just frozen at 0,0,0. You are always spawned in the world, you just arent looking at yourself

then just check does player position is 0 0 0

if is, then he isnt spawned

and when he logout, freeze him, and set his pos to 0 0 0

and when spawn, unfreeze him.

Link to comment
I dont think there is such a thing as 'despawned'. When you join a server with no resources running and get a black screen, if you use runcode to fade the camera and set the local player as the camera target, your character is just frozen at 0,0,0. You are always spawned in the world, you just arent looking at yourself

then just check does player position is 0 0 0

if is, then he isnt spawned

and when he logout, freeze him, and set his pos to 0 0 0

and when spawn, unfreeze him.

That is exactly what I have done before, and rewriting my code, I cannot fall back on methods like that and be able to rely on it.

Link to comment

It specificly tells you on the wiki that you can't use destroyElement on players. I don't think it says why, but my guess would be that if you were to remove a player from the element tree, it would be something like kicking him from the server.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...