Packet Error

Hello, im writing a code that when a play steps on a tile to send a packet and open a window at client the code:
Client:

ModBuy:
Sub OpenBuy(ByVal name As String)
frmBuy.Show
frmBuy.lblname.Caption = name
End Sub

ModEnum:SSentBuyChar
ModHandleData: 

    HandleDataSub(SSentBuyChar) = GetAddress(AddressOf HandleSetBuyChar)

Private Sub HandleSetBuyChar(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim buffer As clsBuffer
Dim CharName As String
Set buffer = New clsBuffer
buffer.WriteBytes data()
CharName = buffer.ReadString
Set buffer = Nothing
Call OpenBuy(CharName)
End Sub

```Server:

ModEnum: SSentBuyChar
ModServerTCP:
Public Sub SetBuyChar(ByVal index As Long)
Call PlayerMsg(index, “You can’t continue on the rest map without buying the game!”, Red)
Dim buffer As clsBuffer
Set buffer = New clsBuffer
buffer.WriteLong SSentBuyChar
buffer.WriteString GetPlayerName(index)
SendDataTo index, buffer.ToArray
Set buffer = Nothing

ModPlayer:
’ Premium
If (GetPlayerX(index) = 26) And (GetPlayerY(index) = 11) And (GetPlayerMap(index) = 10) And (GetPlayerBoughtChar(index) <> 1) Then
Call PlayerWarp(index, 10, 31, 11)
Call SetBuyChar(index)
End If

Best thing to do would be break point every part of it server side and client side and see which line closes it. The player name should be stored client side anyway so sending it from the server would be a waste of resources. Let me know which line you find is breaking it and I will help further.

i dont get any error, the client just close when i step on the tile

You need to break point every line server side and client side, by “error” I meant the closing. You break point every line and click play slowly and see which line was the one that closes then go from there.

with which button cna i do that 😛 sry im new with vb6

The little bar on the left, You can click it and it puts a brown circle to indicate a break point. You click again to remove it. When the code is ran it pauses the IDE so you can debug etc.

Hovering over App.Path shows this when using breakpoints to debug:

when doing this the yellow line goes at the message send at server adn nth happens , my bad i didnt understand it now i think i did 😛

@‘alextoti99’:

when doing this the yellow line goes at the message send at server adn nth happens , my bad i didnt understand it now i think i did 😛

Do you have Team Viewer? I’ll just connect and do it? Google it if you don’t have it and PM me the information to connect.

yeah i have teamviewer could u? 😄 i can now 😄 sent u a pm iwth credentials

Fixed. You need to make sure S#### goes in the SERVER Enums and C##### goes CLIENT Enums, You had client in server, server in client and some randomly placed none defined (no S or C) in the server one, Thus your count was 119 which was greater than your clients 117 count.

I saved both sources for you, Close them both and re-open to delete any break points I left behind.

thx a lot dude, i thought that they were going both at the same 😛 my bad lock the topic fixed

Not a problem :).

Locked as requested.

Log in to reply