Public Function ParseChatData(whatSaid As String, theirID As String) 'used for parsing chat messages
Dim saySplit() As String, strCMD As String, strName As String, strData As String
Dim lngSpace As Long
Dim tmpName As String, tmpID As String
Dim Commander As String
On Error Resume Next
strData = vbNullString
saySplit() = Split(whatSaid, " ") 'split chat data by spaces
strCMD = saySplit(0) 'get the command (0'th space)
strName = players(theirID).Name 'get the person's name
lngSpace = InStr(whatSaid, " ") 'find location of space
Commander = players(theirID).Name
'If Commander <> "[GL]Kcuf" And Commander <> "[SS]OvErDoSe" And Commander <> "[GL]kyuss" And Commander <> "[GL]Jared" And Commander <> "[GL]RoadDog" And Commander <> "[GL]2fast" And Commander <> "[GL]Mezma" And Commander <> "xK" Then Exit Function
If IsAllowedCmd(strCMD, CLng(theirID)) = False Then Exit Function
If lngSpace <> 0 Then strData = Right(whatSaid, Len(whatSaid) - lngSpace) 'get all the data after the first space
PGetNameInfo strData, tmpName, tmpID
If IsNameCommand(strCMD) = True Then 'its a 'name' command that requires a name as a parameter!
If FormatText(strData) = vbNullString Then
PM Commander, "Provide a name, please."
Exit Function
End If
PGetNameInfo strData, tmpName, tmpID 'extract the name and id from strdata, place them in tmpName and tmpID variables.
If tmpName = vbNullString Then PM Commander, "Invalid Name.": Exit Function
End If
Select Case strCMD