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

Send value client to serveur. Multi Character account


Escanor
 Share

Recommended Posts

@'Lavos':

> @'Ging':
>
> > Yes I know, the error doesn't comme from there
>
> Please use screenshots to explain your error, it would help the community to better understand what you are asking for.

I am bad to express. I have no error but when I send a value of the client to the server the value stays in 0
Link to comment
Share on other sites

Of course

In Client , modClientTCP

```
Public Sub SendSetPerso(ByVal name As String, ByVal CharacNume As Long)
Dim buffer As clsBuffer

   ' If debug mode, handle error then exit out
   If Options.Debug = 1 Then On Error GoTo errorhandler

   Set buffer = New clsBuffer
   buffer.WriteLong CSetPerso
   buffer.WriteString name
   buffer.WriteLong CharacNume

   SendData buffer.ToArray()
   Set buffer = Nothing

   ' Error handler
   Exit Sub
errorhandler:
   HandleError "SendSetPerso", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext
   Err.Clear
   Exit Sub
End Sub
```
In Server modHandleData

```
Sub HandleSetPerso(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim i As String
   Dim n As Long
   Dim buffer As clsBuffer
   Set buffer = New clsBuffer
   buffer.WriteBytes Data()

   ' The sprite
   i = FindPlayer(buffer.ReadString)
   n = buffer.ReadLong '(CLng(Parse(1)))
   Set buffer = Nothing

    ' Prevent hacking
   'If GetPlayerPerso(i) = GetPlayerPerso(index) Then
 'Call PlayerMsg(index, "Tu es déjà ce personnage", Red)
  ' Exit Sub
  ' End If

  If GetPlayerPerso(n) > MAX_CHARACTERE Then
  Call PlayerMsg(index, "Erreur", Red)
  Exit Sub
  End If

   Call PlayerMsg(index, "Tu as changé de personnage !", Green)

   Call SetPlayerPerso(i, n)
   Call PlayerMsg(index, "De : " & GetPlayerPerso(index) & " à " & GetPlayerPerso(n), Blue)
   Call SendPlayerData(i)
   Exit Sub

End Sub
```
I have add CSetPerso in client enumeration and server enumeration
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...