Code:
;;--------------------------------------------------------------------------------
;; GetLifep()
;;--------------------------------------------------------------------------------
Func GetLifep()
Local $index, $offset, $count, $item[10], $foundobject = 0
startIterateObjectsList($index, $offset, $count)
While iterateObjectsList($index, $offset, $count, $item)
If StringInStr($item[1], "HealthBall_liquid") Then
return _MemoryRead($item[8] + 0x408, $d3, 'float')
EndIf
WEnd
EndFunc ;==>GetLifep
Func checkForPotion()
;Local $mesurepot = TimerInit() ;;;;;;;;;;;;;;
$life = GetLifep()
If IsNumber($life) Then
$diff = TimerDiff($timeforpotion)
If $life < $LifeForPotion/100 and $diff > 30000 Then
$timeforpotion = TimerInit()
send("q")
EndIf
endfunc
;;--------------------------------------------------------------------------------
;; Function to iterate all objects()
;;--------------------------------------------------------------------------------
Func startIterateObjectsList(ByRef $index, ByRef $offset, ByRef $count)
$count = _MemoryRead($_itrObjectManagerCount, $d3, 'int')
$index = 0
$offset = $_itrObjectManagerD
EndFunc ;==>startIterateObjectsList
Func iterateObjectsList(ByRef $index, ByRef $offset, ByRef $count, ByRef $item)
While 1
If $index > $count Then Return False
$index += 1
$item[0] = _MemoryRead($offset + 0x4, $d3, 'ptr') ; GUID
$item[1] = _MemoryRead($offset + 0x8, $d3, 'char[64]') ; Name
$item[2] = _MemoryRead($offset + 0xB0, $d3, 'float') ; PosX
$item[3] = _MemoryRead($offset + 0xB4, $d3, 'float') ; PosY
$item[4] = _MemoryRead($offset + 0xB8, $d3, 'float') ; PosZ
$item[5] = _MemoryRead($offset + 0x1FC, $d3, 'int') ; Data1
$item[6] = _MemoryRead($offset + 0x1CC, $d3, 'int') ; Data2
$item[7] = _MemoryRead($offset + 0x1C0, $d3, 'int') ; Data3
$item[8] = $offset ; Current Offset
$item[9] = getDistance($item[2], $item[3], $item[4]) ; Distance
$offset = $offset + $_ObjmanagerStrucSize
Return True
WEnd
EndFunc ;==>iterateObjectsList