Лабораторная работа: Greating game on visual basic with multiplayer system
If onconnect = True Then
On Error GoTo NoDx
Dim dpmsg As DirectPlayMessage
Set dpmsg = dxplay. CreateMessage
Call dpmsg. WriteLong (MSG_STOP)
Call dxplay. Send (MyPlayer, DPID_ALLPLAYERS, DPSEND_GUARANTEED, dpmsg)
Call CloseDownDPlay
End If
Unload Connect
Unload MainBoard
End
NoDx:
MsgBox "Could not stop DXPlay. ", vbOKOnly, "System"
End
End Sub
Private Sub hostagame_Click ()
usermode = "host" 'Sets usermode to host
Connect. Show 'starts connect form
MainBoard. Enabled = False 'disable form so user cannot select while connect form is up
hostagame. Enabled = False 'disables menu host button.
joinagame. Enabled = False ' disables menu join button
multiplayermode = True 'sets multiplayer to true
End Sub
Private Sub joinagame_Click ()
usermode = "client" 'Sets usermode to client
Connect. Show
MainBoard. Enabled = False
multiplayermode = True
End Sub