Cuberite Forum
Differentiating between join and respawn - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Differentiating between join and respawn (/thread-2957.html)



Differentiating between join and respawn - moiko89 - 05-20-2017

Hi,

how i can different between the PlayerJoin and PlayerSpawned.
I want port the player to a position after death but not after joining the server
and the Hook HOOK_PLAYER_SPAWNED is active after joining and death. Huh [url=https://api.cuberite.org/OnPlayerSpawned.html][/url]


RE: How different between join and spawn - Seadragon91 - 05-20-2017

Hm good question.

My idea that I have now would be to add the player in HOOK_PLAYER_JOINED to a global list and if the player spawns in HOOK_PLAYER_SPAWNED and is in the list then you know that he spawned due to login. If he is not in the list the player re-spawned. Run the your code and then remove the player from the list.


RE: How different between join and spawn - moiko89 - 05-20-2017

(05-20-2017, 05:03 AM)Seadragon91 Wrote: Hm good question.

My idea that I have now would be to add the player in HOOK_PLAYER_JOINED to a global list and if the player spawns in HOOK_PLAYER_SPAWNED and is in the list then you know that he spawned due to login. If he is not in the list the player re-spawned.  Run the your code and then remove the player from the list.


Yes, that's what I thought, too.


RE: Differentiating between join and respawn - psyFi - 08-02-2017

You can add a hasJoined column in your database, and set it to zero when HOOK_PLAYER_DESTROYED is called.