Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

MapChat server Listener


Scratso
 Share

Recommended Posts

In EO2 (Robin's final version thingy), I want to make the server listen to Map Chat. This is so I can moderate my game since there's like 100 maps and all I hear is Global. If anyone knows how or a good tutorial, please help me. Thanks in advance!

EG, it would put in server like "[Map#1] Scratso: Message" for example.

Edit:Thanks, Mod Matt!
Link to comment
Share on other sites

```

Private Sub HandleSayMsg(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Msg As String
Dim i As Long
Dim Buffer As clsBuffer
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
Msg = Buffer.ReadString

' Prevent hacking
For i = 1 To Len(Msg)
' limit the ASCII
If AscW(Mid$(Msg, i, 1)) < 32 Or AscW(Mid$(Msg, i, 1)) > 126 Then
' limit the extended ASCII
If AscW(Mid$(Msg, i, 1)) < 128 Or AscW(Mid$(Msg, i, 1)) > 168 Then
' limit the extended ASCII
If AscW(Mid$(Msg, i, 1)) < 224 Or AscW(Mid$(Msg, i, 1)) > 253 Then
Mid$(Msg, i, 1) = ""
End If
End If
End If
Next

Call AddLog("Map #" & GetPlayerMap(index) & ": " & GetPlayerName(index) & " says, '" & Msg & "'", PLAYER_LOG)
Call SayMsg_Map(GetPlayerMap(index), index, Msg, QBColor(White))

Set Buffer = Nothing
End Sub

```
That's the sub that handles saying messages. Not too far from there is a sub that handles global messages. You'll find all you need there.
Link to comment
Share on other sites

```

' ::::::::::::::::::::
' :: Social packets ::
' ::::::::::::::::::::
Private Sub HandleSayMsg(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Msg As String
Dim i As Long
Dim Buffer As clsBuffer
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
Msg = Buffer.ReadString

' Prevent hacking
For i = 1 To Len(Msg)
' limit the ASCII
If AscW(Mid$(Msg, i, 1)) < 32 Or AscW(Mid$(Msg, i, 1)) > 126 Then
' limit the extended ASCII
If AscW(Mid$(Msg, i, 1)) < 128 Or AscW(Mid$(Msg, i, 1)) > 168 Then
' limit the extended ASCII
If AscW(Mid$(Msg, i, 1)) < 224 Or AscW(Mid$(Msg, i, 1)) > 253 Then
Mid$(Msg, i, 1) = ""
End If
End If
End If
Next

Call AddLog("Map #" & GetPlayerMap(index) & ": " & GetPlayerName(index) & " says, '" & Msg & "'", PLAYER_LOG)
Call SayMsg_Map(GetPlayerMap(index), index, Msg, QBColor(White))
Call AddText("[Map " & GetPlayerMap(index) & "]" & GetPlayerName(index) & ":" & Msg)

Set Buffer = Nothing
End Sub

```
I added the line:

```
Call AddText("[Map " & GetPlayerMap(index) & "]" & GetPlayerName(index) & ":" & Msg)

```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...