GLBasic User Manual

Main sections

NETGETQUITPLAYER

quitid% = NETGETQUITPLAYER()


Returns the ID of a player deleted by NETDESTROYPLAYER() or lost due to a disconnection of a client.
This command only works within the server program. If no player has quit, the return value is 0.
If a player has quit, the server should send a message to all clients informing them about the loss. You should continue to call this function until it returns 0 otherwise you may miss a disconnection if several players are removed simultaneously.

The NET... commands give network functionality to GLBasic programs using the TCP protocol. TCP has the advantage over other protocols that sending and receiving of network messages is ensured.

NOTE : This command requires that you have purchased either GLBasic Premium or the GLBasic NET add-on.

FUNCTION ReadHighScores: names$[], scores[], username$, thescore
LOCAL ct, i, str$, proxy$, port

    str$ = "highscores/listgame.php"
    str$ = str$ + "?game=mygame"
    str$ = str$ + "&name="+username$
    str$ = str$ + "&score="+thescore
    str$ = str$ + "&secret=mycode"

    PRINT ".: WebGet scores :.", 0, 0
    SHOWSCREEN

    INIOPEN "config.ini"
    proxy$ = INIGET$("server", "proxy")
    port = INIGET$("server", "port")
    KILLFILE "scores.ini"
    IF port=0 OR proxy$="NO_DATA"
        NETWEBGET("www.glbasic.com", "/"+str$, 80, "scores.ini")
    ELSE
        NETWEBGET(proxy$, "http://www.glbasic.com/" + str$, port, "scores.ini")
    ENDIF

    INIOPEN "scores.ini"
    ct = INIGET$("scores", "count")
    DIM names$[ct]
    DIM scores[ct]

    FOR i=1 TO ct
        names$[i-1] = INIGET$("scores", "n"+i)
        scores[i-1] = INIGET$("scores", "s"+i)
    NEXT
ENDFUNCTION

See also...