What event gets called once a player disconnects ?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

genar
Posts: 104
Joined: 13 Jul 2017, 11:49

What event gets called once a player disconnects ?

Postby genar » 30 Oct 2018, 17:01

Hey there dear SmartfoxServer team !

When a player enters my aoi the "addedUsers" evt params will get updated... this is how i spawn players.
But when a player is already in my aoi and he disconnects ( force closes the app, or any other way without pressing the logout button ) he wont be added to the "removedUsers" list... which is kinda strange...

Is there a event that handles such a case ? How should i remove those users from my game visually ?
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: What event gets called once a player disconnects ?

Postby Lapo » 30 Oct 2018, 17:43

Hi,
users that leave the Room, log out or get disconnected will definitely be notified via the PROXIMITY_LIST_UPDATE.
Of course within the AoI limits.

In other words User A will not know the User B has left the server if B was outside of A's AoI.

You can check any of our MMORoom examples to see this in action.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
genar
Posts: 104
Joined: 13 Jul 2017, 11:49

Re: What event gets called once a player disconnects ?

Postby genar » 31 Oct 2018, 08:27

Thanks for your fast answer !!

Well ... Thats strange, my removed users list which i receive from "removedUsers" is always empty... Even when a other player is in my aoi and he disconnects ... Any idea why this happens ?
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: What event gets called once a player disconnects ?

Postby Lapo » 31 Oct 2018, 08:34

Have you checked for errors in the server's log files?
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
genar
Posts: 104
Joined: 13 Jul 2017, 11:49

Re: What event gets called once a player disconnects ?

Postby genar » 01 Nov 2018, 10:34

Lapo wrote:Have you checked for errors in the server's log files?
Thanks


Server log doesnt tell me anything about that... only that a player disconnected...
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: What event gets called once a player disconnects ?

Postby Lapo » 02 Nov 2018, 08:16

What SFS2X version are you using?
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
genar
Posts: 104
Joined: 13 Jul 2017, 11:49

Re: What event gets called once a player disconnects ?

Postby genar » 02 Nov 2018, 09:29

Lapo wrote:What SFS2X version are you using?
Thanks


Im using version 2.13.3 currently ! Even the examples dont work properly... well atleast the player disconnect part...
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: What event gets called once a player disconnects ?

Postby Lapo » 02 Nov 2018, 16:41

Please specify the name of the example that doesn't work for you and for which platform (Unity? HTML5? Flash?)

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Astaroth
Posts: 1
Joined: 21 Jan 2020, 20:55

Re: What event gets called once a player disconnects ?

Postby Astaroth » 21 Jan 2020, 21:00

Hey genar,

I've the same problem, did u find a solution? Running outside the AoI displays the user under removed_users, but a disconnect doesn't...
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: What event gets called once a player disconnects ?

Postby Lapo » 22 Jan 2020, 09:38

Please check the official examples we provide.
In particular see the SimpleMMOWorld example which shows how to handle new players entering the AoI and exiting players leaving it. The disconnected player is definitely passed in the PROXIMITY_LIST_UPDATE event among the removed users.

If there's any problem with the examples let us know.
Examples can be download here:
https://smartfoxserver.com/download#p=examples

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 22 guests