15-10-2008, 01:40 AM
So yeah, for shits and giggles, I tried liquidating the AdminMsg into EliteMsg, so that only level 100's can send and see the messages. But it won't work. I don't get kicked for bad packets, or anything, but it doesn't show the EliteMsg, like it should, instead it shows *Message (* is the trigger)
I was just going to leave it, because it was only to see if I could make it, but then I realized that I'll never get any better, if I don't learn what to look for when something doesn't work. I literally spent hours on this. I'd really appreciate any help.
Here's the code.
[spoiler]Server Side
Client Side
[/spoiler]
I was just going to leave it, because it was only to see if I could make it, but then I realized that I'll never get any better, if I don't learn what to look for when something doesn't work. I literally spent hours on this. I'd really appreciate any help.
Here's the code.
[spoiler]Server Side
Code:
Sub EliteMsg(ByVal Msg As String, ByVal Color As Byte)
Dim Packet As String
Dim i As Long
Packet = SEliteMsg & SEP_CHAR & Msg & SEP_CHAR & Color & END_CHAR
For i = 1 To MAX_PLAYERS
If IsPlaying(i) And GetPlayerLevel(i) = "100" Then
Call SendDataTo(i, Packet)
End If
Next i
End Sub
Code:
CEliteMsg
Code:
SEliteMsg
Code:
Case CEliteMsg
HandleEliteMsg Index, Parse
Code:
Sub HandleEliteMsg(ByVal Index As Long, ByRef Parse() As String)
Dim Msg As String
Dim i As Long
Msg = Parse(1)
' Prevent hacking
For i = 1 To Len(Msg)
If AscW(Mid$(Msg, i, 1)) < 32 Or AscW(Mid$(Msg, i, 1)) > 126 Then
Call HackingAttempt(Index, "Admin Text Modification")
Exit Sub
End If
Next i
If GetPlayerLevel(Index) = "100" Then
Call AddLog("(Elite " & GetPlayerName(Index) & ") " & Msg, ADMIN_LOG)
Call EliteMsg("(Elite " & GetPlayerName(Index) & ") " & Msg, AdminColor)
End If
End Sub
Client Side
Code:
Sub EliteMsg(ByVal Text As String)
Dim Packet As String
Packet = CEliteMsg & SEP_CHAR & Text & END_CHAR
Call SendData(Packet)
End Sub
Code:
CEliteMsg
Code:
SEliteMsg
Code:
Case SEliteMsg
HandleEliteMsg Parse
Code:
Sub HandleEliteMsg(ByRef Parse() As String)
Call AddText(Parse(1), CInt(Parse(2)))
End Sub