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

[EO 2.0/3.0] Serial Number, Redeem Item or etc [Fixed]


PVJsquad
 Share

Recommended Posts

Okay so when I save a blank serial it will save, and it will give out the item when the player hits the claim button with a blank text box, but it WILL NOT save a serial that has a number as it crashes the server, I am a bit of a newb so looking at the code I have no idea what the issue is, but it seems to me that something that is being sent (the serial 'name') to the server isn't defined for it to save.
Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 159
  • Created
  • Last Reply

Top Posters In This Topic

@Arcanine1223:

> in modConstants add
> ```
> Public Const MAX_SERIAL_NUMBER As Long = 100
>
> ```I think it was.

Thank you very much

EDIT :

![](http://image.ohozaa.com/i/b77/UCcGZB.jpg)
![](http://image.ohozaa.com/i/59e/BAEUlS.jpg)
Link to comment
Share on other sites

@kurenai:

> Thank you very much
>
> EDIT :
>
> ![](http://image.ohozaa.com/i/b77/UCcGZB.jpg)
> ![](http://image.ohozaa.com/i/59e/BAEUlS.jpg)

Are you sure place the code in  bottom **modHandleData**
```
' Serial
Sub HandleEditSerial(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Exit Sub
    End If

    Set Buffer = New clsBuffer
    Buffer.WriteLong SSerialEditor
    SendDataTo Index, Buffer.ToArray()
    Set Buffer = Nothing
End Sub

Sub HandleRequestSerial(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    SendSerial Index
End Sub

Private Sub HandleSaveSerial(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim SerialNum As Long
    Dim Buffer As clsBuffer
    Dim SerialSize As Long
    Dim SerialData() As Byte

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Exit Sub
    End If

    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    SerialNum = Buffer.ReadLong

    ' Prevent hacking
    If SerialNum < 0 Or SerialNum > MAX_SERIAL_NUMBER Then
        Exit Sub
    End If

    SerialSize = LenB(Serial(SerialNum))
    ReDim SerialData(SerialSize - 1)
    SerialData = Buffer.ReadBytes(SerialSize)
    CopyMemory ByVal VarPtr(Serial(SerialNum)), ByVal VarPtr(SerialData(0)), SerialSize
    ' Save it
    Call SendUpdateSerialToAll(SerialNum)
    Call SaveSerialNumber(SerialNum)
    Call AddLog(GetPlayerName(Index) & " saved Serial Code #" & SerialNum & ".", ADMIN_LOG)
End Sub
```
Link to comment
Share on other sites

  • 1 month later...
Still getting crashes from the Save button, but for those who actually know what they are doing, the server crashes after displaying the message 'mengirim data…', which means it is crashing either after Sub SendUpdateSerialToAll, or Sub SendUpdateSerialsTo. (Both can be found in modServerTCP)

I'll be trying to fix this in the meantime.
Link to comment
Share on other sites

Process: [client side]
User clicks smdSave [Call SerialEditorOk]
SerialEditorOk [calls SendSaveSerial(i) if Serial_Changed = 1 To MAX_SERIAL_NUMBER]
SendSaveSerial [buffer.WriteLong CSaveSerial]
–SERVER SIDE--
CSaveSerial [HandleDataSub(CSaveSerial) = GetAddress(AddressOf HandleSaveSerial)]
HandleSaveSerial [Call SaveSerialNumber]
SaveSerialNumber [This is where the error is located.]

```
Sub SaveSerialNumber(ByVal SerialNum As Long)
    Dim filename As String
    Dim F As Long
    filename = App.Path & "\data\serial\" & SerialNum & ".dat"
    F = FreeFile
    Open filename For Binary As #F
        Put #F, , Serial(SerialNum)
    Close #F
End Sub
```
That section of code must be where the error is. I'll do some testing.

Edit: The crashing line is 'Put #F, , Serial(SerialNum)'
Link to comment
Share on other sites

Upon closer inspection, the line is fine, but the Serial(SerialNum) seems to be passed incorrectly. If I comment out the whole line, the sub runs fine, but doesn't save the serial in a dat file. If the serial inserted into the frmEditor_Serial is blank, then the sub runs fine too. And, SaveSerialNumber is called upon server startup if the (number).dat files do not exist in the /serial/ folder, and that has no problem. Therefore, the problem must be the Serial(SerialNum), which means that I will have to go back through the program to determine what exactly happens with it.

Edit: OK, I give up. What I think is happening is that the Serial part of Serial(SerialNum) is not getting passed at all, and when the Server tries to write that to a file, it crashes. But I have pretty much no experience with VB6, so if someone else would take a look at it, that would be great.
Link to comment
Share on other sites

  • 2 weeks later...
I get an error here:

```
'///////////////////
'// Game Editor  //
'///////////////////

Public Sub SerialEditorInit()
    If frmEditor_Serial.Visible = False Then Exit Sub
    EditorIndex = frmEditor_Serial.lstIndex.ListIndex + 1

    With frmEditor_Serial

        .txtName.text = Serial(EditorIndex).Name
        .scrlItem.Value = Serial(EditorIndex).Item
        .HScroll1.Value = Serial(EditorIndex).ItemValue

    End With
    Serial_Changed(EditorIndex) = True
End Sub

```
line:```
EditorIndex = frmEditor_Serial.lstIndex.ListIndex + 1
```
Error: "method or data member not found" at```
.lstIndex.
```

I think the error is cause of this: "add the frmEditor_Serial in attachfile"

i do not know what you mean with that, i just created a new form called frmEditor_Serial

how to make attachfile, help me fix this please
Link to comment
Share on other sites

  • 2 weeks later...
the weird thing is. When i start the server in debug mode, i can save new codes and redeem them. but the listbox does not show anything, it doesnt show codes or anything else, it is just blank as it were at beginning.

when i start the server normally without debug mode, i can't save new codes because the server crashes when i try to save them.

so either way there is something wrong
Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 2 weeks later...
  • 2 weeks later...
  • 2 months later...

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