25-09-2009, 08:43 PM
Matt Wrote: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.
That's the fix for NPCs that I posted on the first page.