Take directly from my code:
Code:
Function scan()
Dim current As String
Dim zCompare As String
Dim data As Byte() = New Byte(255) {}
Dim zCom As Byte() = New Byte(255) {}
mem.Peek(gproc, pYLoc, zCom)
zCompare = System.BitConverter.ToSingle(zCom, 0)
While found = 0
mem.Peek(gproc, baseY, data)
current = System.BitConverter.ToSingle(data, 0)
If current = zCompare Then
found = 1
dYa = baseY
pBase = baseY - &HBE8
loggedCheck.Enabled = True
Else
If baseY < stopY Then
baseY += offset
Else
found = 1
log.report("Player Not Found.")
End If
End If
End While
Return found
End Function
To show you what this could be in C++: (This will not work)
Code:
Func scan {
found Integer
current String
zComp String
data Byte
zCByte Byte
scanZ Integer = 0x900BE8 // Where it will start scanning, notice the BE8 for the offset of Z that we are scanning for
stopZ Integer = 0x2F000BE8 // Where it will stop scanning, you can set this lower
readprocessmemory(Process, 0x0-Static Z Address, zCByte) // Read the Static Z Address and buffer it to zCBye
zComp = Converter->Single(zCByte, 0) // Use a converter to convert bytes -> single, YOU DO NOT HAVE TO USE THIS AS IT MAY SLOW SCAN SPEEDS DOWN - I Used it so it was easier debugging for me. IF YOU DO NOT USE THIS, DON'T USE IT BELOW
While found == 0 { // Use an equivalent to While, I'm using it because of my code above
readproccessmemory(Process, scanZ, data) // Buffer the current scanZ Address to the Data that we declared
current == Converter->Single(data, 0) // Use a converter to compare to before, ONLY USE THIS IF YOU CONVERTED BEFORE.
if current == zComp {
found == 1
// Do your player-base saving here, eg; subtract the 0xBE8 Offset for player base
} else {
if scanZ < stopZ {
scanZ += offset
} else {
found = 1
// If you like Report you didn't find the playerbase, I use Found=1 as a cheap way to stop the function
}
}
}
As I said, it won't compile but it's quick at scanning and if you call it as a function it's nice and tidy.
You should be able to easily code a function from what I have provided you.