Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help: Hmm
#11
Heres the bloody code:
Server
Code:
Case "playermsg"
        MsgToString = Parse$(1)
        For i = 1 To HighIndex
            If MsgToString = LCase$(Mid$(GetPlayerName(i), 1, Val(Parse$(3)))) Or MsgToString = Mid$(GetPlayerName(i), 1, Val(Parse$(3))) Then
                D = i
            End If
        Next i
        MsgTo = D
        Msg = Parse$(2)

client
Code:
Sub PlayerMsg(ByVal Text As String, ByVal MsgTo As String, ByVal i As Byte)
Dim packet As String

    packet = "playermsg" & SEP_CHAR & MsgTo & SEP_CHAR & Text & SEP_CHAR & i & SEP_CHAR & END_CHAR
    Call SendData(packet)
End Sub


Code:
' Player message
        If Mid$(MyText, 1, 1) = "/" Then
            ChatText = Mid$(MyText, 2, Len(MyText) - 1)
            Name = vbNullString
                    
            ' Get the desired player from the user text
            For i = 1 To Len(ChatText)
                If Mid$(ChatText, i, 1)  " " Then
                    Name = Name & Mid$(ChatText, i, 1)
                Else
                    Exit For
                End If
            Next i
                    
            ' Make sure they are actually sending something
            If Len(ChatText) - i > 0 Then
                ChatText = Mid$(ChatText, i + 1, Len(ChatText) - i)
                    
                ' Send the message to the player
                Call PlayerMsg(ChatText, Name, i - 1)
            Else
                Call AddText("Usage: /playername msghere (The whole player name is not needed to be written. Also remember to write the correct caps.", AlertColor)
            End If
            MyText = vbNullString
            frmMirage.txtMyChat.Text = vbNullString
            Exit Sub
        End If

Now stop telling me everything that sucks with it!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)