Usage: gms_session_type ( id )


Returns the type of the session that belongs to the provided session_id.

Deprecated: id can be used as an index. In this case, the function will return the type of the nth session.


// Search for the first session that has the same type as argument0

for(var i = 0; i < gms_session_count(); i++)
    if(gms_session_type(gms_session_id(i)) == argument0)
        return gms_session_id(i);

return -1;

Replies (2)

Last message on 2 Aug 2014

innominato on 30 Jul 2014, 16:38:39
gms_session_type ( n )
I don't understunde how use the "type" of session :(

I understunde that there are sessions, everyone with a ID (from 0 to 255, true?).
But what is type?
Size43 (Administrator) on 2 Aug 2014, 11:28:49
What you're describing as ID sounds more like the session type. The ID is simply a unique number assigned to every session by the server, and has no real meaning.

The type, on the other hand, can be used to identify different kinds of sessions. It does nothing on its own, it'll only help when trying to decide what session to join. For example, internally GameMaker Server uses ID 0 for a lobby and ID 1 for a game in progress if you enable the VS mode. (but don't use the VS mode and sessions at the same time, that may not work)