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

[ES 1.0] In-Game Email System 2.0


varinyc
 Share

Recommended Posts

Okay, This is my first huge from scratch source modification. X_X

[[u]InGame Mail System 1.0]
- Sends a message to directed player regardless to if they are online or not
- Checks to make sure if your receiver is a valid character
- Easily forward a message from your inbox
- players can store up to 9999 messages, maybe more with a slight edit
- Automatic Alert of a new/unread message
- Easily Delete an old/unwanted message
- Inbox keeps the mail in order from oldest to newest
- Alert System is completely automatic, It checks for new messages at login now too.
- The Alert System now includes a sound.

[[u]InGame Mail System 2.0]
- The layout has been completely redone.
- Now included is an outbox.
- Confirmation on pressing cancel during a new message.
- Graphical button to Inbox.

[Bug Free Policy]: This has been created and Tested in Eclipse Stable only. If anyone would like to test it on EE 2.7 or 2.8, could you tell me how it works out? Lastly, I'm only human, If you find an error, I'm always ready to fix it.

I created spoiler tags to make the thread look neater. Hope it works.

:+:+:CLIENT SIDE:+:+:

Now, Create a form named frmInbox:
I have the looks attached to this message, and enter this code in the form:

>! ```
Private Sub cmdCancel_Click()
    Dim x As Long
    x = MsgBox("Are you sure you want to discard your message?", vbYesNo)
    If x = vbNo Then
        Exit Sub
    End If

    frNew.Visible = False
    frmInbox.Width = 3350
    cmdForward.Enabled = True
    cmdOutboxSel.Enabled = True
    cmdInboxSel.Enabled = True
    cmdDelete.Enabled = True
    cmdCloseInbox.Enabled = True
    cmdNew.Enabled = True
    frInbox.Visible = False
    frOutbox.Visible = False
End Sub
>! Private Sub cmdCloseInbox_Click()
    Unload Me
End Sub
>! Private Sub cmdDelete_Click()
    Dim DltMsg As String
    Dim DltMsgNum As Long
>!     If frNew.Visible = True Then
        Exit Sub
    End If

    If lstMail.Visible = True Then
        DltMsg = lstMail.Text
        If DltMsg <> "" Then
            DltMsgNum = Mid$(DltMsg, 2, 4)
            Call RemoveMail(GetPlayerName(MyIndex), DltMsgNum, 1)
            lstMail.RemoveItem lstMail.ListIndex
        End If
    Else
            DltMsg = lstOutbox.Text
        If DltMsg <> "" Then
            DltMsgNum = Mid$(DltMsg, 2, 4)
            Call RemoveMail(GetPlayerName(MyIndex), DltMsgNum, 2)
            lstOutbox.RemoveItem lstOutbox.ListIndex
        End If
    End If
End Sub
>! Private Sub cmdForward_Click()
    If frNew.Visible = True Then
        Exit Sub
    End If
    Dim ListedMsg As Long
    Dim MsgID As String
    If lstMail.Visible = True Then
        MsgID = lstMail.Text
        If MsgID <> "" Then
            ListedMsg = Mid$(MsgID, 2, 4)
            Call GetMsgBody(GetPlayerName(MyIndex), ListedMsg, 1)
        End If
    Else
        MsgID = lstOutbox.Text
        If MsgID <> "" Then
            ListedMsg = Mid$(MsgID, 2, 4)
            Call GetMsgBody(GetPlayerName(MyIndex), ListedMsg, 2)
        End If
    End If
    frNew.Visible = True
    frmInbox.Width = 7750
    cmdForward.Enabled = False
    cmdOutboxSel.Enabled = False
    cmdInboxSel.Enabled = False
    cmdDelete.Enabled = False
    cmdCloseInbox.Enabled = False
    cmdNew.Enabled = False
    frInbox.Visible = False
    frOutbox.Visible = False
End Sub
>! Private Sub cmdInboxSel_Click()
    frOutbox.Visible = False
    frmInbox.Width = 3350
    lstOutbox.Visible = False
    lstMail.Visible = True
End Sub
>! Private Sub cmdNew_Click()
    If frNew.Visible = False Then
        txtBody.Text = vbNullString
        txtReceiver.Text = vbNullString
        txtSubject.Text = vbNullString
        frNew.Visible = True
        frmInbox.Width = 7750
        cmdForward.Enabled = False
        cmdOutboxSel.Enabled = False
        cmdInboxSel.Enabled = False
        cmdDelete.Enabled = False
        cmdCloseInbox.Enabled = False
        cmdNew.Enabled = False
        frInbox.Visible = False
        frOutbox.Visible = False
    End If
End Sub
>! Private Sub cmdOutboxSel_Click()
    frOutbox.Visible = False
    frmInbox.Width = 3350
    lstOutbox.Visible = True
    lstMail.Visible = False
End Sub
>! Private Sub cmdSend_Click()
        Call CheckChar(GetPlayerName(MyIndex), frmInbox.txtReceiver.Text, frmInbox.txtSubject.Text, frmInbox.txtBody.Text)
        Unload Me
End Sub
>! Private Sub Form_Load()
    Call CheckInbox(GetPlayerName(MyIndex), 1)
    Call CheckInbox(GetPlayerName(MyIndex), 2)
    Me.Width = 3350
End Sub
>! Private Sub lstMail_Click()
    If frNew.Visible = True Then
        Exit Sub
    End If

    frInbox.Visible = True
    frOutbox.Visible = False
    Dim ListedMsg As Long
    Dim MsgID As String
    MsgID = lstMail.Text
    If MsgID <> "" Then
        ListedMsg = Mid$(MsgID, 2, 4)
        Call GetMsgBody(GetPlayerName(MyIndex), ListedMsg, 1)
    End If
    frmInbox.Width = 7750
    frInbox.Visible = True
    frOutbox.Visible = False
End Sub
>! Private Sub lstOutbox_Click()
    If frNew.Visible = True Then
        Exit Sub
    End If

    frInbox.Visible = False
    frOutbox.Visible = True
    Dim ListedMsg As Long
    Dim MsgID As String
    MsgID = lstOutbox.Text
    If MsgID <> "" Then
        ListedMsg = Mid$(MsgID, 2, 4)
        Call GetMsgBody(GetPlayerName(MyIndex), ListedMsg, 2)
    End If
    frmInbox.Width = 7750
    frInbox.Visible = False
    frOutbox.Visible = True
End Sub
>! ```

Next Open frmMirage and Make a button and name it cmdMail, make sure it has a height of 25 and a width of 90, and set the style to 1 in the properties window. Preferably place it in the bottom Left corner space.Then paste this code into frmMirage:

>! ```
Private Sub cmdMail_Click()
    If frmInbox.Visible = False Then
        frmInbox.Visible = True
    End If
End Sub
>! ```

Next, open ModHandleData and paste this just above the End Sub at the bottom:

>! ```
    If (Casestring = "setmsgbody") Then
        If Parse(4) = 1 Then
            frmInbox.txtSender.Text = Parse(1)
            frmInbox.txtSubject.Text = Parse(2)
            frmInbox.txtBody.Text = Parse(3)
            frmInbox.txtBody2.Text = Parse(3)
        Else
            frmInbox.txtReceiver2.Text = Parse(1)
            frmInbox.txtSubject.Text = Parse(2)
            frmInbox.txtBody.Text = Parse(3)
            frmInbox.txtBody3.Text = Parse(3)
        End If
        Exit Sub
    End If

    If (Casestring = "xobniym") Then
        If Val(Parse(2)) <= 9 Then
            frmInbox.lstMail.addItem "[000" & Parse(2) & "]" & " " & Parse(1) & " - " & Parse(3)
        ElseIf Val(Parse(2)) >= 9 And Val(Parse(2)) <= 99 Then
            frmInbox.lstMail.addItem "[00" & Parse(2) & "]" & " " & Parse(1) & " - " & Parse(3)
        ElseIf Val(Parse(2)) > 99 Then
            frmInbox.lstMail.addItem "[0" & Parse(2) & "]" & " " & Parse(1) & " - " & Parse(3)
        Else
            frmInbox.lstMail.addItem "[" & Parse(2) & "]" & " " & Parse(1) & " - " & Parse(3)
        End If
        Exit Sub
    End If

    If (Casestring = "myoutbox") Then
        If Val(Parse(2)) <= 9 Then
            frmInbox.lstOutbox.addItem "[000" & Parse(2) & "]" & " " & Parse(1) & " - " & Parse(3)
        ElseIf Val(Parse(2)) >= 9 And Val(Parse(2)) <= 99 Then
            frmInbox.lstOutbox.addItem "[00" & Parse(2) & "]" & " " & Parse(1) & " - " & Parse(3)
        ElseIf Val(Parse(2)) > 99 Then
            frmInbox.lstOutbox.addItem "[0" & Parse(2) & "]" & " " & Parse(1) & " - " & Parse(3)
        Else
            frmInbox.lstOutbox.addItem "[" & Parse(2) & "]" & " " & Parse(1) & " - " & Parse(3)
        End If
        Exit Sub
    End If
    If (Casestring = "unreadmsg") Then
        Dim E As Long
        Dim Ending1 As String
        If Parse(1) > 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 FileExists("GUI\Inbox" & Ending1) Then
                    frmMirage.cmdMail.Picture = LoadPicture(App.path & "\GUI\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 FileExists("GUI\Inbox2" & Ending1) Then
                    frmMirage.cmdMail.Picture = LoadPicture(App.path & "\GUI\Inbox" & Ending1)
                End If
            Next E
        End If
>! ```

Still in ModHandleData, Find The Play Sound Packet area, and put this in with the other sound cases:

>! ```
Case "newmsg"
    Call PlaySound("magic18.wav")
>! ```

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

>! ```
Sub SendEmail(ByVal msgSender As String, ByVal msgReceiver As String, ByVal msgSubject As String, ByVal msgBody As String)
    Call SendData("sendemail" & SEP_CHAR & msgSender & SEP_CHAR & msgReceiver & SEP_CHAR & msgSubject & SEP_CHAR & msgBody & END_CHAR)
End Sub
>! Sub GetMsgBody(ByVal MyName As String, ByVal ListedMsg As Long, ByVal Either As Long)
    Call SendData("getmsgbody" & SEP_CHAR & MyName & SEP_CHAR & ListedMsg & SEP_CHAR & Either & END_CHAR)
End Sub
>! Sub RemoveMail(ByVal MyName As String, ByVal DltMsgNum As Long, ByVal Either As Long)
    Call SendData("dltmsg" & SEP_CHAR & MyName & SEP_CHAR & DltMsgNum & SEP_CHAR & Either & END_CHAR)
End Sub
>! Sub CheckInbox(ByVal MyInbox As String, ByVal Either As Long)
    Call SendData("updateinbox" & SEP_CHAR & MyInbox & SEP_CHAR & Either & END_CHAR)
End Sub
>! Sub CheckChar(ByVal msgSender As String, ByVal msgReceiver As String, ByVal msgSubject As String, ByVal msgBody As String)
    Call SendData("checkchar" & SEP_CHAR & msgSender & SEP_CHAR & msgReceiver & SEP_CHAR & msgSubject & SEP_CHAR & msgBody & END_CHAR)
End Sub
>! ```

SAVE YOUR PROJECT, and close the client.

:+:+:SERVER SIDE:+:+:

Create a Mail folder and also an Outbox folder in with your server. Open up ModHandleData and put this right under the other Case options at the bottom of the first sub.

>! ```
        Case "sendemail"
            Call Packet_SendEmail(Index, Parse(1), Parse(2), Parse(3), Parse(4))
            Exit Sub

        Case "getmsgbody"
            Call Packet_EmailBody(Index, Parse(1), Parse(2), Parse(3))
            Exit Sub

        Case "dltmsg"
            Call Packet_RemoveMail(Index, Parse(1), Parse(2), Parse(3))
            Exit Sub

        Case "updateinbox"
            Call Packet_MyInbox(Index, Parse(1), Parse(2))
            Exit Sub

        Case "checkchar"
            Call Packet_CheckChar(Index, Parse(1), Parse(2), Parse(3), Parse(4))
            Exit Sub
>! ```

Then put this at the VERY bottom of ModHandleData:

>! ```
Public Sub Packet_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
    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 & "\Mail\" & msgReciever & ".txt"
    If Not FileExists("\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 Packet_Unread(FindPlayer(msgReciever), msgReciever)
            Else
                Call Packet_Unread(Index, msgSender)
            End If
        End If
    Else
        If Inbox = 9999 Or Total = 9999 Then
            Exit Sub
        End If
        Inbox = GetVar(FileName, "INBOX", "amount")
        Total = GetVar(FileName, "INBOX", "total")

        Call PutVar(FileName, Inbox + 1, "Number", Total + 1)
        Call PutVar(FileName, Inbox + 1, "Read", 1)
        Call PutVar(FileName, Inbox + 1, "Sender", msgSender)
        Call PutVar(FileName, Inbox + 1, "Subject", msgSubject)
        Call PutVar(FileName, Inbox + 1, "Body", msgBody)
        Call PutVar(FileName, "INBOX", "amount", Inbox + 1)
        Call PutVar(FileName, "INBOX", "total", Total + 1)
        If IsPlaying(FindPlayer(msgReciever)) = True Then
            If FindPlayer(msgReciever) <> Index Then
                Call Packet_Unread(FindPlayer(msgReciever), msgReciever)
            Else
                Call Packet_Unread(Index, msgSender)
            End If
        End If
        Call Packet_SendEmail2(Index, msgSender, msgReciever, msgSubject, msgBody)
        Exit Sub
    End If
End Sub
>! Public Sub Packet_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 & "\Outbox\" & msgSender & ".txt"
    If Not FileExists("\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 = GetVar(FileName, "OUTBOX", "amount")
        Total = GetVar(FileName, "OUTBOX", "total")

        If Inbox = 9999 Or Total = 9999 Then
            Exit Sub
        End If
        Call PutVar(FileName, Inbox + 1, "Number", Total + 1)
        Call PutVar(FileName, Inbox + 1, "Sent", msgReciever)
        Call PutVar(FileName, Inbox + 1, "Subject", msgSubject)
        Call PutVar(FileName, Inbox + 1, "Body", msgBody)
        Call PutVar(FileName, "OUTBOX", "amount", Inbox + 1)
        Call PutVar(FileName, "OUTBOX", "total", Total + 1)
        Exit Sub
    End If
End Sub
>! Public Sub Packet_EmailBody(ByVal Index As Long, ByVal MyName As String, ByVal ListedMsg As Long, ByVal Either As Long)
    Dim FileName As String
    Dim Inbox As Long
    If GetPlayerName(index) <> MyName Then
        Call HackingAttempt(index, "Email Modification")
        Exit Sub
    End If
    If Either = 1 Then
        FileName = App.Path & "\Mail\" & MyName & ".txt"
        Inbox = GetVar(FileName, "INBOX", "amount")
        Do While Inbox >= 1
            If GetVar(FileName, Val(ListedMsg), "Number") = Inbox Then
                Call SendDataTo(Index, "setmsgbody" & SEP_CHAR & GetVar(FileName, Val(ListedMsg), "Sender") & SEP_CHAR & GetVar(FileName, Val(ListedMsg), "Subject") & SEP_CHAR & GetVar(FileName, Val(ListedMsg), "Body") & SEP_CHAR & Either & END_CHAR)
                Call PutVar(FileName, Val(ListedMsg), "Read", 0)
                Exit Do
            End If
            Inbox = Inbox - 1
        Loop
        Call Packet_Unread(Index, MyName)
    Else
        FileName = App.Path & "\Outbox\" & MyName & ".txt"
        Inbox = GetVar(FileName, "OUTBOX", "amount")
        Do While Inbox >= 1
            If GetVar(FileName, Val(ListedMsg), "Number") = Inbox Then
                Call SendDataTo(Index, "setmsgbody" & SEP_CHAR & GetVar(FileName, Val(ListedMsg), "Sent") & SEP_CHAR & GetVar(FileName, Val(ListedMsg), "Subject") & SEP_CHAR & GetVar(FileName, Val(ListedMsg), "Body") & SEP_CHAR & Either & END_CHAR)
                Exit Do
            End If
            Inbox = Inbox - 1
        Loop
    End If
End Sub
>! Public Sub Packet_RemoveMail(ByVal Index As Long, ByVal MyName As String, ByVal DltMsgNum As Long, ByVal Either As Long)
    Dim FileName As String
    Dim NewAmount As Long
    If GetPlayerName(index) <> MyName Then
        Call HackingAttempt(index, "Email Modification")
        Exit Sub
    End If 
    If Either = 1 Then
        FileName = App.Path & "\Mail\" & MyName & ".txt"

        Call PutVar(FileName, Val(DltMsgNum), "Number", 0)
        Call PutVar(FileName, Val(DltMsgNum), "Read", 0)
        Call PutVar(FileName, Val(DltMsgNum), "Sender", vbNullString)
        Call PutVar(FileName, Val(DltMsgNum), "Subject", vbNullString)
        Call PutVar(FileName, Val(DltMsgNum), "Body", vbNullString)
        Call Packet_Unread(Index, MyName)
    Else
        FileName = App.Path & "\Outbox\" & MyName & ".txt"

        Call PutVar(FileName, Val(DltMsgNum), "Number", 0)
        Call PutVar(FileName, Val(DltMsgNum), "Sent", vbNullString)
        Call PutVar(FileName, Val(DltMsgNum), "Subject", vbNullString)
        Call PutVar(FileName, Val(DltMsgNum), "Body", vbNullString)
    End If
End Sub
>! Public Sub Packet_MyInbox(ByVal Index As Long, ByVal MyInbox As String, ByVal Either As Long)
    Dim FileName As String
    Dim Inbox As Long
    Dim Unread As Long
    If GetPlayerName(index) <> MyInbox Then
        Call HackingAttempt(index, "Email Modification")
        Exit Sub
    End If 
    If Either = 1 Then
        FileName = App.Path & "\Mail\" & MyInbox & ".txt"
        Inbox = GetVar(FileName, "INBOX", "amount")
        Do While Inbox >= 1
            If GetVar(FileName, Val(Inbox), "Number") > 0 Then
                Call SendDataTo(Index, "xobniym" & SEP_CHAR & GetVar(FileName, Val(Inbox), "Sender") & SEP_CHAR & GetVar(FileName, Val(Inbox), "Number") & SEP_CHAR & GetVar(FileName, Val(Inbox), "Subject") & END_CHAR)
            End If
            Inbox = Inbox - 1
        Loop
        Call Packet_Unread(Index, MyInbox)
    Else
        FileName = App.Path & "\Outbox\" & MyInbox & ".txt"
        Inbox = GetVar(FileName, "OUTBOX", "amount")
        Do While Inbox >= 1
            If GetVar(FileName, Val(Inbox), "Number") > 0 Then
                Call SendDataTo(Index, "myoutbox" & SEP_CHAR & GetVar(FileName, Val(Inbox), "Sent") & SEP_CHAR & GetVar(FileName, Val(Inbox), "Number") & SEP_CHAR & GetVar(FileName, Val(Inbox), "Subject") & END_CHAR)
            End If
            Inbox = Inbox - 1
        Loop
    End If

End Sub
>! Public Sub Packet_Unread(ByVal Index As Long, ByVal MyInbox As String)
    Dim Unread As Long
    Dim Inbox As String
    Dim FileName As String
    If GetPlayerName(index) <> MyInbox Then
        Call HackingAttempt(index, "Email Modification")
        Exit Sub
    End If
    FileName = App.Path & "\Mail\" & MyInbox & ".txt"
    Inbox = GetVar(FileName, "INBOX", "amount")

    Do While Inbox >= 1
        If GetVar(FileName, Val(Inbox), "Read") = 1 Then
                Unread = Unread + 1
        End If
        Inbox = Inbox - 1
    Loop
    If Unread > 0 Then
        Call BattleMsg(Index, "You Have " & Unread & " New Message!", BRIGHTRED, 0)
        Call SendDataTo(Index, "sound" & SEP_CHAR & "newmsg" & END_CHAR)
    End If
    Call SendDataTo(Index, "unreadmsg" & SEP_CHAR & Unread & END_CHAR)
End Sub
>! Sub Packet_CheckChar(ByVal Index As Long, ByVal msgSender As String, ByVal msgReciever As String, ByVal msgSubject As String, ByVal msgBody As String)
    If FindChar(msgReciever) = True Then
        Call Packet_SendEmail(Index, msgSender, msgReciever, msgSubject, msgBody)
    Else
        Call PlayerMsg(Index, "That Player Does Not Exist!", BRIGHTRED)
    End If
End Sub
>! ```

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

>! ```
    Call Packet_Unread(Index, GetPlayerName(Index))
>! ```

SAVE YOUR PROJECT
Download the 2 JPGs here for your new Inbox Button and place them in your GUI folder, then you're done!

PS: If you end up using it, could ya add credit where it's due? ^_^ even just saying thank you in this topic is fine.

comments welcome ^_^

NOTICE: Modified recently (6/21/2012) to take out the nasty yellow text. Project inactive since '09
Link to comment
Share on other sites

its good and i like how u made this post nice and clean

but i there are few mistakes with End Select and End Sub Codes

also i get this error of ambiguous name detected for the following line:

Sub GetMsgBody(ByVal MyName As String, ByVal ListedMsg As Long
Link to comment
Share on other sites

sorry dude, but you have done something wrong then.

i just tried this on my Stable edit, and it went in without any problems.

so, start over, and read the thread good to see where you went wrong.

Damian666

Edit:

all works, although i must say i didnt see any alert on a new mail when i logged in.

maybe thats something you could add?
maybe use a battle message to show it to player or something, also another thing i noticed…
and i dont mean this in a bad way...

but your GUI for the inbox and stuff looks like shit XD
it could use a redesign ^^
Link to comment
Share on other sites

@[SB:

> Damian666 link=topic=50294.msg525638#msg525638 date=1250514951]
> sorry dude, but you have done something wrong then.
>
> i just tried this on my Stable edit, and it went in without any problems.
>
> so, start over, and read the thread good to see where you went wrong.
>
> Damian666
>
> Edit:
>
> all works, although i must say i didnt see any alert on a new mail when i logged in.
>
> maybe thats something you could add?
> maybe use a battle message to show it to player or something, also another thing i noticed…
> and i dont mean this in a bad way...
>
> but your GUI for the inbox and stuff looks like shit XD
> it could use a redesign ^^

Yes still working on getting the inbox to change on startup.
and yeah, I haven't done anything towards a GUI yet x_x;
I kinda just threw things on there for now.
Link to comment
Share on other sites

[UPDATE] The Inbox Is checked for new Messages at startup now. Quickly do the following:

All of this is on Server Side

Open up ModGameLogic, Go to the JoinGame Sub and under this:
```

' Update the server console.
    Call ShowPLR(Index)

```
Add our New line of code:
```
    Call Packet_Unread(Index, GetPlayerName(Index))

```
======================

Add this at the bottom of Packet_Unread in ModHandleData

```
    If Unread > 0 Then
        Call BattleMsg(Index, "You Have " & Unread & " New Message!", BRIGHTRED, 0)
    End If

```
And there you go.
Link to comment
Share on other sites

@[SB:

> Damian666 link=topic=50294.msg525703#msg525703 date=1250522243]
> good, that fixed it, but maybe add a little message, saying you recieved mail, and maybe even a sound?
>
> but yeah, it looks good ^^
>
> Damian666

:/
I just edited my Posts to include the battle message, I'll work on adding a sound.
Link to comment
Share on other sites

@[SB:

> Damian666 link=topic=50294.msg525707#msg525707 date=1250522502]
> lolol, we crossed posts huh ^^
>
> and you don't have to do it, i am just suggesting mate, if you think its fine as it is, good for you :)
>
> Damian666

Your suggestions are awesome, I just like making weird faces. no worries.
Link to comment
Share on other sites

[Update]The following allows for a new message sound:

Client side > ModHandleData > Find Play Sound Packet > Place this code in with the other case sound options:
```
            Case "newmsg"
                Call PlaySound("magic18.wav")

```

Server Side > ModHandleData > Find the following:
```
    If Unread > 0 Then
        Call BattleMsg(Index, "You Have " & Unread & " New Message!", BRIGHTRED, 0)
    End If

```
replace with:
```
    If Unread > 0 Then
        Call BattleMsg(Index, "You Have " & Unread & " New Message!", BRIGHTRED, 0)
        Call SendDataTo(Index, "sound" & SEP_CHAR & "newmsg" & END_CHAR)
    End If

```
Link to comment
Share on other sites

@Rose:

> Or you could add an exit confirmation if its accidentally clicked, especially if you're in the middle of a message.

o.o Okee dokee.

@[SB:

> Damian666 link=topic=50294.msg525734#msg525734 date=1250524653]
> yep, nice one mate ^^
>
> now for that GUI XD
>
> and maybe when you send a message, close the box?
> dunno about that one though, what if ya wanna send more then one…
>
> i don't know, forget it XD

o_0 Then Send Message button already has Unload Me in it.
Link to comment
Share on other sites

@Rose:

> You may want to add a delete after 3 days or whatever option, like if the person gets tons of mail and doesn't want to see it all everytime.. or add check boxes and a delete button. :3

Hmmm, maybe, but working with multiple anything, or timed anything, is tedious. So I might after I get some other things done first.

In the meantime, I recommend sticking with Gmail… XD jk jk
Link to comment
Share on other sites

@[SB:

> Damian666 link=topic=50294.msg525762#msg525762 date=1250528038]
> lolol, just fix teh GUI, maybe look at teh one i send ya, and go from there.
>
> its a game mailbox, no email XD
>
> Damian666

I think this new layout will be very suprising to you, ^_^
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...