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

Packet Error


alextoti99
 Share

Recommended Posts

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

```The error is that when i go on that tile the client closes automatically without any error.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

![](https://puu.sh/wHEzO/00699f1e9e.png)

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:

![](https://puu.sh/wHEYy/969732ce3f.png)
Link to comment
Share on other sites

@'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 :P

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.
Link to comment
Share on other sites

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.
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...