A problem with sending data to server

So im using

Public Sub SendSavePokemon(ByVal pokemonnum As Long)

Dim Buffer As clsBuffer

Dim PokemonSize As Long

Dim PokemonData() As Byte

Dim asd As String

Set Buffer = New clsBuffer

PokemonSize = LenB(Pokemon(pokemonnum))

ReDim PokemonData(PokemonSize - 1)

CopyMemory PokemonData(0), ByVal VarPtr(Pokemon(pokemonnum)), PokemonSize

Buffer.WriteLong CSavePokemon

Buffer.WriteLong pokemonnum

Buffer.WriteBytes PokemonData

SendData Buffer.ToArray()

Set Buffer = Nothing

End Sub

it seams to be sending and being picked up by the server yet…

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

Dim pokemonnum As Long

Dim Buffer As clsBuffer

Dim PokemonSize As Long

Dim PokemonData() As Byte

Dim asd As String

’ Prevent hacking

If GetPlayerAccess(index) < ADMIN_DEVELOPER Then

Exit Sub

End If

Set Buffer = New clsBuffer

Buffer.WriteBytes Data()

pokemonnum = Buffer.ReadLong

PokemonSize = LenB(Pokemon(pokemonnum))

ReDim PokemonData(PokemonSize - 1)

PokemonData = Buffer.ReadBytes(PokemonSize)

CopyMemory ByVal VarPtr(Pokemon(pokemonnum)), ByVal VarPtr(PokemonData(0)), PokemonSize

’ Save it

Call SendUpdatePokemonToAll(pokemonnum)

Call SavePokemon(pokemonnum)

Pokemon(pokemonnum).Name = asd

End Sub

I added the Pokemon(pokemonnum).Name = asd and it’s saying the name = “” so it doesnt seam to be actually sending the data…

any ideas?

to further clarify… I get no errors it seams to go through but it doesnt seam to actually be sending data I added a Pokemon(pokemonnum).Name = asd to both subs and it does change the name for when its sent so it is sending the changed data and the editor there for must be changing it yet for some reason in the server it doesnt recieve changed data… I checked the smsg and cmsg the Rec and it all seams to add up so I really dontk now whats going on.

really no ideas at all? 😧 damn I’m really stumped I basically duplicated everything used for spells and just changed the names >.>

Use code tags. And wait at least 24hrs before bumping. Because not everyone who can help is on-line

ontopic

I’ll check the code out and report my findings soon.

EDIT: Client side add a debug.print and print the data(). Then when receiving it print the data. That might be a good way if actually data exists, is being sent and is being received.

data is being sent and the data seams to be gettin recieved but it is empty very confused.

I figured it out.

What you are trying to do is set the name to the value of asd. asd is always null since you didn’t assign any value.

Let me try to be a bit more clear.


Pokemon(pokemonnum).Name = asd

The LHS is the variable while the RHS is the value assigned to the variable. Since asd is null then the name is assigned as null. That is why you’ll always get a null string. It should be like this


asd = pokemon(pokemonnum).name

So try to msgbox the value of pokemon(pokemonnum).value

Wow what a stupid mistake… Lol… thank you >.>

If this was solved then please do set the tag to resolved. (Edit main post in full editor and choose the tag ‘Resolved’)

Log in to reply