🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Detecting Disconnected Players.

Started by
2 comments, last by EdwardKoo 23 years, 7 months ago
How do you detect wheather a player is still connected to a session in direct play?
Advertisement
If they disconnected somehow, you''ll receive the "SYS_DESTROYPLAYER" message. I''m not sure if the message name is entirely correct, but it is something with Destroyplayer. It''s just the same as a "Createplayer" message.

I thought thatr you can get two values using msg.ReadLong. The first one is if it was a spectator or not, and tthe second the PlayerID (long). If the game crashes, than I''m wrong and you can only get the Player Id.

Almar
Yes i don''t know how to check for client that didn''t exit properly like system crash. I don''t receive any acknowledgement from direct play if that happen. So i think i have to manually check wheather the player is disconnected. But how?
Well, if I''m right this message will appear anyway after a crash.
But, I do have another method, atleast I know it works in Visual Basic.

If you call DP.GetPlayerFriendlyName(PlayerId) for a player that doesn''t exist the program will reutrn an error. So If you check every once and while if DP.GetPlayerFriendlyName(PlayerID) works than the player is still online. As I said, a bit weird, but it might solve your problems.

You do need an array containing all playerids, but I think you already have one...or you wouldn''t know the destination of each message received.

Almar

This topic is closed to new replies.

Advertisement