Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MS4
#18
Server side find:

Code:
Sub HandleSaveNPC

Replace the whole sub with:

Code:
Private Sub HandleSaveNpc(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim NpcNum As Long
Dim Buffer As clsBuffer
Dim NpcSize As Long
Dim NpcData() As Byte

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Call HackingAttempt(Index, "Admin Cloning")
        Exit Sub
    End If
    
    Set Buffer = New clsBuffer

    Buffer.WriteBytes Data()
    
    NpcNum = Buffer.ReadLong
    
    ' Prevent hacking
    If NpcNum < 0 Or NpcNum > MAX_NpcS Then
        Call HackingAttempt(Index, "Invalid Npc Index")
        Exit Sub
    End If
    
    NpcSize = LenB(Npc(NpcNum))
    ReDim NpcData(NpcSize - 1)
    NpcData = Buffer.ReadBytes(NpcSize)
    CopyMemory ByVal VarPtr(Npc(NpcNum)), ByVal VarPtr(NpcData(0)), NpcSize
    
    ' Save it
    Call SendUpdateNpcToAll(NpcNum)
    Call SaveNpc(NpcNum)
    Call AddLog(GetPlayerName(Index) & " saved Npc #" & NpcNum & ".", ADMIN_LOG)
End Sub

I have also already updated the source download.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)