Detecting Disconnected Players.
How do you detect wheather a player is still connected to a session in direct play?
November 09, 2000 02:15 AM
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
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?
November 11, 2000 03:46 AM
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
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
Popular Topics
Advertisement
Recommended Tutorials
Advertisement