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

[EO] In-Game Email System 1.2


damian666
 Share

Recommended Posts

client side

first add the provided files to your client, and the inbox form to your project.

Open frmMain and Make a button and name it cmdMail, make sure it has a height of 36 and a width of 36, and set the style to 1 in the properties window.

Then paste this code into frmMain:

```

Private Sub cmdMail_Click()

If frmInbox.Visible = False Then

frmInbox.Visible = True

End If

End Sub

```

Go to ModEnumerations

in Public Enum ServerPackets

just above

```

' Make sure SMSG_COUNT is below everything else

SMSG_COUNT

```

add

```

'mail stuff

SSetMsgBody

SMyInbox

SMyOutBox

SUnreadMsg

```

and then in

Public Enum ClientPackets

add just above

```

' Make sure CMSG_COUNT is below everything else

CMSG_COUNT

```

this:

```

'mail stuff

CSendEmail

CGetMsgBody

CDeleteMsg

CUpdateInbox

CCheckChar

```

Go to modhandledata

in modHandledata, sub InitMessages, just above

```

' Error handler

Exit Sub

```

add

```

'mail stuff

HandleDataSub(SSetMsgBody) = GetAddress(AddressOf HandleSetMsgBody)

HandleDataSub(SMyInbox) = GetAddress(AddressOf HandleMyInbox)

HandleDataSub(SMyOutBox) = GetAddress(AddressOf HandleMyOutBox)

HandleDataSub(SUnreadMsg) = GetAddress(AddressOf HandleUnreadMessage)

```

then at the bottom of modhandledata add these subs

```

Sub HandleSetMsgBody(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim Buffer As clsBuffer

Dim Sender As String, Subject As String, Body As String, MailType As Byte

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteBytes Data()

Sender = Buffer.ReadString

Subject = Buffer.ReadString

Body = Buffer.ReadString

MailType = Buffer.ReadByte

If MailType = 1 Then

frmInbox.txtSender.text = Sender

frmInbox.txtSubject.text = Subject

frmInbox.txtBody.text = Body

frmInbox.txtBody2.text = Body

Else

frmInbox.txtReceiver2.text = Sender

frmInbox.txtSubject.text = Subject

frmInbox.txtBody.text = Body

frmInbox.txtBody3.text = Body

End If

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "HandleSetMsgBody", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Sub HandleMyInbox(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim Buffer As clsBuffer

Dim Name As String, Number As Long, Subject As String

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteBytes Data()

Name = Buffer.ReadString '1

Number = Buffer.ReadLong '2

Subject = Buffer.ReadString '3

If Number <= 9 Then

frmInbox.lstMail.AddItem "[000" & Number & "]" & " " & Name & " - " & Subject

ElseIf Number >= 9 And Number <= 99 Then

frmInbox.lstMail.AddItem "[00" & Number & "]" & " " & Name & " - " & Subject

ElseIf Number > 99 Then

frmInbox.lstMail.AddItem "[0" & Number & "]" & " " & Name & " - " & Subject

Else

frmInbox.lstMail.AddItem "[" & Number & "]" & " " & Name & " - " & Subject

End If

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "HandleMyInbox", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Sub HandleMyOutbox(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim Buffer As clsBuffer

Dim Name As String, Number As Long, Subject As String

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteBytes Data()

Name = Buffer.ReadString

Number = Buffer.ReadLong

Subject = Buffer.ReadString

If Number <= 9 Then

frmInbox.lstOutbox.AddItem "[000" & Number & "]" & " " & Name & " - " & Subject

ElseIf Number >= 9 And Number <= 99 Then

frmInbox.lstOutbox.AddItem "[00" & Number & "]" & " " & Name & " - " & Subject

ElseIf Number > 99 Then

frmInbox.lstOutbox.AddItem "[0" & Number & "]" & " " & Name & " - " & Subject

Else

frmInbox.lstOutbox.AddItem "[" & Number & "]" & " " & Name & " - " & Subject

End If

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "HandleMyOutbox", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Sub HandleUnreadMessage(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim Buffer As clsBuffer

Dim E As Long, Unread As Long

Dim Ending1 As String

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteBytes Data()

Unread = Buffer.ReadLong

If Unread > 0 Then

For E = 1 To 3

If E = 1 Then Ending1 = ".gif"

If E = 2 Then Ending1 = ".jpg"

If E = 3 Then Ending1 = ".bmp"

If FileExist(GFX_PATH & "gui\main\Inbox2" & Ending1) Then

frmMain.cmdMail.Picture = LoadPicture(App.Path & GFX_PATH & "gui\main\Inbox2" & Ending1)

End If

Next E

Else

For E = 1 To 3

If E = 1 Then Ending1 = ".gif"

If E = 2 Then Ending1 = ".jpg"

If E = 3 Then Ending1 = ".bmp"

If FileExist(GFX_PATH & "gui\main\Inbox" & Ending1) Then

frmMain.cmdMail.Picture = LoadPicture(App.Path & GFX_PATH & "gui\main\Inbox" & Ending1)

End If

Next E

End If

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "HandleUnreadMessage", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

Now open up ModClientTCP and just paste this at the bottom:

```

Public Sub SendEmail(ByVal msgSender As String, ByVal msgReceiver As String, ByVal msgSubject As String, ByVal msgBody As String)

Dim Buffer As clsBuffer

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteLong CSendEmail

Buffer.WriteString msgSender

Buffer.WriteString msgReceiver

Buffer.WriteString msgSubject

Buffer.WriteString msgBody

SendData Buffer.ToArray()

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "SendEmail", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Public Sub GetMsgBody(ByVal MyName As String, ByVal ListedMsg As Long, ByVal Either As Long)

Dim Buffer As clsBuffer

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteLong CGetMsgBody

Buffer.WriteString MyName

Buffer.WriteLong ListedMsg

Buffer.WriteLong Either

SendData Buffer.ToArray()

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "GetMsgBody", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Public Sub RemoveMail(ByVal MyName As String, ByVal DltMsgNum As Long, ByVal Either As Long)

Dim Buffer As clsBuffer

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteLong CDeleteMsg

Buffer.WriteString MyName

Buffer.WriteLong DltMsgNum

Buffer.WriteLong Either

SendData Buffer.ToArray()

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "RemoveMail", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Public Sub CheckInbox(ByVal MyInbox As String, ByVal Either As Long)

Dim Buffer As clsBuffer

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteLong CUpdateInbox

Buffer.WriteString MyInbox

Buffer.WriteLong Either

SendData Buffer.ToArray()

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "CheckInbox", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Public Sub CheckChar(ByVal msgSender As String, ByVal msgReceiver As String, ByVal msgSubject As String, ByVal msgBody As String)

Dim Buffer As clsBuffer

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteLong CCheckChar

Buffer.WriteString msgSender

Buffer.WriteString msgReceiver

Buffer.WriteString msgSubject

Buffer.WriteString msgBody

SendData Buffer.ToArray()

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "CheckChar", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

'SAVE YOUR PROJECT, and close the client.

server side

Go to ModEnumerations

in Public Enum ServerPackets

just above

```

' Make sure SMSG_COUNT is below everything else

SMSG_COUNT

```

add

```

'mail stuff

SSetMsgBody

SMyInbox

SMyOutBox

SUnreadMsg

```

and then in

Public Enum ClientPackets

add just above

```

' Make sure CMSG_COUNT is below everything else

CMSG_COUNT

```

this:

```

'mail stuff

CSendEmail

CGetMsgBody

CDeleteMsg

CUpdateInbox

CCheckChar

```

in modGeneral, sub InitServer, under

```

ChkDir App.Path & "\Data\", "spells"

```

add:

```

ChkDir App.Path & "\Data\", "mail"

ChkDir App.Path & "\Data\Mail\", "outbox"

```

Open up ModHandleData, sub initmessages, and put this right under the other other ones

```

HandleDataSub(CSendEmail) = GetAddress(AddressOf HandleSendEmail)

HandleDataSub(CGetMsgBody) = GetAddress(AddressOf HandleGetMsgBody)

HandleDataSub(CDeleteMsg) = GetAddress(AddressOf HandleDeleteMsg)

HandleDataSub(CUpdateInbox) = GetAddress(AddressOf HandleUpdateInbox)

HandleDataSub(CCheckChar) = GetAddress(AddressOf HandleCheckChar)

```

after that add these to the bottom of the modhandledata

```

Public Sub HandleSendEmail(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim buffer As clsBuffer

Dim msgSender As String, msgReceiver As String

Dim msgSubject As String, msgBody As String

Set buffer = New clsBuffer

buffer.WriteBytes Data()

msgSender = buffer.ReadString

msgReceiver = buffer.ReadString

msgSubject = buffer.ReadString

msgBody = buffer.ReadString

Set buffer = Nothing

SendEmail Index, msgSender, msgReceiver, msgSubject, msgBody

End Sub

Public Sub HandleGetMsgBody(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim FileName As String, Inbox As Long

Dim MyName As String, ListedMsg As Long, Either As Long

Dim buffer As clsBuffer

Set buffer = New clsBuffer

buffer.WriteBytes Data()

MyName = buffer.ReadString

ListedMsg = buffer.ReadLong

Either = buffer.ReadLong

Set buffer = Nothing

If GetPlayerName(Index) <> MyName Then

Call HackingAttempt(Index, "Email Modification")

Exit Sub

End If

If Either = 1 Then

FileName = App.Path & "\Data\Mail\" & MyName & ".txt"

Inbox = Val(GetVar(FileName, "INBOX", "amount"))

Do While Inbox >= 1

If Val(GetVar(FileName, STR$(ListedMsg), "Number")) = Inbox Then

Set buffer = New clsBuffer

buffer.WriteLong SSetMsgBody

buffer.WriteString GetVar(FileName, STR$(ListedMsg), "Sender")

buffer.WriteString GetVar(FileName, STR$(ListedMsg), "Subject")

buffer.WriteString GetVar(FileName, STR$(ListedMsg), "Body")

buffer.WriteLong Either

SendDataTo Index, buffer.ToArray()

Set buffer = Nothing

Call PutVar(FileName, STR$(ListedMsg), "Read", 0)

Exit Do

End If

Inbox = Inbox - 1

Loop

Call Unread(Index, MyName)

Else

FileName = App.Path & "\Data\Mail\Outbox\" & MyName & ".txt"

Inbox = Val(GetVar(FileName, "OUTBOX", "amount"))

Do While Inbox >= 1

If Val(GetVar(FileName, STR$(ListedMsg), "Number")) = Inbox Then

Set buffer = New clsBuffer

buffer.WriteLong SSetMsgBody

buffer.WriteString GetVar(FileName, STR$(ListedMsg), "Sent")

buffer.WriteString GetVar(FileName, STR$(ListedMsg), "Subject")

buffer.WriteString GetVar(FileName, STR$(ListedMsg), "Body")

buffer.WriteLong Either

SendDataTo Index, buffer.ToArray()

Set buffer = Nothing

Exit Do

End If

Inbox = Inbox - 1

Loop

End If

End Sub

Public Sub HandleDeleteMsg(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim FileName As String, MyName As String, DltMsgNum As Long

Dim Inbox As Long, Total As Long, Either As Long

Dim buffer As clsBuffer

Set buffer = New clsBuffer

buffer.WriteBytes Data()

MyName = buffer.ReadString

DltMsgNum = buffer.ReadLong

Either = buffer.ReadLong

Set buffer = Nothing

If GetPlayerName(Index) <> MyName Then

Call HackingAttempt(Index, "Email Modification")

Exit Sub

End If

If Either = 1 Then

FileName = App.Path & "\Data\Mail\" & MyName & ".txt"

Call PutVar(FileName, STR$(DltMsgNum), "Number", 0)

Call PutVar(FileName, STR$(DltMsgNum), "Read", 0)

Call PutVar(FileName, STR$(DltMsgNum), "Sender", vbNullString)

Call PutVar(FileName, STR$(DltMsgNum), "Subject", vbNullString)

Call PutVar(FileName, STR$(DltMsgNum), "Body", vbNullString)

Inbox = Val(GetVar(FileName, "INBOX", "amount"))

Total = Val(GetVar(FileName, "INBOX", "total"))

Call PutVar(FileName, "INBOX", "amount", STR$(Inbox - 1))

Call PutVar(FileName, "INBOX", "total", STR$(Total - 1))

Call Unread(Index, MyName)

Else

FileName = App.Path & "\Data\Mail\Outbox\" & MyName & ".txt"

Call PutVar(FileName, STR$(DltMsgNum), "Number", 0)

Call PutVar(FileName, STR$(DltMsgNum), "Sent", vbNullString)

Call PutVar(FileName, STR$(DltMsgNum), "Subject", vbNullString)

Call PutVar(FileName, STR$(DltMsgNum), "Body", vbNullString)

Inbox = Val(GetVar(FileName, "OUTBOX", "amount"))

Total = Val(GetVar(FileName, "OUTBOX", "total"))

Call PutVar(FileName, "OUTBOX", "amount", STR$(Inbox - 1))

Call PutVar(FileName, "OUTBOX", "total", STR$(Total - 1))

End If

End Sub

Public Sub HandleUpdateInbox(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim FileName As String, MyInbox As String

Dim Inbox As Long, Either As Long

Dim buffer As clsBuffer

Set buffer = New clsBuffer

buffer.WriteBytes Data()

MyInbox = buffer.ReadString

Either = buffer.ReadLong

Set buffer = Nothing

If GetPlayerName(Index) <> MyInbox Then

Call HackingAttempt(Index, "Email Modification")

Exit Sub

End If

If Either = 1 Then

FileName = App.Path & "\Data\Mail\" & MyInbox & ".txt"

Inbox = Val(GetVar(FileName, "INBOX", "amount"))

Do While Inbox >= 1

If Val(GetVar(FileName, STR$(Inbox), "Number")) > 0 Then

Set buffer = New clsBuffer

buffer.WriteLong SMyInbox

buffer.WriteString GetVar(FileName, STR$(Inbox), "Sender")

buffer.WriteLong Val(GetVar(FileName, STR$(Inbox), "Number"))

buffer.WriteString GetVar(FileName, STR$(Inbox), "Subject")

SendDataTo Index, buffer.ToArray()

Set buffer = Nothing

End If

Inbox = Inbox - 1

Loop

'Call Unread(Index, MyInbox)

Else

FileName = App.Path & "\Data\Mail\Outbox\" & MyInbox & ".txt"

Inbox = Val(GetVar(FileName, "OUTBOX", "amount"))

Do While Inbox >= 1

If Val(GetVar(FileName, STR$(Inbox), "Number")) > 0 Then

Set buffer = New clsBuffer

buffer.WriteLong SMyOutbox

buffer.WriteString GetVar(FileName, STR$(Inbox), "Sent")

buffer.WriteLong Val(GetVar(FileName, STR$(Inbox), "Number"))

buffer.WriteString GetVar(FileName, STR$(Inbox), "Subject")

SendDataTo Index, buffer.ToArray()

Set buffer = Nothing

End If

Inbox = Inbox - 1

Loop

End If

End Sub

Public Sub HandleCheckChar(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim msgSender As String, msgReciever As String, msgSubject As String, msgBody As String

Dim buffer As clsBuffer

Set buffer = New clsBuffer

buffer.WriteBytes Data()

msgSender = buffer.ReadString

msgReciever = buffer.ReadString

msgSubject = buffer.ReadString

msgBody = buffer.ReadString

Set buffer = Nothing

If FindChar(msgReciever) = True Then

Call SendEmail(Index, msgSender, msgReciever, msgSubject, msgBody)

Else

Call PlayerMsg(Index, "That Player Does Not Exist!", BrightRed)

End If

End Sub
```

Go to ModPlayer and in the JoinGame Sub put this at the bottom:

```

Call Unread(Index, GetPlayerName(Index))

```

and add these subs

```

Public Sub SendEmail(ByVal index As Long, ByVal msgSender As String, ByVal msgReciever As String, ByVal msgSubject As String, ByVal msgBody As String)

Dim FileName As String, Inbox As Long, Total As Long

If GetPlayerName(index) <> msgSender Then

Call HackingAttempt(index, "Email Modification")

Exit Sub

End If

FileName = App.Path & "\Data\Mail\" & msgReciever & ".txt"

If Not FileExist("\Data\Mail\" & msgReciever & ".txt") Then

Call PutVar(FileName, "INBOX", "amount", 1)

Call PutVar(FileName, "INBOX", "total", 1)

Call PutVar(FileName, 1, "Number", 1)

Call PutVar(FileName, 1, "Read", 1)

Call PutVar(FileName, 1, "Sender", msgSender)

Call PutVar(FileName, 1, "Subject", msgSubject)

Call PutVar(FileName, 1, "Body", msgBody)

If IsPlaying(FindPlayer(msgReciever)) Then

If FindPlayer(msgReciever) <> index Then

Call Unread(FindPlayer(msgReciever), msgReciever)

Else

Call Unread(index, msgSender)

End If

End If

Call SendEmail2(index, msgSender, msgReciever, msgSubject, msgBody)

Else

Inbox = Val(GetVar(FileName, "INBOX", "amount"))

Total = Val(GetVar(FileName, "INBOX", "total"))

If Inbox = 9999 Or Total = 9999 Then

Exit Sub

End If

Call PutVar(FileName, STR$(Inbox + 1), "Number", STR$(Total + 1))

Call PutVar(FileName, STR$(Inbox + 1), "Read", 1)

Call PutVar(FileName, STR$(Inbox + 1), "Sender", msgSender)

Call PutVar(FileName, STR$(Inbox + 1), "Subject", msgSubject)

Call PutVar(FileName, STR$(Inbox + 1), "Body", msgBody)

Call PutVar(FileName, "INBOX", "amount", STR$(Inbox + 1))

Call PutVar(FileName, "INBOX", "total", STR$(Total + 1))

If IsPlaying(FindPlayer(msgReciever)) = True Then

If FindPlayer(msgReciever) <> index Then

Call Unread(FindPlayer(msgReciever), msgReciever)

Else

Call Unread(index, msgSender)

End If

End If

Call SendEmail2(index, msgSender, msgReciever, msgSubject, msgBody)

Exit Sub

End If

End Sub

Public Sub SendEmail2(ByVal index As Long, ByVal msgSender As String, ByVal msgReciever As String, ByVal msgSubject As String, ByVal msgBody As String)

Dim FileName As String

Dim Inbox As Long

Dim Total As Long

If GetPlayerName(index) <> msgSender Then

Call HackingAttempt(index, "Email Modification")

Exit Sub

End If

FileName = App.Path & "\Data\Mail\Outbox\" & msgSender & ".txt"

If Not FileExist("\Data\Mail\Outbox\" & msgSender & ".txt") Then

Call PutVar(FileName, "OUTBOX", "amount", 1)

Call PutVar(FileName, "OUTBOX", "total", 1)

Call PutVar(FileName, 1, "Number", 1)

Call PutVar(FileName, 1, "Sent", msgReciever)

Call PutVar(FileName, 1, "Subject", msgSubject)

Call PutVar(FileName, 1, "Body", msgBody)

Else

Inbox = Val(GetVar(FileName, "OUTBOX", "amount"))

Total = Val(GetVar(FileName, "OUTBOX", "total"))

If Inbox = 9999 Or Total = 9999 Then

Exit Sub

End If

Call PutVar(FileName, STR$(Inbox + 1), "Number", STR$(Total + 1))

Call PutVar(FileName, STR$(Inbox + 1), "Sent", msgReciever)

Call PutVar(FileName, STR$(Inbox + 1), "Subject", msgSubject)

Call PutVar(FileName, STR$(Inbox + 1), "Body", msgBody)

Call PutVar(FileName, "OUTBOX", "amount", STR$(Inbox + 1))

Call PutVar(FileName, "OUTBOX", "total", STR$(Total + 1))

Exit Sub

End If

End Sub

Public Sub Unread(ByVal index As Long, ByVal MyInbox As String)

Dim Unread As Long, Inbox As Long

Dim FileName As String

Dim buffer As clsBuffer

If GetPlayerName(index) <> MyInbox Then

Call HackingAttempt(index, "Email Modification")

Exit Sub

End If

FileName = App.Path & "\Data\Mail\" & MyInbox & ".txt"

Inbox = Val(GetVar(FileName, "INBOX", "amount"))

Do While Inbox >= 1

If Val(GetVar(FileName, STR$(Inbox), "Read")) = 1 Then

Unread = Unread + 1

End If

Inbox = Inbox - 1

Loop

If Unread > 0 Then

Call PlayerMsg(index, "You Have " & Unread & " New Message!", BrightRed)

End If

Set buffer = New clsBuffer

buffer.WriteLong SUnreadMsg

buffer.WriteLong Unread

SendDataTo index, buffer.ToArray()

Set buffer = Nothing

End Sub

```

'SAVE YOUR PROJECT

Credits to varinyc for the original tutorial, i just converted it ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

[http://www.touchofde…__+mail](http://www.touchofde...__+mail) +system

Damian
Link to comment
Share on other sites

You are missing **HandleSendEmail** sub.

(server-side/modHandleData)

So i wrote it, here it is:

```

Public Sub HandleSendEmail(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim buffer as clsBuffer

Dim msgSender As String

Dim msgReceiver As String

Dim msgSubject As String

Dim msgBody As String

Set buffer = New clsBuffer

buffer.WriteBytes Data()

msgSender = buffer.ReadString

msgReceiver = buffer.ReadString

msgSubject = buffer.ReadString

msgBody = buffer.ReadString

Set buffer = Nothing

SendEmail Index, msgSender, msgReceiver, msgSubject, msgBody

End Sub

```
Link to comment
Share on other sites

'ModEnumerations 'Public Enum ServerPackets

```
' Make sure SMSG_COUNT is below everything else

SMSG_COUNT
```

' and then in

'Public Enum ClientPackets

```
' Make sure CMSG_COUNT is below everything else

CMSG_COUNT
```

server side

' and then in

'Public Enum ClientPackets

```
' Make sure CMSG_COUNT is below everything else

CMSG_COUNT
```
Link to comment
Share on other sites

![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) awesome cantwait for you to finish this xD.

OMG o-o VAR DUCKED UP!!! xD he left out the admin code…..

orginaly what he converted dis from had a admin panel that had ability to send a message to all like from the "mod or admins" .

O.o but this is weird he had it in with HolyShadow guilds client.. XD he must have never updated his topic here wow.
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
Run time error '9'

subscript out off range

on these line :

```

HandleDataSub(CSendEmail) = GetAddress(AddressOf HandleSendEmail)
HandleDataSub(CGetMsgBody) = GetAddress(AddressOf HandleGetMsgBody)
HandleDataSub(CDeleteMsg) = GetAddress(AddressOf HandleDeleteMsg)
HandleDataSub(CUpdateInbox) = GetAddress(AddressOf HandleUpdateInbox)
HandleDataSub(CCheckChar) = GetAddress(AddressOf HandleCheckChar)

```
On Server side
Link to comment
Share on other sites

  • 11 months later...
~~For some reason, i know this post is totally dead btw, but if anyone's still alive, my image for the message button doesn't cover the whole 36 by 36\. its like it try's to stretch it and make the image a rectangle and its really annoying~~

Nevermind. I got it. silly me.
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...