home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / jpi / jpiserve.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-01-22  |  5.2 KB  |  179 lines

  1. VERSION 5.00
  2. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  3. Begin VB.Form Form1 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "JPI Server 1.0"
  6.    ClientHeight    =   2175
  7.    ClientLeft      =   5745
  8.    ClientTop       =   3690
  9.    ClientWidth     =   4095
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   2175
  14.    ScaleWidth      =   4095
  15.    Begin VB.CommandButton Command3 
  16.       Caption         =   "Settings"
  17.       Height          =   375
  18.       Left            =   2760
  19.       TabIndex        =   9
  20.       Top             =   1200
  21.       Width           =   1215
  22.    End
  23.    Begin VB.TextBox Text2 
  24.       Height          =   285
  25.       Left            =   1080
  26.       TabIndex        =   7
  27.       Top             =   1800
  28.       Width           =   495
  29.    End
  30.    Begin VB.CommandButton Command2 
  31.       Caption         =   "Stop Server"
  32.       Enabled         =   0   'False
  33.       Height          =   375
  34.       Left            =   1440
  35.       TabIndex        =   6
  36.       Top             =   1200
  37.       Width           =   1215
  38.    End
  39.    Begin VB.CommandButton Command1 
  40.       Caption         =   "Start Server"
  41.       Height          =   375
  42.       Left            =   120
  43.       TabIndex        =   5
  44.       Top             =   1200
  45.       Width           =   1215
  46.    End
  47.    Begin MSWinsockLib.Winsock AnswerSock 
  48.       Left            =   3600
  49.       Top             =   2280
  50.       _ExtentX        =   741
  51.       _ExtentY        =   741
  52.    End
  53.    Begin MSWinsockLib.Winsock ServerSock 
  54.       Index           =   0
  55.       Left            =   3960
  56.       Top             =   2160
  57.       _ExtentX        =   741
  58.       _ExtentY        =   741
  59.    End
  60.    Begin VB.Frame Frame1 
  61.       Caption         =   "Server Settings"
  62.       Height          =   975
  63.       Left            =   120
  64.       TabIndex        =   0
  65.       Top             =   120
  66.       Width           =   3855
  67.       Begin VB.ComboBox Combo1 
  68.          Height          =   315
  69.          ItemData        =   "JPIServer.frx":0000
  70.          Left            =   1200
  71.          List            =   "JPIServer.frx":0002
  72.          Style           =   2  'Dropdown List
  73.          TabIndex        =   3
  74.          Top             =   480
  75.          Width           =   2535
  76.       End
  77.       Begin VB.TextBox Text1 
  78.          Height          =   285
  79.          Left            =   120
  80.          TabIndex        =   1
  81.          Top             =   480
  82.          Width           =   975
  83.       End
  84.       Begin VB.Label Label2 
  85.          Caption         =   "Map to play"
  86.          Height          =   255
  87.          Left            =   1200
  88.          TabIndex        =   4
  89.          Top             =   240
  90.          Width           =   1215
  91.       End
  92.       Begin VB.Label Label1 
  93.          Caption         =   "Port Number"
  94.          Height          =   255
  95.          Left            =   120
  96.          TabIndex        =   2
  97.          Top             =   240
  98.          Width           =   1695
  99.       End
  100.    End
  101.    Begin VB.Label Label3 
  102.       Caption         =   "Logged On"
  103.       Height          =   255
  104.       Left            =   120
  105.       TabIndex        =   8
  106.       Top             =   1800
  107.       Width           =   975
  108.    End
  109.    Begin VB.Line Line1 
  110.       X1              =   120
  111.       X2              =   3960
  112.       Y1              =   1680
  113.       Y2              =   1680
  114.    End
  115. Attribute VB_Name = "Form1"
  116. Attribute VB_GlobalNameSpace = False
  117. Attribute VB_Creatable = False
  118. Attribute VB_PredeclaredId = True
  119. Attribute VB_Exposed = False
  120. Private Sub AnswerSock_ConnectionRequest(ByVal requestID As Long)
  121. found = False
  122. For i = 1 To PlayersLoggedOn
  123.   If Players(i).Active = False Then
  124.     Indx = i
  125.     found = True
  126.     Exit For
  127.   End If
  128. Next i
  129. If found = False Then PlayersLoggedOn = PlayersLoggedOn + 1: Indx = PlayersLoggedOn
  130. Form1.ServerSock(Indx).Accept requestID
  131. Players(Indx).Active = True
  132. Call StartupPlayer(Indx)
  133. End Sub
  134. Private Sub Command1_Click()
  135. Call StartServer(Val(Text1.Text))
  136. Command2.Enabled = True
  137. Command1.Enabled = False
  138. Call Rotation
  139. End Sub
  140. Private Sub Command2_Click()
  141. Call KillServer
  142. Form1.Text2.Text = ""
  143. For i = 1 To MAXPLAYERS
  144.   Form1.ServerSock(i).Close
  145. Next i
  146. Form1.AnswerSock.Close
  147. Command1.Enabled = True
  148. Command2.Enabled = False
  149. End Sub
  150. Private Sub Command3_Click()
  151. Form2.Show
  152. End Sub
  153. Private Sub Form_Load()
  154. On Error Resume Next
  155. Open "Server.Cfg" For Input As #1
  156. Line Input #1, ServerData.SysopName
  157. Line Input #1, ServerData.MotD
  158. Close #1
  159. Form1.Caption = "Loading Sockets..."
  160. For i = 1 To MAXPLAYERS
  161.   Load Form1.ServerSock(i)
  162. Next i
  163. Form1.Text1.Text = DefaultPort
  164. Form1.Caption = "JPI Server " & VERSION
  165. End Sub
  166. Private Sub Form_Unload(Cancel As Integer)
  167. Open "Server.Cfg" For Output As #1
  168. Print #1, ServerData.SysopName
  169. Print #1, ServerData.MotD
  170. Close #1
  171. End Sub
  172. Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
  173. End Sub
  174. Private Sub ServerSock_DataArrival(Index As Integer, ByVal bytesTotal As Long)
  175. Dim SData As String
  176. ServerSock(Index).GetData SData, vbString
  177. Call BreakDownMessage(SData, Index)
  178. End Sub
  179.