Jump to content

Need help with player "unspawning"


jkub

Recommended Posts

Posted

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.

Posted

well then he would drown lol.

Ive also tried the ghetto method of setting position to dead center of map b4 and that failed as well with some of my older systems.

I don't know what to do

Posted

thats a start lol...

Maybe there could be setting the player an another unused dimension but then again, that is ghetto.

Posted

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

Posted
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.

Posted
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.

Posted

You cant destroyElement on a player

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.

why not? whats wrong with it?

Posted

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.

Posted

maybe you should use

  
fadeCamera --black screen 
setElementInterior --no area in admin panel, so he isn't inside the map 
setElementPosition --to 0,0,0 
setPedFrozen --so he won't do anything anymore 
setElementAlpha --invisible hahahaha! 
  

Posted

Ok guys.

Thanks for the help, I may try out some of this when I get to this part of my system.

But if you have more ideas, please don't hesitate to voice them here.

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...