Is there a function to check if a player is disconnected?

Posted by SaitoZero
Basically I want Player A to constantly check if a specific Player B is still in the game or not, but I'm not sure how to achieve this?

Replies (1)

Last message on 6 Oct 2020

Size43 (Administrator) on 6 Oct 2020, 22:29:41
If you have a player ID, you can loop over all players to check if there is a player with that ID:

var search_id = 1; // Set this to the player ID of player B
var found = false;
for(var n = 0; n < gms_other_count(); n += 1)
{
    var player_id = gms_other_find(n);
    if player_id == search_id {
        found = true;
    }
}
// Found will now only be true if the player is still in the game