Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
/save
#1
There's a typo in Save Player Packet
Reply
#2
On the server side, the paket should start with this..

Code:
If LCase(Parse(0)) = "requesteditmap" Then

For MS, but if your using Elysium then you would use whats in the post Wink.
Reply
#3
I hope this is alright...Sense I like this tutorial, and it's useful for lots of people, I want to update it for the MS4 version. I already have tested it out and everything. And yes, I know it's simple to change and make it work for MS4. Anyway...

::Client Side::

First add this in modGameLogic under the Commands section.
Code:
' Save
        If LCase(Mid(frmMirage.txtMyChat, 1, 5)) = "/save" Then
            Call SaveplayerData
            frmMirage.txtMyChat = ""
            Exit Sub
        End If

Then in ModClientTCP add this at the bottom.
Code:
Sub SaveplayerData()
Dim Packet As String

    Packet = CSaveplayerData & END_CHAR
    Call SendData(Packet)
End Sub

Then in modEnumerations add this under "Public Enum ClientPackets"
Code:
CSaveplayerData

::Server Side::

Now in modHandleData above the "Request edit map packet" add this.
Code:
' ::::::::::::::::::::::::
        ' :: Save Player Packet ::
        ' ::::::::::::::::::::::::
        Case CSaveplayerData
                If Map(GetPlayerMap(Index)).Moral = MAP_MORAL_SAFE Then
                    Call SavePlayer(Index)
                    Call PlayerMsg(Index, "Character Stats & Inventory Saved", Yellow)
                Else
                    Call PlayerMsg(Index, "You must be in a town or house to save!", Yellow)
            End If
        Exit Sub

Then in modEnumerations under "Public Enum ClientPackets" add this.
Code:
CSaveplayerData

All done.
Reply
#4
MS4 saves all chars, like every thirty seconds dude.
Reply
#5
Oh, really? I just downloaded it today and have been using it a little, so I didn't really notice.
Reply
#6
THIRTY SECONDS?!

Code:
' Checks to save players every 10 minutes - Can be tweaked
        If Tick > LastUpdateSavePlayers Then
            UpdateSavePlayers
            LastUpdateSavePlayers = GetTickCount + 60000
        End If

Private Sub UpdateSavePlayers()
Dim i As Long

Code:
Private Sub UpdateSavePlayers()
Dim i As Long

    If TotalOnlinePlayers > 0 Then
        Call TextAdd(frmServer.txtText, "Saving all online players...", True)
        Call GlobalMsg("Saving all online players...", Pink)
        For i = 1 To MAX_PLAYERS
            If IsPlaying(i) Then
                Call SavePlayer(i)
            End If
            DoEvents
        Next i
    End If
End Sub

modServerLoop.bas

I removed the GlobalMsg. =-p
Reply
#7
Mattyw Wrote:THIRTY SECONDS?!

Code:
' Checks to save players every 10 minutes - Can be tweaked
        If Tick > LastUpdateSavePlayers Then
            UpdateSavePlayers
            LastUpdateSavePlayers = GetTickCount + 60000
        End If

Private Sub UpdateSavePlayers()
Dim i As Long

Code:
Private Sub UpdateSavePlayers()
Dim i As Long

    If TotalOnlinePlayers > 0 Then
        Call TextAdd(frmServer.txtText, "Saving all online players...", True)
        Call GlobalMsg("Saving all online players...", Pink)
        For i = 1 To MAX_PLAYERS
            If IsPlaying(i) Then
                Call SavePlayer(i)
            End If
            DoEvents
        Next i
    End If
End Sub

modServerLoop.bas

I removed the GlobalMsg. =-p

I swear, I see that message "Saving all chars" like every thirty seconds.
Reply
#8
That 60000 would be once a minute, not ten minutes.

I don't know if i originally put in the wrong number or someone else changed it.
Reply
#9
Dugor Wrote:That 60000 would be once a minute, not ten minutes.

I don't know if i originally put in the wrong number or someone else changed it.

I didn't change that, that's how it was set when I got it.
Reply
#10
DarkC Wrote:
Dugor Wrote:That 60000 would be once a minute, not ten minutes.

I don't know if i originally put in the wrong number or someone else changed it.

I didn't change that, that's how it was set when I got it.

He meant another Mirage programmer.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#11
I think GIAKEN told me how he used to do that.

Hell, you don't even need /save. Just have the other person log out then crash, as it saves on log out.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#12
Then what would be the safest thing to do about saves? Have the server save every 1second or even faster? Though, I can't help but think that'll help lag up the game badly.
Reply
#13
Tbh, the biggest threat is user-generated crashes.

Just use CodeSMART to set up some error handling code (Make sure you're able to turn it on/off via a variable, otherwise your debugging days are over) and steal all GIAKEN's shit from Asphodel.

I couldn't do most of the popular hacks on that, except use the client-side map report to warp between maps. Which he fixed.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)