Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New Gold System
#1
Okay, I was trying to create a new item and PlayerRec so I could record how much gold they have instead of using an item that appears in the Inventory.
I've come to a halt because I've received this silly error:

"You have lost your connection with Mirage Source 4"

I'm guessing that something isn't synced properly, but for the life of me I've confused myself so I am looking to the genius of this forum to suss it out. Tongue Hopefully.

So far this is what I have added:
[spoiler]SERVER

ADDED: modConstants - at the end of Item Constants
Code:
Public Const ITEM_TYPE_GOLD As Byte = 14
ADDED: modTypes - under PK as Byte
Code:
Gold As Long
ADDED: modPlayer
Code:
Public Function GetPlayerGold(ByVal Index As Long)
    GetPlayerGold = Player(Index).Char(TempPlayer(Index).CharNum).Gold
End Function

Public Sub SetPlayerGold(ByVal Index As Long, ByVal Value As Long)
    Player(Index).Char(TempPlayer(Index).CharNum).Gold = Value
End Sub
ADDED: modEnumerations - under SCastSpell
Code:
SGold
ADDED: modEnumerations - under CStats
Code:
CGold
ADDED: modHandleData - under CQuit
Code:
Case CGold
            HandlePlayerGold Parse
ADDED: modHandleData
Code:
' :::::::::::::::::::::::::
' :: Player Gold packet ::
' :::::::::::::::::::::::::
Private Sub HandlePlayerGold(ByVal Index as Long, ByRef Parse() As String)
    Call SetPlayerGold(Index, GetPlayerGold(Index), CLng(Parse(1)))
End Sub



CLIENT

ADDED: modConstants - at the end of Item Constants
Code:
Public Const ITEM_TYPE_GOLD As Byte = 14
ADDED: modTypes - PlayerRec under PK as Byte
Code:
Gold As Long
ADDED: modDatabase
Code:
Public Function GetPlayerGold(ByVal Index As Long)
    GetPlayerGold = Player(Index).Gold
End Function

Public Sub SetPlayerGold(ByVal Index As Long, ByVal Value As Long)
    Player(Index).Gold = Value
End Sub

ADDED: modHandleData
Code:
' :::::::::::::::::::::::::
' :: Player Gold packet ::
' :::::::::::::::::::::::::
Private Sub HandlePlayerGold(ByRef Parse() As String)
    Call SetPlayerGold(MyIndex, GetPlayerGold(MyIndex), CLng(Parse(1)))
End Sub
ADDED: modHandleData
Code:
Case SGold
            HandlePlayerGold Parse
[/spoiler]

I hope someone can work it it out. I really want to get on with added the rest of it in. lol
Reply
#2
You're not adding

Code:
SGold
and
Code:
CGold
in the client enum. Do that and the problem should be fixed.
Reply
#3
You're not calling;
HandlePlayerGold

Look at the top of modHandleData. You should see all the CallByAddresses. These call different subs depending on the packet's header.

Add an extra call so HandlePlayerGold is called if the packet's header is SGold
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
#4
Nean Wrote:You're not adding

Code:
SGold
and
Code:
CGold
in the client enum. Do that and the problem should be fixed.

Yup I noticed that after I posted it. lol. That still did not resolve it though.

Robin Wrote:You're not calling;
HandlePlayerGold

Look at the top of modHandleData. You should see all the CallByAddresses. These call different subs depending on the packet's header.

Add an extra call so HandlePlayerGold is called if the packet's header is SGold

Within the Select Case statement? I have now, I believe and still get the same error.
Server:
Code:
Case CGold
            HandlePlayerGold Index, Parse
I added that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)