daily pastebin goal
75%
SHARE
TWEET

Datei3.ahk

a guest Jun 18th, 2017 170 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Include address.ahk
  2. #Include memory.ahk
  3.  
  4. global SPECIAL_ACTION_NONE                  := 0
  5. global SAMP_PPOOL_PLAYER_OFFSET             := 0x18
  6. global SAMP_PPOOL_VEHICLE_OFFSET            := 0x1C
  7. global SAMP_PPOOL_PICKUP_OFFSET             := 0x20
  8. global SAMP_PPOOL_OBJECT_OFFSET             := 0x4
  9. global SAMP_COLOR_OFFSET                    := 0x216378
  10. global DIALOG_STYLE_MSGBOX                  := 0
  11. global DIALOG_STYLE_INPUT                   := 1
  12. global DIALOG_STYLE_LIST                    := 2
  13. global DIALOG_STYLE_PASSWORD                := 3
  14. global DIALOG_STYLE_TABLIST                 := 4
  15. global DIALOG_STYLE_TABLIST_HEADERS         := 5
  16. global SAMP_DIALOG_STRUCT_PTR               := 0x21A0B8
  17. global SAMP_DIALOG_PTR1_OFFSET              := 0x1C
  18. global SAMP_DIALOG_LINES_OFFSET             := 0x44C
  19. global SAMP_DIALOG_INDEX_OFFSET             := 0x443
  20. global SAMP_DIALOG_BUTTON_HOVERING_OFFSET   := 0x465
  21. global SAMP_DIALOG_BUTTON_CLICKED_OFFSET    := 0x466
  22. global SAMP_DIALOG_PTR2_OFFSET              := 0x20
  23. global SAMP_DIALOG_LINECOUNT_OFFSET         := 0x150
  24. global SAMP_DIALOG_OPEN_OFFSET              := 0x28
  25. global SAMP_DIALOG_STYLE_OFFSET             := 0x2C
  26. global SAMP_DIALOG_ID_OFFSET                := 0x30
  27. global SAMP_DIALOG_TEXT_PTR_OFFSET          := 0x34
  28. global SAMP_DIALOG_CAPTION_OFFSET           := 0x40
  29. global FUNC_SAMP_SHOWDIALOG                 := 0x6B9C0
  30. global FUNC_SAMP_CLOSEDIALOG                := 0x6C040
  31. global SAMP_INFO_OFFSET                     := 0x21A0F8
  32. global SAMP_PPOOLS_OFFSET                   := 0x3CD
  33. global SAMP_PPOOL_PLAYER_OFFSET             := 0x18
  34. global SAMP_LOCALPLAYER_OFFSET              := 0x22
  35. global SAMP_ENGINE                          := 0x12472748
  36. global CPed                                 := readDWORD(hGTA, 0xB6F5F0)
  37. global SAMP_3DTEXT                  := 0x12C7BC
  38. global dwSAMP := 0x0
  39. global SAMP_DIALOG_PTR                          := 0x21A0B8
  40. global SAMP_DIALOG_OFFSET                       := 0x34
  41. global SAMP_DIALOG_SIZE                         := 2048
  42.  
  43. global functionPatches := {}
  44. functionPatches.Push(Object("NAME", "SetPlayerName", "OFFSET", 0x01A4F0, "PATCH", 0xC390))
  45. functionPatches.Push(Object("NAME", "SetPlayerPos", "OFFSET", 0x015970, "PATCH", 0xC390))
  46. functionPatches.Push(Object("NAME", "SetPlayerPosFindZ", "OFFSET", 0x015A90, "PATCH", 0xC390))
  47. functionPatches.Push(Object("NAME", "SetPlayerHealth", "OFFSET", 0x015BA0, "PATCH", 0xC390))
  48. functionPatches.Push(Object("NAME", "TogglePlayerControllable", "OFFSET", 0x0168E0, "PATCH", 0xC390))
  49. functionPatches.Push(Object("NAME", "PlaySound", "OFFSET", 0x016980, "PATCH", 0xC390))
  50. functionPatches.Push(Object("NAME", "SetPlayerWorldBounds", "OFFSET", 0x016A60, "PATCH", 0xC390))
  51. functionPatches.Push(Object("NAME", "GivePlayerMoney", "OFFSET", 0x016B50, "PATCH", 0xC390))
  52. functionPatches.Push(Object("NAME", "SetPlayerFacingAngle", "OFFSET", 0x016BF0, "PATCH", 0xC390))
  53. functionPatches.Push(Object("NAME", "ResetPlayerMoney", "OFFSET", 0x014780, "PATCH", 0xC390))
  54. functionPatches.Push(Object("NAME", "ResetPlayerWeapons", "OFFSET", 0x014790, "PATCH", 0xC390))
  55. functionPatches.Push(Object("NAME", "GivePlayerWeapon", "OFFSET", 0x016C90, "PATCH", 0xC390))
  56. functionPatches.Push(Object("NAME", "SetVehicleParamsEx", "OFFSET", 0x00E370, "PATCH", 0xC390))
  57. functionPatches.Push(Object("NAME", "EnterVehicle", "OFFSET", 0x00E650, "PATCH", 0xC390))
  58. functionPatches.Push(Object("NAME", "EnterEditObject", "OFFSET", 0x00BA90, "PATCH", 0xC390))
  59. functionPatches.Push(Object("NAME", "CancelEdit", "OFFSET", 0x00BB50, "PATCH", 0xC390))
  60. functionPatches.Push(Object("NAME", "SetPlayerTime", "OFFSET", 0x00C4E0, "PATCH", 0xC390))
  61. functionPatches.Push(Object("NAME", "ToggleClock", "OFFSET", 0x00C5C0, "PATCH", 0xC390))
  62. functionPatches.Push(Object("NAME", "WorldPlayerAdd", "OFFSET", 0x00DBB0, "PATCH", 0xC390))
  63. functionPatches.Push(Object("NAME", "SetPlayerShopName", "OFFSET", 0x014540, "PATCH", 0xC390))
  64. functionPatches.Push(Object("NAME", "SetPlayerSkillLevel", "OFFSET", 0x00C6A0, "PATCH", 0xC390))
  65. functionPatches.Push(Object("NAME", "SetPlayerDrunkLevel", "OFFSET", 0x015490, "PATCH", 0xC390))
  66. functionPatches.Push(Object("NAME", "Create3DTextLabel", "OFFSET", 0x00C7D0, "PATCH", 0xC390))
  67. functionPatches.Push(Object("NAME", "DisableCheckpoint", "OFFSET", 0x00B780, "PATCH", 0xC390))
  68. functionPatches.Push(Object("NAME", "SetRaceCheckpoint", "OFFSET", 0x00D330, "PATCH", 0xC390))
  69. functionPatches.Push(Object("NAME", "DisableRaceCheckpoint", "OFFSET", 0x00B790, "PATCH", 0xC390))
  70. functionPatches.Push(Object("NAME", "GameModeRestart", "OFFSET", 0x00B830, "PATCH", 0xC390))
  71. functionPatches.Push(Object("NAME", "PlayAudioStream", "OFFSET", 0x019990, "PATCH", 0xC390))
  72. functionPatches.Push(Object("NAME", "StopAudioStream", "OFFSET", 0x0147E0, "PATCH", 0xC390))
  73. functionPatches.Push(Object("NAME", "RemoveBuildingForPlayer", "OFFSET", 0x019B00, "PATCH", 0xC390))
  74. functionPatches.Push(Object("NAME", "CreateObject", "OFFSET", 0x017980, "PATCH", 0xC390))
  75. functionPatches.Push(Object("NAME", "SetObjectPos", "OFFSET", 0x018050, "PATCH", 0xC390))
  76. functionPatches.Push(Object("NAME", "SetObjectRot", "OFFSET", 0x018160, "PATCH", 0xC390))
  77. functionPatches.Push(Object("NAME", "DestroyObject", "OFFSET", 0x018260, "PATCH", 0xC390))
  78. functionPatches.Push(Object("NAME", "DeathMessage", "OFFSET", 0x01A290, "PATCH", 0xC390))
  79. functionPatches.Push(Object("NAME", "SetPlayerMapIcon", "OFFSET", 0x016DE0, "PATCH", 0xC390))
  80. functionPatches.Push(Object("NAME", "RemoveVehicleComponent", "OFFSET", 0x018C00, "PATCH", 0xC390))
  81. functionPatches.Push(Object("NAME", "Update3DTextLabel", "OFFSET", 0x00C980, "PATCH", 0xC390))
  82. functionPatches.Push(Object("NAME", "ChatBubble", "OFFSET", 0x00CA40, "PATCH", 0xC390))
  83. functionPatches.Push(Object("NAME", "UpdateSystemTime", "OFFSET", 0x00CFE0, "PATCH", 0xC390))
  84. functionPatches.Push(Object("NAME", "ShowDialog", "OFFSET", 0x00CBB0, "PATCH", 0xC390))
  85. functionPatches.Push(Object("NAME", "DestroyPickup", "OFFSET", 0x00C200, "PATCH", 0xC390))
  86. functionPatches.Push(Object("NAME", "WeaponPickupDestroy", "OFFSET", 0x016D50, "PATCH", 0xC390))
  87. functionPatches.Push(Object("NAME", "LinkVehicleToInterior", "OFFSET", 0x016580, "PATCH", 0xC390))
  88. functionPatches.Push(Object("NAME", "SetPlayerArmour", "OFFSET", 0x0171A0, "PATCH", 0xC390))
  89. functionPatches.Push(Object("NAME", "SetPlayerArmedWeapon", "OFFSET", 0x015530, "PATCH", 0xC390))
  90. functionPatches.Push(Object("NAME", "SetSpawnInfo", "OFFSET", 0x014640, "PATCH", 0xC390))
  91. functionPatches.Push(Object("NAME", "SetPlayerTeam", "OFFSET", 0x015D60, "PATCH", 0xC390))
  92. functionPatches.Push(Object("NAME", "PutPlayerInVehicle", "OFFSET", 0x015C50, "PATCH", 0xC390))
  93. functionPatches.Push(Object("NAME", "RemovePlayerFromVehicle", "OFFSET", 0x0146E0, "PATCH", 0xC390))
  94. functionPatches.Push(Object("NAME", "SetPlayerColor", "OFFSET", 0x015E50, "PATCH", 0xC390))
  95. functionPatches.Push(Object("NAME", "DisplayGameText", "OFFSET", 0x015F40, "PATCH", 0xC390))
  96. functionPatches.Push(Object("NAME", "ForceClassSelection", "OFFSET", 0x0147C0, "PATCH", 0xC390))
  97. functionPatches.Push(Object("NAME", "AttachObjectToPlayer", "OFFSET", 0x018CE0, "PATCH", 0xC390))
  98. functionPatches.Push(Object("NAME", "InitMenu", "OFFSET", 0x018EA0, "PATCH", 0xC390))
  99. functionPatches.Push(Object("NAME", "ShowMenu", "OFFSET", 0x019160, "PATCH", 0xC390))
  100. functionPatches.Push(Object("NAME", "HideMenu", "OFFSET", 0x019210, "PATCH", 0xC390))
  101. functionPatches.Push(Object("NAME", "CreateExplosion", "OFFSET", 0x018350, "PATCH", 0xC390))
  102. functionPatches.Push(Object("NAME", "ShowPlayerNameTagForPlayer", "OFFSET", 0x018460, "PATCH", 0xC390))
  103. functionPatches.Push(Object("NAME", "AttachCameraToObject", "OFFSET", 0x016640, "PATCH", 0xC390))
  104. functionPatches.Push(Object("NAME", "InterpolateCamera", "OFFSET", 0x016740, "PATCH", 0xC390))
  105. functionPatches.Push(Object("NAME", "ClickTextDraw", "OFFSET", 0x019C20, "PATCH", 0xC390))
  106. functionPatches.Push(Object("NAME", "SetObjectMaterial", "OFFSET", 0x017CE0, "PATCH", 0xC390))
  107. functionPatches.Push(Object("NAME", "GangZoneStopFlash", "OFFSET", 0x0198E0, "PATCH", 0xC390))
  108. functionPatches.Push(Object("NAME", "ApplyAnimation", "OFFSET", 0x016FA0, "PATCH", 0xC390))
  109. functionPatches.Push(Object("NAME", "ClearAnimations", "OFFSET", 0x014C70, "PATCH", 0xC390))
  110. functionPatches.Push(Object("NAME", "SetPlayerSpecialAction", "OFFSET", 0x014D80, "PATCH", 0xC390))
  111. functionPatches.Push(Object("NAME", "SetPlayerFightingStyle", "OFFSET", 0x014E30, "PATCH", 0xC390))
  112. functionPatches.Push(Object("NAME", "SetPlayerVelocity", "OFFSET", 0x014F30, "PATCH", 0xC390))
  113. functionPatches.Push(Object("NAME", "SetVehicleVelocity", "OFFSET", 0x015030, "PATCH", 0xC390))
  114. functionPatches.Push(Object("NAME", "SetPlayerDrunkVisuals", "OFFSET", 0x015330, "PATCH", 0xC390))
  115. functionPatches.Push(Object("NAME", "ClientMessage", "OFFSET", 0x00C050, "PATCH", 0xC390))
  116. functionPatches.Push(Object("NAME", "SetWorldTime", "OFFSET", 0x00BFB0, "PATCH", 0xC390))
  117. functionPatches.Push(Object("NAME", "CreatePickup", "OFFSET", 0x00C140, "PATCH", 0xC390))
  118. functionPatches.Push(Object("NAME", "SCMEvent", "OFFSET", 0x00C340, "PATCH", 0xC390))
  119. functionPatches.Push(Object("NAME", "SetVehicleTireStatus", "OFFSET", 0x015250, "PATCH", 0xC390))
  120. functionPatches.Push(Object("NAME", "MoveObject", "OFFSET", 0x018540, "PATCH", 0xC390))
  121. functionPatches.Push(Object("NAME", "Chat", "OFFSET", 0x00EEA0, "PATCH", 0xC390))
  122. functionPatches.Push(Object("NAME", "SrvNetStats", "OFFSET", 0x00B7A0, "PATCH", 0xC390))
  123. functionPatches.Push(Object("NAME", "ClientCheck", "OFFSET", 0x00EAF0, "PATCH", 0xC390))
  124. functionPatches.Push(Object("NAME", "EnableStuntBonusForPlayer", "OFFSET", 0x014440, "PATCH", 0xC390))
  125. functionPatches.Push(Object("NAME", "TextDrawSetString", "OFFSET", 0x019540, "PATCH", 0xC390))
  126. functionPatches.Push(Object("NAME", "DamageVehicle", "OFFSET", 0x00E240, "PATCH", 0xC390))
  127. functionPatches.Push(Object("NAME", "SetCheckpoint", "OFFSET", 0x00D220, "PATCH", 0xC390))
  128. functionPatches.Push(Object("NAME", "GangZoneCreate", "OFFSET", 0x019650, "PATCH", 0xC390))
  129. functionPatches.Push(Object("NAME", "PlayCrimeReport", "OFFSET", 0x015720, "PATCH", 0xC390))
  130. functionPatches.Push(Object("NAME", "SetPlayerAttachedObject", "OFFSET", 0x0155E0, "PATCH", 0xC390))
  131. functionPatches.Push(Object("NAME", "EditAttachedObject", "OFFSET", 0x00E860, "PATCH", 0xC390))
  132. functionPatches.Push(Object("NAME", "EditObject", "OFFSET", 0x00E920, "PATCH", 0xC390))
  133. functionPatches.Push(Object("NAME", "GangZoneDestroy", "OFFSET", 0x019770, "PATCH", 0xC390))
  134. functionPatches.Push(Object("NAME", "GangZoneFlash", "OFFSET", 0x019820, "PATCH", 0xC390))
  135. functionPatches.Push(Object("NAME", "StopObject", "OFFSET", 0x0186F0, "PATCH", 0xC390))
  136. functionPatches.Push(Object("NAME", "SetNumberPlate", "OFFSET", 0x018870, "PATCH", 0xC390))
  137. functionPatches.Push(Object("NAME", "TogglePlayerSpectating", "OFFSET", 0x018990, "PATCH", 0xC390))
  138. functionPatches.Push(Object("NAME", "PlayerSpectatePlayer", "OFFSET", 0x018A40, "PATCH", 0xC390))
  139. functionPatches.Push(Object("NAME", "PlayerSpectateVehicle", "OFFSET", 0x018B20, "PATCH", 0xC390))
  140. functionPatches.Push(Object("NAME", "RequestClass", "OFFSET", 0x00D080, "PATCH", 0xC390))
  141. functionPatches.Push(Object("NAME", "RequestSpawn", "OFFSET", 0x00D150, "PATCH", 0xC390))
  142. functionPatches.Push(Object("NAME", "SetPlayerWantedLevel", "OFFSET", 0x0192C0, "PATCH", 0xC390))
  143. functionPatches.Push(Object("NAME", "ShowTextDraw", "OFFSET", 0x019360, "PATCH", 0xC390))
  144. functionPatches.Push(Object("NAME", "TextDrawHideForPlayer", "OFFSET", 0x019490, "PATCH", 0xC390))
  145. functionPatches.Push(Object("NAME", "ServerJoin", "OFFSET", 0x00CDA0, "PATCH", 0xC390))
  146. functionPatches.Push(Object("NAME", "ServerQuit", "OFFSET", 0x00CF20, "PATCH", 0xC390))
  147. functionPatches.Push(Object("NAME", "InitGame", "OFFSET", 0x00D710, "PATCH", 0xC390))
  148. functionPatches.Push(Object("NAME", "RemovePlayerMapIcon", "OFFSET", 0x016F00, "PATCH", 0xC390))
  149. functionPatches.Push(Object("NAME", "SetPlayerAmmo", "OFFSET", 0x017250, "PATCH", 0xC390))
  150. functionPatches.Push(Object("NAME", "SetPlayerGravity", "OFFSET", 0x017310, "PATCH", 0xC390))
  151. functionPatches.Push(Object("NAME", "SetVehicleHealth", "OFFSET", 0x0173B0, "PATCH", 0xC390))
  152. functionPatches.Push(Object("NAME", "AttachTrailerToVehicle", "OFFSET", 0x017490, "PATCH", 0xC390))
  153. functionPatches.Push(Object("NAME", "DetachTrailerFromVehicle", "OFFSET", 0x0175D0, "PATCH", 0xC390))
  154. functionPatches.Push(Object("NAME", "SetPlayerDrunkHandling", "OFFSET", 0x0153E0, "PATCH", 0xC390))
  155. functionPatches.Push(Object("NAME", "DestroyPickups", "OFFSET", 0x00C2A0, "PATCH", 0xC390))
  156. functionPatches.Push(Object("NAME", "SetWeather", "OFFSET", 0x00C430, "PATCH", 0xC390))
  157. functionPatches.Push(Object("NAME", "SetPlayerSkin", "OFFSET", 0x015860, "PATCH", 0xC390))
  158. functionPatches.Push(Object("NAME", "ExitVehicle", "OFFSET", 0x00E770, "PATCH", 0xC390))
  159. functionPatches.Push(Object("NAME", "UpdateScoresPingsIPs", "OFFSET", 0x00D490, "PATCH", 0xC390))
  160. functionPatches.Push(Object("NAME", "SetPlayerInterior", "OFFSET", 0x016050, "PATCH", 0xC390))
  161. functionPatches.Push(Object("NAME", "SetPlayerCameraPos", "OFFSET", 0x0160F0, "PATCH", 0xC390))
  162. functionPatches.Push(Object("NAME", "SetPlayerCameraLookAt", "OFFSET", 0x0161C0, "PATCH", 0xC390))
  163. functionPatches.Push(Object("NAME", "SetVehiclePos", "OFFSET", 0x0162C0, "PATCH", 0xC390))
  164. functionPatches.Push(Object("NAME", "SetVehicleZAngle", "OFFSET", 0x0163D0, "PATCH", 0xC390))
  165. functionPatches.Push(Object("NAME", "SetVehicleParamsForPlayer", "OFFSET", 0x0164B0, "PATCH", 0xC390))
  166. functionPatches.Push(Object("NAME", "SetCameraBehindPlayer", "OFFSET", 0x014770, "PATCH", 0xC390))
  167. functionPatches.Push(Object("NAME", "WorldPlayerRemove", "OFFSET", 0x00DEA0, "PATCH", 0xC390))
  168. functionPatches.Push(Object("NAME", "WorldVehicleAdd", "OFFSET", 0x00B850, "PATCH", 0xC390))
  169. functionPatches.Push(Object("NAME", "WorldVehicleRemove", "OFFSET", 0x00DF70, "PATCH", 0xC390))
  170. functionPatches.Push(Object("NAME", "WorldPlayerDeath", "OFFSET", 0x00DDE0, "PATCH", 0xC390))
  171.  
  172. // #############################  Standartadressen
  173.  
  174. CPed(matrix){
  175.     If(!SAMP())
  176.         return false
  177.  
  178.     If(!matrix)
  179.     return readDWORD(hGTA, ADDR_CPED_PTR)
  180.     else return Matrix(readDWORD(hGTA, ADDR_CPED_PTR))
  181. }
  182.  
  183. LocalPlayer(){
  184.     If(!SAMP())
  185.         return false
  186.     return readDWORD(hGTA, SAMP_pPool("Player") + OFFSET_CPED_LOCALPLAYER)
  187. }
  188.  
  189.  
  190. Vehicle(matrix){
  191.     If(!SAMP())
  192.         return false
  193.  
  194.     If(!matrix)
  195.         return readDWORD(hGTA, ADDR_VEHICLE_PTR)
  196.     else return Matrix(readDWORD(hGTA, ADDR_VEHICLE_PTR))
  197. }
  198.  
  199.  
  200. Matrix(pointer){
  201.     If(!SAMP())
  202.         return false
  203.  
  204.     return readDWORD(hGTA, pointer + OFFSET_MATRIX)
  205. }
  206.  
  207. InfoOffset(settings){
  208.     If(!SAMP())
  209.         return false
  210.  
  211.     If(!settings)
  212.     return readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)
  213.     else return readDWORD(hGTA, readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET) + SAMP_SETTINGS_OFFSET)
  214. }
  215.  
  216. SAMP_pPool(pool){
  217.     If(!SAMP())
  218.         return false
  219.     If(pool == "Player")
  220.         pool := SAMP_PPOOL_PLAYER_OFFSET
  221.     else if(pool == "Vehicle")
  222.         pool := SAMP_PPOOL_VEHICLE_OFFSET
  223.     else if(pool == "Pickup")
  224.         pool := SAMP_PPOOL_PICKUP_OFFSET
  225.     else if(pool == "Object")
  226.         pool := SAMP_PPOOL_OBJECT_OFFSET
  227.     return readDWORD(hGTA, readDWORD(hGTA, InfoOffset(0) + SAMP_PPOOLS_OFFSET) + pool)
  228. }
  229.  
  230.  
  231. setRaceCheckpoint(type, fX, fY, fZ, fnextX, fnextY, fnextZ, fSize ) {
  232.  
  233.     dwFunc := dwSAMP + 0x9D660
  234.  
  235.     dwAddress := readDWORD(hGTA, dwSAMP + ADDR_SAMP_INCHAT_PTR)
  236.  
  237.     if(ErrorLevel || dwAddress==0) {
  238.  
  239.         ErrorLevel := ERROR_READ_MEMORY
  240.  
  241.         return false
  242.  
  243.     }
  244.  
  245.     VarSetCapacity(buf, 28, 0)
  246.  
  247.     NumPut(fX, buf, 0, "Float")
  248.  
  249.     NumPut(fY, buf, 4, "Float")
  250.  
  251.     NumPut(fZ, buf, 8, "Float")
  252.  
  253.     NumPut(fnextX, buf, 12, "Float")
  254.  
  255.     NumPut(fnextY, buf, 16, "Float")
  256.  
  257.     NumPut(fnextZ, buf, 20, "Float")
  258.  
  259.     writeRaw(hGTA, pParam1, &buf, 24)
  260.  
  261.     dwLen := 41
  262.  
  263.     VarSetCapacity(injectData, dwLen, 0)
  264.  
  265.     NumPut(0xB9, injectData, 0, "UChar")
  266.  
  267.     NumPut(dwAddress, injectData, 1, "UInt")
  268.  
  269.     NumPut(0x68, injectData, 5, "UChar")
  270.  
  271.     NumPut(fSize, injectData, 6, "Float")
  272.  
  273.     NumPut(0x68, injectData, 10, "UChar")
  274.  
  275.     NumPut(pParam1+12, injectData, 11, "UInt")
  276.  
  277.     NumPut(0x68, injectData, 15, "UChar")
  278.  
  279.     NumPut(pParam1, injectData, 16, "UInt")
  280.  
  281.     NumPut(0x68, injectData, 20, "UChar")
  282.  
  283.     NumPut(type, injectData, 21, "Int")
  284.  
  285.     NumPut(0xE8, injectData, 25, "UChar")
  286.  
  287.     offset := dwFunc - (pInjectFunc + 30)
  288.  
  289.     NumPut(offset, injectData, 26, "Int")
  290.  
  291.     NumPut(0x05C7, injectData, 30, "UShort")
  292.  
  293.     NumPut(dwAddress+0x49, injectData, 32, "UInt")
  294.  
  295.     NumPut(1, injectData, 36, "UInt")
  296.  
  297.     NumPut(0xC3, injectData, 40, "UChar")
  298.  
  299.     writeRaw(hGTA, pInjectFunc, &injectData, dwLen)
  300.  
  301.     if(ErrorLevel)
  302.  
  303.         return false
  304.  
  305.     hThread := createRemoteThread(hGTA, 0, 0, pInjectFunc, 0, 0, 0)
  306.  
  307.     if(ErrorLevel)
  308.  
  309.         return false
  310.  
  311.     waitForSingleObject(hThread, 0xFFFFFFFF)
  312.  
  313.     closeProcess(hThread)
  314.  
  315.     ErrorLevel := ERROR_OK
  316.  
  317.     return true
  318.  
  319. }
  320.  
  321. disableRaceCheckpoint()
  322.  
  323. {
  324.  
  325.  
  326.     dwAddress := readDWORD(hGTA, dwSAMP + ADDR_SAMP_INCHAT_PTR)
  327.  
  328.     if(ErrorLevel || dwAddress==0) {
  329.  
  330.         ErrorLevel := ERROR_READ_MEMORY
  331.  
  332.         return false
  333.  
  334.     }
  335.  
  336.     VarSetCapacity(enablecp, 4, 0)
  337.  
  338.     NumPut(0,enablecp,0,"Int")
  339.  
  340.     writeRaw(hGTA, dwAddress+0x49, &enablecp, 4)
  341.  
  342.     ErrorLevel := ERROR_OK
  343.  
  344.     return true
  345.  
  346. }
  347.  
  348. // #############################  Positionen
  349.  
  350.  
  351. GetPositionByPed(ped){
  352.     If(!SAMP())
  353.         return false
  354.  
  355.     pMatrix := Matrix(ped)
  356.     return [readFloat(hGTA, pMatrix + OFFSET_POSX), readFloat(hGTA, pMatrix + OFFSET_POSY), readFloat(hGTA, pMatrix+ OFFSET_POSZ)]
  357. }
  358.  
  359.  
  360.  
  361.  
  362. // #############################  Player
  363.  
  364. GetPlayerHP(){
  365.     If(!SAMP())
  366.         return false
  367.  
  368.     return Round(readFloat(hGTA, mainCPED + OFFSET_CPED_HP))
  369. }
  370.  
  371. GetPlayerRotation(){
  372.     If(!SAMP())
  373.         return false
  374.  
  375.     return [readFloat(hGTA, mainMatrix + OFFSET_ROTATION_X), readFloat(hGTA, mainMatrix + OFFSET_ROTATION_Y)]
  376. }
  377.  
  378. GetPlayerTargetRotation(){
  379.     If(!SAMP())
  380.         return false
  381.  
  382.     return readFloat(hGTA, mainCPED + OFFSET_CPED_ZANGLE)
  383. }
  384.  
  385. GetLastVehiclePointer(){
  386.     If(!SAMP())
  387.         return false
  388.  
  389.     return readDWORD(hGTA, mainCPED + OFFSET_VEH_LASTVEH)
  390. }
  391.  
  392.  
  393. // #############################  VEHICLE
  394. GetPlayersInVehicle(){
  395.     If(!SAMP())
  396.         return false
  397.    
  398.     dw := Vehicle(0)
  399.     return [getIdByPed(readDWORD(hGTA, dw + 0x460)),getIdByPed(readDWORD(hGTA, dw + 0x464)),getIdByPed(readDWORD(hGTA, dw + 0x468)),getIdByPed(readDWORD(hGTA, dw + 0x46C))]
  400. }
  401.  
  402. IsCarLocked(){
  403.     If(!SAMP())
  404.         return false
  405.  
  406.     return (readDWORD(hGTA, Vehicle(0) + ADDR_VEHICLE_DOORSTATE) == 2)
  407. }
  408.  
  409. GetCarSpeed() {
  410.     If(!SAMP())
  411.         return false
  412.  
  413.     dwVeh := Vehicle(0)
  414.  
  415.     fSpeedX := readFloat(hGTA, dwVeh + OFFSET_VEH_SPEED_X)
  416.     fSpeedY := readFloat(hGTA, dwVeh + OFFSET_VEH_SPEED_Y)
  417.     fSpeedZ := readFloat(hGTA, dwVeh + OFFSET_VEH_SPEED_Y)
  418.  
  419.     return Round((SQRT((fSpeedX * fSpeedX) + (fSpeedY * fSpeedY) + (fSpeedZ * fSpeedZ)) *100) *1.61)
  420.  
  421. }
  422.  
  423.  
  424. // #############################  SAMP
  425.  
  426.  
  427. GetUsername() {
  428.     If(!SAMP())
  429.         return false
  430.  
  431.     return readString(hGTA, dwSAMP + ADDR_SAMP_USERNAME, 25)
  432. }
  433.  
  434. getPlayerColor(playerid){
  435.     if(!SAMP())
  436.         return false
  437.  
  438.     idColor := readDWORD(hGTA, dwSAMP + SAMP_COLOR_OFFSET + 4 * playerid)
  439.     hex := IntToHex(idColor)
  440.     rgbhex := SubStr(IntToHex(idColor), 3, 6)
  441.         return rgbhex
  442. }
  443.  
  444. AntiCrash(){
  445.     If(!SAMP())
  446.         return false
  447.  
  448.     cReport := ADDR_SAMP_CRASHREPORT
  449.     writeMemory(hGTA, dwSAMP + cReport, 0x90909090, 4)
  450.     cReport += 0x4
  451.     writeMemory(hGTA, dwSAMP + cReport, 0x90, 1)
  452.     cReport += 0x9
  453.     writeMemory(hGTA, dwSAMP + cReport, 0x90909090, 4)
  454.     cReport += 0x4
  455.     writeMemory(hGTA, dwSAMP + cReport, 0x90, 1)
  456. }
  457.  
  458.  
  459. // #############################  HUD
  460.  
  461. SetHudEnabled(toggle){
  462.     If(!SAMP())
  463.         return false
  464.  
  465.     writeMemory(hGTA, 0xA444A0, toggle, 1, "UChar")
  466. }
  467.  
  468. // ############################# Interface
  469.  
  470.  
  471. ChangeInterfaceColor(id, color){
  472.     If(!SAMP())
  473.         return false
  474.  
  475.     dwAddr := 0xBAB22C
  476.     dw := 4 * id, dwAddr += dw
  477.     writeMemory(hGTA, dwAddr, 0xFFFFFFFF, 4, "Int")
  478. }
  479.  
  480. SetPercentageHealthAndArmor(toggle){
  481.     If(!SAMP())
  482.         return false
  483.  
  484.     writeMemory(hGTA, 0x589355, toggle, 1, "UChar")
  485.     writeMemory(hGTA, 0x589131, toggle, 1, "UChar")
  486. }
  487.  
  488. // #############################  POOLS
  489.  
  490. UpdateTextdrawPool(){
  491.     global
  492.  
  493.     if(!SAMP())
  494.         return 0
  495.  
  496.     strData := []
  497.  
  498.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)
  499.     dwAddress := readDWORD(hGTA, dwAddress + SAMP_PPOOLS_OFFSET)
  500.     dwTextDraws := readDWORD(hGTA, dwAddress + 0x10)
  501.  
  502.     Loop, % SAMP_MAX_TEXTDRAWS
  503.     {
  504.         i := A_Index-1
  505.         iIsListed := readDWORD(hGTA, dwTextDraws + i * 0x4)
  506.         If(iIsListed == 0)
  507.             continue
  508.         dwAddr := readDWORD(hGTA, dwTextDraws + 0x2400 + i * 0x4)
  509.         If(dwAddr == 0)
  510.             continue
  511.  
  512.         strOUT := readString(hGTA, dwAddr, 256) // strOUT size
  513.         if(strOUT == 0)
  514.             continue
  515.  
  516.         strData[i] := strOUT
  517.     }
  518. }
  519.  
  520. CountStreamedVehicles(){
  521.     If(!SAMP())
  522.         return false
  523.  
  524.     iCount := 0
  525.     for i, o in oVehiclePoolData
  526.     iCount++
  527.         return iCount
  528. }
  529.  
  530. CountTextraws(){
  531.     If(!SAMP())
  532.         return false
  533.  
  534.     if(!UpdateTextdrawPool())
  535.         return -1
  536.  
  537.     iCount := 0
  538.     for i, o in strData
  539.     iCount++
  540.         return iCount
  541. }
  542.  
  543.  
  544. // #############################  Streamed Players
  545.  
  546. getPedById(dwId) {
  547.     dwId += 0
  548.     dwId := Floor(dwId)
  549.     if(dwId < 0 || dwId >= SAMP_PLAYER_MAX)
  550.         return 0
  551.  
  552.     if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  553.     {
  554.         if(oScoreboardData[dwId])
  555.         {
  556.             if(oScoreboardData[dwId].HasKey("PED"))
  557.                 return oScoreboardData[dwId].PED
  558.         }
  559.         return 0
  560.     }
  561.  
  562.     if(oScoreboardData[dwId])
  563.     {
  564.         if(oScoreboardData[dwId].HasKey("PED"))
  565.             return oScoreboardData[dwId].PED
  566.     }
  567.     return 0
  568. }
  569.  
  570. getIdByPed(dwPed) {
  571.     dwPed += 0
  572.     dwPed := Floor(dwPed)
  573.     if(!dwPed)
  574.         return -1
  575.    
  576.     if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  577.     {
  578.         For i, o in oScoreboardData
  579.         {
  580.             if(o.HasKey("PED"))
  581.             {
  582.                 if(o.PED==dwPed)
  583.                     return i
  584.             }
  585.         }
  586.         return -1
  587.     }
  588.    
  589.     For i, o in oScoreboardData
  590.     {
  591.         if(o.HasKey("PED"))
  592.         {
  593.             if(o.PED==dwPed)
  594.                 return i
  595.         }
  596.     }
  597.     return -1
  598. }
  599.  
  600. getPlayerScoreById(dwId) {
  601.     dwId += 0
  602.     dwId := Floor(dwId)
  603.     if(dwId < 0 || dwId >= SAMP_PLAYER_MAX)
  604.         return ""
  605.    
  606.     if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  607.     {
  608.         if(oScoreboardData[dwId])
  609.             return oScoreboardData[dwId].SCORE
  610.         return ""
  611.     }
  612.    
  613.     if(oScoreboardData[dwId])
  614.         return oScoreboardData[dwId].SCORE
  615.     return ""
  616. }
  617.  
  618. getPlayerPingById(dwId) {
  619.     dwId += 0
  620.     dwId := Floor(dwId)
  621.     if(dwId < 0 || dwId >= SAMP_PLAYER_MAX)
  622.         return -1
  623.        
  624.     if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  625.     {
  626.         if(oScoreboardData[dwId])
  627.             return oScoreboardData[dwId].PING
  628.         return -1
  629.     }
  630.    
  631.     if(oScoreboardData[dwId])
  632.         return oScoreboardData[dwId].PING
  633.     return -1
  634. }
  635.  
  636. isNPCById(dwId) {
  637.     dwId += 0
  638.     dwId := Floor(dwId)
  639.     if(dwId < 0 || dwId >= SAMP_PLAYER_MAX)
  640.         return -1
  641.    
  642.     if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  643.     {
  644.         if(oScoreboardData[dwId])
  645.             return oScoreboardData[dwId].ISNPC
  646.         return -1
  647.     }
  648.    
  649.     if(oScoreboardData[dwId])
  650.         return oScoreboardData[dwId].ISNPC
  651.     return -1
  652. }
  653.  
  654.  
  655. // #############################  Cheat Funktionen
  656.  
  657. StableVehicleCam()
  658. {
  659.     If(IsPlayerInAnyVehicle() && WinActive("GTA:SA:MP"))
  660.     {
  661.         DllCall("mouse_event", uint,1, int,1, int,0, uint,0, int,0)
  662.         sleep, 3
  663.         DllCall("mouse_event", uint,1, int,-1, int,0, uint,0, int,0)
  664.     }
  665. }
  666.  
  667. UnlockFPS(){
  668.     If(!SAMP())
  669.         return false
  670.  
  671.     writeMemory(hGTA, dwSAMP + ADDR_SAMP_FPSUNLOCK, 0x5051FF15, 4, "UChar")
  672. }
  673.  
  674. // #############################  Weapon
  675.  
  676.  
  677. GetTargetPed(){
  678.     If(!SAMP())
  679.         return false
  680.  
  681.     return readDWORD(hGTA, readDWORD(hGTA, ADDR_WEAPON_TARGET) + OFFSET_CPED_OTARGET)
  682. }
  683.  
  684. // #############################  Camera
  685.  
  686. GetCameraPosition(writeable=0){
  687.     If(!SAMP())
  688.         return false
  689.  
  690.     If(!writeable)
  691.     return [readFloat(hGTA, ADDR_CAMERA_POS_X), readFloat(hGTA, ADDR_CAMERA_POS_Y)]
  692.     else return readFloat(hGTA, ADDR_CAMERA_CURR_X)
  693. }
  694.  
  695. GetCameraRotation(){
  696.     If(!SAMP())
  697.         return false
  698.  
  699.     return readFloat(hGTA, ADDR_CAMERA_ROTATION)
  700. }
  701.  
  702.  
  703. GetCameraXAngle(){
  704.     If(!SAMP())
  705.         return false
  706.  
  707.     angle := 0
  708.     angle := 360 + atan2(readFloat(hGTA, ADDR_CAMERA_ANGLE_X), readFloat(hGTA, ADDR_CAMERA_ANGLE_Y) *180/PI)
  709.  
  710.     If(angle > 360.0)
  711.         angle -= 360.0
  712.  
  713.     return angle
  714.  
  715. }
  716.  
  717. GetCameraZAngle(){
  718.     If(!SAMP())
  719.         return false
  720.  
  721.     val := readFloat(hGTA, 0x00B6F248)
  722.     if(val > -1.2 & val < 1.2)
  723.     return val
  724. }
  725.  
  726. // #############################  Math
  727.  
  728. IntToHex(int){
  729.     CurrentFormat := A_FormatInteger
  730.     SetFormat, integer, hex
  731.     int += 0
  732.     SetFormat, integer, %CurrentFormat%
  733.     return int
  734. }
  735.  
  736. getDist(pos1,pos2) {
  737.     if(!pos1 || !pos2)
  738.         return 0
  739.     return Sqrt((pos1[1]-pos2[1])*(pos1[1]-pos2[1])+(pos1[2]-pos2[2])*(pos1[2]-pos2[2])+(pos1[3]-pos2[3])*(pos1[3]-pos2[3]))
  740. }
  741.  
  742. atan2(x, y) {
  743.    Return dllcall("msvcrt\atan2","Double",y, "Double",x, "CDECL Double")
  744. }
  745.  
  746.  
  747. tobin(byref addr, str)
  748. {
  749.     if(!RegExMatch(str,"^([a-fA-F0-9][a-fA-F0-9])*$"))
  750.     {
  751.         msgbox % "fail tobin"
  752.         return
  753.     }
  754.     i:=Strlen(str)/2
  755.     VarSetCapacity(addr, i)
  756.     dataddr := &addr
  757.     x:=""
  758.     loop,parse,str
  759.     {
  760.         if(A_Index & 1)
  761.             x := A_Loopfield
  762.         else
  763.         {
  764.             DllCall("RtlFillMemory"
  765.                         , "UInt", dataddr
  766.                         , "UInt", 1
  767.                         , "UChar", "0x" x A_Loopfield)
  768.             dataddr++
  769.         }
  770.     }
  771. }
  772.  
  773. getVehicleSpeed2() {
  774. if(!checkHandles())
  775. return -1
  776. dwAddr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  777. if(ErrorLevel) {
  778. ErrorLevel := ERROR_READ_MEMORY
  779. return ""
  780. }
  781. fSpeedX := readMem(hGTA, dwAddr + ADDR_VEHICLE_X, 4, "float")
  782. fSpeedY := readMem(hGTA, dwAddr + ADDR_VEHICLE_Y, 4, "float")
  783. fSpeedZ := readMem(hGTA, dwAddr + ADDR_VEHICLE_Z, 4, "float")
  784. fVehicleSpeed :=  sqrt((fSpeedX * fSpeedX) + (fSpeedY * fSpeedY) + (fSpeedZ * fSpeedZ))
  785. fVehicleSpeed := (fVehicleSpeed * 100) * 1.43
  786. return fVehicleSpeed
  787. }
  788.  
  789. stringMath(string) {
  790.     while(position := RegExMatch(string, "\(([^\(\)]+)\)", regex_)) {
  791.         string := RegExReplace(string, "\(([^\(\)]+)\)", stringMath(regex_1), blahblah, 1, position)
  792.     }
  793.    
  794.     while(position := RegExMatch(string, "(\+|-)? *((?:\+|-)?\d+)\^((?:\+|-)?\d+)", regex_)) {
  795.         string := RegExReplace(string, "(\+|-)? *((?:\+|-)?\d+)\^((?:\+|-)?\d+)", regex_1 . regex_2**regex_3, blahblah, 1, position)
  796.     }
  797.     while(position := RegExMatch(string, "(\+|-)? *((?:\+|-)?\d+(?:[\.\,]\d+)?) *(\*|/) *((?:\+|-)?\d+(?:[\.\,]\d+)?) *", regex_)) {
  798.         if(regex_3 == "*")
  799.             string := RegExReplace(string, "(\+|-)? *((?:\+|-)?\d+(?:[\.\,]\d+)?) *\* *((?:\+|-)?\d+(?:[\.\,]\d+)?) *", regex_1 . regex_2*regex_4, blahblah, 1, position)
  800.         if(regex_3 == "/")
  801.             string := RegExReplace(string, "(\+|-)? *((?:\+|-)?\d+(?:[\.\,]\d+)?) */ *((?:\+||)?\d+(?:[\.\,]\d+)?) *", regex_1 . regex_2/regex_4, blahblah, 1, position)
  802.     }
  803.     while(position := RegExMatch(string, " *((?:\+|-)?\d+(?:[\.\,]\d+)?) *(\+|-) *((?:\+|-)?\d+(?:[\.\,]\d+)?) *", regex_)) {
  804.         if(regex_2 == "+")
  805.             string := RegExReplace(string, " *((?:\+|-)?\d+(?:[\.\,]\d+)?) *\+ *((?:\+|-)?\d+(?:[\.\,]\d+)?) *", regex_1+regex_3, blahblah, 1, position)
  806.         if(regex_2 == "-")
  807.             string := RegExReplace(string, " *((?:\+|-)?\d+(?:[\.\,]\d+)?) *- *((?:\+|-)?\d+(?:[\.\,]\d+)?) *", regex_1-regex_3, blahblah, 1, position)
  808.     }
  809.    
  810.     if(RegExMatch(string, "^-?\d+(?:\.\d+)?$"))
  811.         return string
  812.    
  813.     return "ERROR"
  814. }
  815.  
  816. PlayerInput(text){
  817.         s := A_IsSuspended
  818.         Suspend On
  819.         KeyWait Enter
  820.         BlockChatInput(block)
  821.         SendInput t^a{backspace}%text%
  822.         Input, var, v, {enter}
  823.         SendInput ^a{backspace 100}{enter}
  824.         Sleep, 20
  825.         BlockChatInput(unblock)
  826.         if(!s)
  827.         Suspend Off
  828.         return var
  829. }
  830.  
  831. getWeaponName(id) {
  832.     weapons := {0: "Faust", 1: "Schlagring", 2: "Golfschläger", 3: "Schlagstock", 4: "Messer", 5: "Baseball Schläger", 6: "Schaufel", 7: "Billiardstick", 8: "Katana", 9: "Kettensäge", 10: "Lila Dildo", 11: "Dildo", 12: "Vibrator", 13: "Silber Vibrator", 14: "Blumen", 15: "Kanne", 16: "Granate", 17: "Tränen Gas", 18: "Molotov Cocktail", 22: "9mm", 23: "Silenced 9mm", 24: "Desert Eagle", 25: "Shotgun", 26: "Sawnoff Shotgun", 27: "Combat Shotgun", 28: "Micro SMG", 29: "MP5", 30: "AK-47", 31: "M4", 32: "Tec-9", 33: "Country Rifle", 34: "Sniper", 35: "RPG", 36: "HS Rocket", 37: "Flammenwerfer", 38: "Minigun", 39: "Satchel Charge", 40: "Zünder", 41: "Sprühdose", 42: "Feuerlöscher", 43: "Kamera", 44: "Nachtsichtgerät", 45: "Thermal Brille", 46: "Fallschirm", 47: "Fake Pistole", 49: "Fahrzeug", 50: "Helikopter", 51: "Explosion", 53: "Drowned", 54: "Splat", 255: "Suicide"}
  833.     if(weapons[id]) {
  834.         return weapons[id]
  835.     }
  836.     return "Unbekannt"
  837. }
  838.  
  839. getPlayerColorById(playerid){
  840.     if(!checkHandles())
  841.         return false
  842.     idColor := readDWORD(hGTA, dwSAMP + SAMP_COLOR_OFFSET + 4 * playerid)
  843.     rgbhex := SubStr(IntToHex(idColor), 3, 6)
  844.     StringUpper, playercolor, rgbhex
  845.         return playercolor
  846. }
  847.  
  848. SendClearMessage(anzahl)
  849. {
  850.     loop, %anzahl%
  851.     {
  852.         AddChatMessage(" ")
  853.     }
  854. }
  855.  
  856. getKilledPlayers(bReset := false) {
  857.     if (!checkHandles() || !updateOScoreboardData())
  858.         return -1
  859.     kills := []
  860.     for i, o in oScoreboardData {
  861.         if (!o.PED || o.HP > 0 || o.ISNPC)
  862.             continue
  863.         dwMurderer := readDWORD(hGTA, o.PED + 0x764)
  864.         if (!dwMurderer)
  865.             continue
  866.         dwLocalPED := readDWORD(hGTA, ADDR_CPED_PTR)
  867.         if (dwLocalPED != dwMurderer)
  868.             continue
  869.         weapon := readMem(hGTA, o.PED + 0x760, 4, "UInt")
  870.        
  871.         if (bReset)
  872.             writeMemory(hGTA, o.PED + 0x764, 0, "UInt", 4)
  873.         kills.Push(Object("ID", o.ID, "WEAPON", weapon))
  874.     }
  875.     return kills
  876. }
  877.  
  878. updateScoreboardDataEx() {
  879.    
  880.     if(!checkHandles())
  881.         return false
  882.    
  883.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)            //g_SAMP
  884.     if(ErrorLevel || dwAddress==0) {
  885.         ErrorLevel := ERROR_READ_MEMORY
  886.         return false
  887.     }
  888.    
  889.     dwFunc := dwSAMP + FUNC_UPDATESCOREBOARD
  890.    
  891.     VarSetCapacity(injectData, 11, 0) //mov + call + retn
  892.    
  893.     NumPut(0xB9, injectData, 0, "UChar")
  894.     NumPut(dwAddress, injectData, 1, "UInt")
  895.    
  896.     NumPut(0xE8, injectData, 5, "UChar")
  897.     offset := dwFunc - (pInjectFunc + 10)
  898.     NumPut(offset, injectData, 6, "Int")
  899.     NumPut(0xC3, injectData, 10, "UChar")
  900.    
  901.     writeRaw(hGTA, pInjectFunc, &injectData, 11)
  902.     if(ErrorLevel)
  903.         return false
  904.    
  905.     hThread := createRemoteThread(hGTA, 0, 0, pInjectFunc, 0, 0, 0)
  906.     if(ErrorLevel)
  907.         return false
  908.    
  909.     waitForSingleObject(hThread, 0xFFFFFFFF)
  910.    
  911.     closeProcess(hThread)
  912.    
  913.     return true
  914.    
  915. }
  916.  
  917. updateOScoreboardData() {
  918.     if(!checkHandles())
  919.         return 0
  920.    
  921.     oScoreboardData := []
  922.    
  923.     if(!updateScoreboardDataEx())
  924.         return 0
  925.    
  926.     iRefreshScoreboard := A_TickCount
  927.    
  928.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)
  929.     if(ErrorLevel || dwAddress==0) {
  930.         ErrorLevel := ERROR_READ_MEMORY
  931.         return 0
  932.     }
  933.    
  934.     dwAddress := readDWORD(hGTA, dwAddress + SAMP_PPOOLS_OFFSET)
  935.     if(ErrorLevel || dwAddress==0) {
  936.         ErrorLevel := ERROR_READ_MEMORY
  937.         return 0
  938.     }
  939.    
  940.     dwPlayers := readDWORD(hGTA, dwAddress + SAMP_PPOOL_PLAYER_OFFSET)
  941.     if(ErrorLevel || dwPlayers==0) {
  942.         ErrorLevel := ERROR_READ_MEMORY
  943.         return 0
  944.     }
  945.    
  946.     wID := readMem(hGTA, dwPlayers + SAMP_SLOCALPLAYERID_OFFSET, 2, "Short")    //sLocalPlayerID
  947.     if(ErrorLevel) {
  948.         ErrorLevel := ERROR_READ_MEMORY
  949.         return 0
  950.     }
  951.    
  952.     dwPing := readMem(hGTA, dwPlayers + SAMP_ILOCALPLAYERPING_OFFSET, 4, "Int")
  953.     if(ErrorLevel) {
  954.         ErrorLevel := ERROR_READ_MEMORY
  955.         return 0
  956.     }
  957.    
  958.     dwScore := readMem(hGTA, dwPlayers + SAMP_ILOCALPLAYERSCORE_OFFSET, 4, "Int")
  959.     if(ErrorLevel) {
  960.         ErrorLevel := ERROR_READ_MEMORY
  961.         return 0
  962.     }
  963.    
  964.     dwTemp := readMem(hGTA, dwPlayers + SAMP_ISTRLEN_LOCALPLAYERNAME_OFFSET, 4, "Int")    //iStrlen_LocalPlayerName
  965.     if(ErrorLevel) {
  966.         ErrorLevel := ERROR_READ_MEMORY
  967.         return 0
  968.     }
  969.    
  970.     sUsername := ""
  971.     if(dwTemp <= 0xf) {
  972.         sUsername := readString(hGTA, dwPlayers + SAMP_SZLOCALPLAYERNAME_OFFSET, 16)       //szLocalPlayerName
  973.         if(ErrorLevel) {
  974.             ErrorLevel := ERROR_READ_MEMORY
  975.             return 0
  976.         }
  977.     }
  978.     else {
  979.         dwAddress := readDWORD(hGTA, dwPlayers + SAMP_PSZLOCALPLAYERNAME_OFFSET)        //pszLocalPlayerName
  980.         if(ErrorLevel) {
  981.             ErrorLevel := ERROR_READ_MEMORY
  982.             return 0
  983.         }
  984.         sUsername := readString(hGTA, dwAddress, 25)
  985.         if(ErrorLevel) {
  986.             ErrorLevel := ERROR_READ_MEMORY
  987.             return 0
  988.         }
  989.     }
  990.     oScoreboardData[wID] := Object("NAME", sUsername, "ID", wID, "PING", dwPing, "SCORE", dwScore, "ISNPC", 0)
  991.    
  992.     Loop, % SAMP_PLAYER_MAX
  993.     {
  994.         i := A_Index-1
  995.        
  996.         dwRemoteplayer := readDWORD(hGTA, dwPlayers+SAMP_PREMOTEPLAYER_OFFSET+i*4)      //pRemotePlayer
  997.         if(ErrorLevel) {
  998.             ErrorLevel := ERROR_READ_MEMORY
  999.             return 0
  1000.         }
  1001.        
  1002.         if(dwRemoteplayer==0)
  1003.             continue
  1004.        
  1005.         dwPing := readMem(hGTA, dwRemoteplayer + SAMP_IPING_OFFSET, 4, "Int")
  1006.         if(ErrorLevel) {
  1007.             ErrorLevel := ERROR_READ_MEMORY
  1008.             return 0
  1009.         }
  1010.        
  1011.         dwScore := readMem(hGTA, dwRemoteplayer + SAMP_ISCORE_OFFSET, 4, "Int")
  1012.         if(ErrorLevel) {
  1013.             ErrorLevel := ERROR_READ_MEMORY
  1014.             return 0
  1015.         }
  1016.        
  1017.         dwIsNPC := readMem(hGTA, dwRemoteplayer + SAMP_ISNPC_OFFSET, 4, "Int")
  1018.         if(ErrorLevel) {
  1019.             ErrorLevel := ERROR_READ_MEMORY
  1020.             return 0
  1021.         }
  1022.        
  1023.         dwTemp := readMem(hGTA, dwRemoteplayer + SAMP_ISTRLENNAME___OFFSET, 4, "Int")
  1024.         if(ErrorLevel) {
  1025.             ErrorLevel := ERROR_READ_MEMORY
  1026.             return 0
  1027.         }
  1028.         sUsername := ""
  1029.         if(dwTemp <= 0xf)
  1030.         {
  1031.             sUsername := readString(hGTA, dwRemoteplayer+SAMP_SZPLAYERNAME_OFFSET, 16)
  1032.             if(ErrorLevel) {
  1033.                 ErrorLevel := ERROR_READ_MEMORY
  1034.                 return 0
  1035.             }
  1036.         }
  1037.         else {
  1038.             dwAddress := readDWORD(hGTA, dwRemoteplayer + SAMP_PSZPLAYERNAME_OFFSET)
  1039.             if(ErrorLevel || dwAddress==0) {
  1040.                 ErrorLevel := ERROR_READ_MEMORY
  1041.                 return 0
  1042.             }
  1043.             sUsername := readString(hGTA, dwAddress, 25)
  1044.             if(ErrorLevel) {
  1045.                 ErrorLevel := ERROR_READ_MEMORY
  1046.                 return 0
  1047.             }
  1048.         }
  1049.         o := Object("NAME", sUsername, "ID", i, "PING", dwPing, "SCORE", dwScore, "ISNPC", dwIsNPC)
  1050.         oScoreboardData[i] := o
  1051.        
  1052.         dwRemoteplayerData := readDWORD(hGTA, dwRemoteplayer + 0x0)                //pPlayerData
  1053.         if(ErrorLevel) {
  1054.             ErrorLevel := ERROR_READ_MEMORY
  1055.             return 0
  1056.         }
  1057.         if(dwRemoteplayerData==0)       //this ever happen?
  1058.             continue
  1059.        
  1060.         dwAddress := readDWORD(hGTA, dwRemoteplayerData + 489)        //iGlobalMarkerLoaded
  1061.         if(ErrorLevel) {
  1062.             ErrorLevel := ERROR_READ_MEMORY
  1063.             return 0
  1064.         }
  1065.         if(dwAddress)
  1066.         {
  1067.             ix := readMem(hGTA, dwRemoteplayerData + 493, 4, "Int")        //x map
  1068.             if(ErrorLevel) {
  1069.                 ErrorLevel := ERROR_READ_MEMORY
  1070.                 return 0
  1071.             }
  1072.             iy := readMem(hGTA, dwRemoteplayerData + 497, 4, "Int")        //y map
  1073.             if(ErrorLevel) {
  1074.                 ErrorLevel := ERROR_READ_MEMORY
  1075.                 return 0
  1076.             }
  1077.             iz := readMem(hGTA, dwRemoteplayerData + 501, 4, "Int")        //z map
  1078.             if(ErrorLevel) {
  1079.                 ErrorLevel := ERROR_READ_MEMORY
  1080.                 return 0
  1081.             }
  1082.             o.MPOS := [ix, iy, iz]
  1083.         }
  1084.        
  1085.         dwpSAMP_Actor := readDWORD(hGTA, dwRemoteplayerData + 0x0)                //pSAMP_Actor
  1086.         if(ErrorLevel) {
  1087.             ErrorLevel := ERROR_READ_MEMORY
  1088.             return 0
  1089.         }
  1090.         if(dwpSAMP_Actor==0)               //not streamed in
  1091.             continue
  1092.  
  1093.         dwPed := readDWORD(hGTA, dwpSAMP_Actor + 676)                //pGTA_Ped_
  1094.         if(ErrorLevel) {
  1095.             ErrorLevel := ERROR_READ_MEMORY
  1096.             return 0
  1097.         }
  1098.         if(dwPed==0)
  1099.             continue
  1100.         o.PED := dwPed
  1101.        
  1102.         fHP := readFloat(hGTA, dwRemoteplayerData + 444)
  1103.         if(ErrorLevel) {
  1104.             ErrorLevel := ERROR_READ_MEMORY
  1105.             return 0
  1106.         }
  1107.        
  1108.         nametag_shown := readDWORD(hGTA, dwRemotePlayerData + 179)
  1109.         if(ErrorLevel) {
  1110.             ErrorLevel := ERROR_READ_MEMORY
  1111.             return 0
  1112.         }
  1113.        
  1114.         fARMOR := readFloat(hGTA, dwRemoteplayerData + 440)
  1115.         if(ErrorLevel) {
  1116.             ErrorLevel := ERROR_READ_MEMORY
  1117.             return 0
  1118.         }
  1119.         o.HP := fHP
  1120.         o.ARMOR := fARMOR
  1121.     }
  1122.     ErrorLevel := ERROR_OK
  1123.     return 1
  1124. }
  1125.  
  1126. blockDialog() {
  1127.     if (!checkHandles()) {
  1128.         ErrorLevel := ERROR_INVALID_HANDLE
  1129.         return false
  1130.     }
  1131.     VarSetCapacity(injectBytecode, 7, 0)
  1132.     Loop, 7 {
  1133.         NumPut(0x90, injectBytecode, A_Index - 1, "UChar")
  1134.     }
  1135.     return writeRaw(hGTA, dwSAMP + 0x6C014, &injectBytecode, 7)
  1136. }
  1137.  
  1138. unblockDialog() {
  1139.     if (!checkHandles()) {
  1140.         ErrorLevel := ERROR_INVALID_HANDLE
  1141.         return false
  1142.     }
  1143.     bytecodes := [0xC7, 0x46, 0x28, 0x1, 0x0, 0x0, 0x0]
  1144.     VarSetCapacity(injectBytecode, 7, 0)
  1145.     for i, o in bytecodes
  1146.         NumPut(o, injectBytecode, i - 1, "UChar")
  1147.     return writeRaw(hGTA, dwSAMP + 0x6C014, &injectBytecode, 7)
  1148. }
  1149.  
  1150. getDialogStructPtr() {
  1151.     if (!checkHandles()) {
  1152.         ErrorLevel := ERROR_INVALID_HANDLE
  1153.         return false
  1154.     }
  1155.  
  1156.     dwPointer := readDWORD(hGTA, dwSAMP + SAMP_DIALOG_STRUCT_PTR)
  1157.     if (ErrorLevel) {
  1158.         ErrorLevel := ERROR_READ_MEMORY
  1159.         return false
  1160.     }
  1161.  
  1162.     ErrorLevel := ERROR_OK
  1163.     return dwPointer
  1164. }
  1165.  
  1166. getDialogStyle() {
  1167.     dwPointer := getDialogStructPtr()
  1168.     if (ErrorLevel || !dwPointer)
  1169.         return -1
  1170.  
  1171.     style := readMem(hGTA, dwPointer + SAMP_DIALOG_STYLE_OFFSET, 4, "UInt")
  1172.     if (ErrorLevel) {
  1173.         ErrorLevel := ERROR_READ_MEMORY
  1174.         return -1
  1175.     }
  1176.  
  1177.     ErrorLevel := ERROR_OK
  1178.     return style
  1179. }
  1180.  
  1181. getDialogID() {
  1182.     dwPointer := getDialogStructPtr()
  1183.     if (ErrorLevel || !dwPointer)
  1184.         return -1
  1185.  
  1186.     id := readMem(hGTA, dwPointer + SAMP_DIALOG_ID_OFFSET, 4, "UInt")
  1187.     if (ErrorLevel) {
  1188.         ErrorLevel := ERROR_READ_MEMORY
  1189.         return -1
  1190.     }
  1191.  
  1192.     ErrorLevel := ERROR_OK
  1193.     return id
  1194. }
  1195.  
  1196. setDialogID(id) {
  1197.     dwPointer := getDialogStructPtr()
  1198.     if (ErrorLevel || !dwPointer)
  1199.         return false
  1200.  
  1201.     writeMemory(hGTA, dwPointer + SAMP_DIALOG_ID_OFFSET, id, "UInt", 4)
  1202.     if (ErrorLevel) {
  1203.         ErrorLevel := ERROR_WRITE_MEMORY
  1204.         return false
  1205.     }
  1206.  
  1207.     ErrorLevel := ERROR_OK
  1208.     return true
  1209. }
  1210.  
  1211. getDialogIndex() {
  1212.     dwPointer := getDialogStructPtr()
  1213.     if (ErrorLevel || !dwPointer)
  1214.         return 0
  1215.  
  1216.     dwPointer := readDWORD(hGTA, dwPointer + SAMP_DIALOG_PTR1_OFFSET)
  1217.     if (ErrorLevel) {
  1218.         ErrorLevel := ERROR_READ_MEMORY
  1219.         return 0
  1220.     }
  1221.  
  1222.     index := readMem(hGTA, dwPointer + SAMP_DIALOG_INDEX_OFFSET, 1, "Byte")
  1223.     if (ErrorLevel) {
  1224.         ErrorLevel := ERROR_READ_MEMORY
  1225.         return 0
  1226.     }
  1227.  
  1228.     ErrorLevel := ERROR_OK
  1229.     return index + 1
  1230. }
  1231.  
  1232. getDialogCaption() {
  1233.     dwPointer := getDialogStructPtr()
  1234.     if (ErrorLevel || !dwPointer)
  1235.         return ""
  1236.  
  1237.     text := readString(hGTA, dwPointer + SAMP_DIALOG_CAPTION_OFFSET, 64)
  1238.     if (ErrorLevel) {
  1239.         ErrorLevel := ERROR_READ_MEMORY
  1240.         return ""
  1241.     }
  1242.  
  1243.     ErrorLevel := ERROR_OK
  1244.     return text
  1245. }
  1246.  
  1247. getDialogTextSize(dwAddress) {
  1248.     i := 0
  1249.     Loop, 4096 {
  1250.         i := A_Index - 1
  1251.         byte := Memory_ReadByte(hGTA, dwAddress + i)
  1252.         if (!byte)
  1253.             break
  1254.     }
  1255.  
  1256.     return i
  1257. }
  1258.  
  1259. getDialogText() {
  1260.     dwPointer := getDialogStructPtr()
  1261.     if (ErrorLevel || !dwPointer)
  1262.         return ""
  1263.  
  1264.     dwPointer := readDWORD(hGTA, dwPointer + SAMP_DIALOG_TEXT_PTR_OFFSET)
  1265.     if (ErrorLevel) {
  1266.         ErrorLevel := ERROR_READ_MEMORY
  1267.         return ""
  1268.     }
  1269.  
  1270.     text := readString(hGTA, dwPointer, 4096)
  1271.     if (ErrorLevel) {
  1272.         text := readString(hGTA, dwPointer, getDialogTextSize(dwPointer))
  1273.         if (ErrorLevel) {
  1274.             ErrorLevel := ERROR_READ_MEMORY
  1275.             return ""
  1276.         }
  1277.     }
  1278.  
  1279.     ErrorLevel := ERROR_OK
  1280.     return text
  1281. }
  1282.  
  1283. getDialogLineCount() {
  1284.     dwPointer := getDialogStructPtr()
  1285.     if (ErrorLevel || !dwPointer)
  1286.         return 0
  1287.  
  1288.     dwPointer := readDWORD(hGTA, dwPointer + SAMP_DIALOG_PTR2_OFFSET)
  1289.     if (ErrorLevel) {
  1290.         ErrorLevel := ERROR_READ_MEMORY
  1291.         return 0
  1292.     }
  1293.  
  1294.     count := readMem(hGTA, dwPointer + SAMP_DIALOG_LINECOUNT_OFFSET, 4, "UInt")
  1295.     if (ErrorLevel) {
  1296.         ErrorLevel := ERROR_READ_MEMORY
  1297.         return 0
  1298.     }
  1299.  
  1300.     ErrorLevel := ERROR_OK
  1301.     return count
  1302. }
  1303.  
  1304. getDialogLine__(index) {
  1305.     if (getDialogLineCount > index)
  1306.         return ""
  1307.  
  1308.     dwPointer := getDialogStructPtr()
  1309.     if (ErrorLevel || !dwPointer)
  1310.         return ""
  1311.  
  1312.     dwPointer := readDWORD(hGTA, dwPointer + SAMP_DIALOG_PTR1_OFFSET)
  1313.     if (ErrorLevel) {
  1314.         ErrorLevel := ERROR_READ_MEMORY
  1315.         return ""
  1316.     }
  1317.  
  1318.     dwPointer := readDWORD(hGTA, dwPointer + SAMP_DIALOG_LINES_OFFSET)
  1319.     if (ErrorLevel) {
  1320.         ErrorLevel := ERROR_READ_MEMORY
  1321.         return ""
  1322.     }
  1323.  
  1324.     dwLineAddress := readDWORD(hGTA, dwPointer + (index - 1) * 0x4)
  1325.     line := readString(hGTA, dwLineAddress, 128)
  1326.  
  1327.     ErrorLevel := ERROR_OK
  1328.     return line
  1329. }
  1330.  
  1331. getDialogLine(index) {
  1332.     lines := getDialogLines()
  1333.     if (index > lines.Length())
  1334.         return ""
  1335.  
  1336.     if (getDialogStyle() == DIALOG_STYLE_TABLIST_HEADERS)
  1337.         index++
  1338.  
  1339.     return lines[index]
  1340. }
  1341.  
  1342. getDialogLines() {
  1343.     text := getDialogText()
  1344.     if (text == "")
  1345.         return -1
  1346.  
  1347.     lines := StrSplit(text, "`n")
  1348.     return lines
  1349. }
  1350.  
  1351. isDialogButton1Selected() {
  1352.     dwPointer := getDialogStructPtr()
  1353.     if (ErrorLevel || !dwPointer)
  1354.         return false
  1355.  
  1356.     dwPointer := readDWORD(hGTA, dwPointer + SAMP_DIALOG_PTR1_OFFSET)
  1357.     if (ErrorLevel) {
  1358.         ErrorLevel := ERROR_READ_MEMORY
  1359.         return false
  1360.     }
  1361.  
  1362.     selected := readMem(hGTA, dwPointer + SAMP_DIALOG_BUTTON_HOVERING_OFFSET, 1, "Byte")
  1363.     if (ErrorLevel) {
  1364.         ErrorLevel := ERROR_READ_MEMORY
  1365.         return false
  1366.     }
  1367.  
  1368.     ErrorLevel := ERROR_OK
  1369.     return selected
  1370. }
  1371.  
  1372. getDialogLines__() {
  1373.     count := getDialogLineCount()
  1374.  
  1375.     dwPointer := getDialogStructPtr()
  1376.     if (ErrorLevel || !dwPointer)
  1377.         return -1
  1378.  
  1379.     dwPointer := readDWORD(hGTA, dwPointer + SAMP_DIALOG_PTR1_OFFSET)
  1380.     if (ErrorLevel) {
  1381.         ErrorLevel := ERROR_READ_MEMORY
  1382.         return -1
  1383.     }
  1384.  
  1385.     dwPointer := readDWORD(hGTA, dwPointer + SAMP_DIALOG_LINES_OFFSET)
  1386.     if (ErrorLevel) {
  1387.         ErrorLevel := ERROR_READ_MEMORY
  1388.         return -1
  1389.     }
  1390.  
  1391.     lines := []
  1392.     Loop %count% {
  1393.         dwLineAddress := readDWORD(hGTA, dwPointer + (A_Index - 1) * 0x4)
  1394.         lines[A_Index] := readString(hGTA, dwLineAddress, 128)
  1395.     }
  1396.  
  1397.     ErrorLevel := ERROR_OK
  1398.     return lines
  1399. }
  1400.  
  1401. addChatMessage(wText) {
  1402. wText := "" wText
  1403. if(!checkHandles())
  1404. return false
  1405. dwFunc := dwSAMP + FUNC_SAMP_ADDTOCHATWND
  1406. dwChatInfo := readDWORD(hGTA, dwSAMP + ADDR_SAMP_CHATMSG_PTR)
  1407. if(ErrorLevel) {
  1408. ErrorLevel := ERROR_READ_MEMORY
  1409. return false
  1410. }
  1411. callWithParams(hGTA, dwFunc, [["p", dwChatInfo], ["s", wText]], true)
  1412. ErrorLevel := ERROR_OK
  1413. return true
  1414. }
  1415.  
  1416. getPageSize() {
  1417.     if (!checkHandles())
  1418.         return false
  1419.     dwAddress := readDWORD(hGTA, dwSAMP + ADDR_SAMP_CHATMSG_PTR)
  1420.     if (ErrorLevel || !dwAddress)
  1421.         return false
  1422.     pagesize := readMem(hGTA, dwAddress, 1, "Byte")
  1423.     if (ErrorLevel)
  1424.         return false
  1425.     ErrorLevel := ERROR_OK
  1426.     return pagesize
  1427. }
  1428.  
  1429. getGameText() {
  1430.     if (!checkHandles())
  1431.         return ""
  1432.     Loop, 7 {
  1433.         dwAddress := 0xBAACC0 + (A_Index - 1) * 0x80
  1434.         gameText := readString(hGTA, dwAddress, 128)
  1435.         if (ErrorLevel)
  1436.         return ""
  1437.         if (gameText != "")
  1438.             break
  1439.     }
  1440.    
  1441.     ErrorLevel := ERROR_OK
  1442.     return gameText
  1443. }
  1444.  
  1445. getPlayerAnim() {
  1446.     if (!checkHandles())
  1447.         return -1
  1448.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)
  1449.     dwAddress := readDWORD(hGTA, dwAddress + SAMP_PPOOLS_OFFSET)
  1450.     dwPlayers := readDWORD(hGTA, dwAddress + SAMP_PPOOL_PLAYER_OFFSET)
  1451.     dwLocalPlayer := readDWORD(hGTA, dwPlayers + SAMP_LOCALPLAYER_OFFSET)
  1452.     if (ErrorLevel)
  1453.         return -1
  1454.     animId := readMem(hGTA, dwLocalPlayer + 0x4, 2, "Short")
  1455.     if (ErrorLevel)
  1456.         return -1
  1457.     ErrorLevel := ERROR_OK
  1458.     return animId
  1459. }
  1460.  
  1461. patchSAMPFunction(name) {
  1462.     if (!checkHandles())
  1463.         return false
  1464.     for i, o in functionPatches {
  1465.         if (name = o.NAME) {
  1466.             o.UNPATCH := readMem(hGTA, dwSAMP + o.OFFSET, 2, "Short")
  1467.             if (!writeMemory(hGTA, dwSAMP + o.OFFSET, o.PATCH, "Short", 2))
  1468.                 return false
  1469.             return true
  1470.         }
  1471.     }
  1472.     return false
  1473. }
  1474.  
  1475. unpatchSAMPFunction(name) {
  1476.     if (!checkHandles())
  1477.         return false
  1478.     for i, o in functionPatches {
  1479.         if (name = o.NAME) {
  1480.             if (!o.HasKey("UNPATCH"))
  1481.                 return false
  1482.             if (!writeMemory(hGTA, dwSAMP + o.OFFSET, o.UNPATCH, "Short", 2))
  1483.                 return false
  1484.             return true
  1485.         }
  1486.     }
  1487.     return false
  1488. }
  1489.  
  1490. getServerStatus(INADDR, PORT) {
  1491.     DllCall("LoadLibrary", "str", "ws2_32", "ptr")
  1492.     VarSetCapacity(wsadata, 408)
  1493.     DllCall("ws2_32\WSAStartup", "ushort", 0x0000, "ptr", &wsadata)
  1494.     DllCall("ws2_32\WSAStartup", "ushort", NumGet(wsadata, 2, "ushort"), "ptr", &wsadata)
  1495.     remoteHost := DllCall("Ws2_32\gethostbyname", "Str", (A_IsUnicode ? __unicodeToAnsi(INADDR) : INADDR), "ptr")
  1496.     if(remoteHost)
  1497.     {
  1498.         if(NumGet(remoteHost + (A_PtrSize==4 ? 8 : 16), "short")==2)
  1499.         {
  1500.             addrl := NumGet(remoteHost + (A_PtrSize==4 ? 12 : 24), "ptr")
  1501.             ha :=  NumGet(addrl+0, "ptr")
  1502.             a :=  NumGet(ha+0, "uchar")
  1503.             loop, 3
  1504.                 a .= "." NumGet(ha+A_index, "uchar")
  1505.             INADDR := a
  1506.         }
  1507.         else
  1508.             return -1
  1509.     }
  1510.     else
  1511.         return -1
  1512.     socket := DllCall("ws2_32\socket", "int", 2, "int", 2, "int", 17, "ptr")
  1513.     if(socket==-1)
  1514.     {
  1515.         return -1
  1516.     }
  1517.     VarSetCapacity(si, 16, 0)
  1518.     NumPut(2, si, 0, "Short")
  1519.     NumPut(DllCall("Ws2_32\htons", "UShort", PORT), si, 2, "UShort")
  1520.     NumPut(DllCall("Ws2_32\inet_addr", "Str", (A_IsUnicode ? __unicodeToAnsi(INADDR) : INADDR)), si, 4, "ptr")
  1521.     VarSetCapacity(message,30)
  1522.     StrPut("SAMP", &message, "cp0")
  1523.     StrPut("i", &message +10, "cp0")
  1524.     if(DllCall("ws2_32\sendto", "ptr", socket, "ptr", &message, "int", 11, "int", 0, "ptr", &si, "int", 16, "int")==-1)
  1525.     {
  1526.         DllCall("Ws2_32\closesocket", "ptr", socket)
  1527.         return -1
  1528.     }
  1529.     VarSetCapacity(buffer, 2048, 0)
  1530.     VarSetCapacity(optval, 8, 0)
  1531.     NumPut(1, optval, 0, "long") //timeout 1sec
  1532.     DllCall("ws2_32\setsockopt", "ptr", socket, "int", 0xFFFF, "int", 0x1006, "ptr", &optval, "int", 4)
  1533.     VarSetCapacity(silen,4)
  1534.     NumPut(16, silen, 0, "int")
  1535.     if(DllCall("ws2_32\recvfrom", "ptr", socket, "ptr", &buffer, "int", 2048, "int", 0, "ptr", &si, "ptr", &silen, "int")==-1)
  1536.     {
  1537.         DllCall("Ws2_32\closesocket", "ptr", socket)
  1538.         return -1
  1539.     }
  1540.     DllCall("Ws2_32\closesocket", "ptr", socket)
  1541.     return (NumGet(&buffer + 11, "Uchar") ? 2 : 1)
  1542. }
  1543.  
  1544. printJoinDisconnect() {
  1545.     static players := []
  1546.     static init := true
  1547.     if(init) {
  1548.         init := false
  1549.         Loop, % SAMP_PLAYER_MAX
  1550.         {
  1551.             getPlayerNameById(A_Index-1, players[A_Index-1])
  1552.         }
  1553.         return
  1554.     }
  1555.     Loop, % SAMP_PLAYER_MAX
  1556.     {
  1557.         i := A_Index-1
  1558.         getPlayerNameById(i, name)
  1559.         if(name) {
  1560.             if(name != players[i]) {
  1561.                 if(players[i]) {
  1562.                     AddChatMessage("{FFFFFF}" players[i] " (ID:" i ") hat den Server {FF0000}verlassen{FFFFFF}.")
  1563.                 }
  1564.                 players[i] := name
  1565.                 AddChatMessage("{FFFFFF}" players[i] " (ID:" i ") hat den Server {00FF00}betreten{FFFFFF}.")
  1566.             }
  1567.         }
  1568.         else {
  1569.             if(players[i]) {
  1570.                 AddChatMessage("{FFFFFF}" players[i] " (ID:" i ") hat den Server {FF0000}verlassen{FFFFFF}.")
  1571.                 players[i] := ""
  1572.             }
  1573.         }
  1574.     }
  1575. }
  1576.  
  1577. restartGameEx() {
  1578.     if(!checkHandles())
  1579.     return -1
  1580.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)
  1581.     if(ErrorLevel || dwAddress==0) {
  1582.         ErrorLevel := ERROR_READ_MEMORY
  1583.         return -1
  1584.     }
  1585.     dwFunc := dwSAMP + 0xA060
  1586.     VarSetCapacity(injectData, 11, 0)
  1587.     NumPut(0xB9, injectData, 0, "UChar")
  1588.     NumPut(dwAddress, injectData, 1, "UInt")
  1589.     NumPut(0xE8, injectData, 5, "UChar")
  1590.     offset := dwFunc - (pInjectFunc + 10)
  1591.     NumPut(offset, injectData, 6, "Int")
  1592.     NumPut(0xC3, injectData, 10, "UChar")
  1593.     writeRaw(hGTA, pInjectFunc, &injectData, 11)
  1594.     if(ErrorLevel)
  1595.     return false
  1596.     hThread := createRemoteThread(hGTA, 0, 0, pInjectFunc, 0, 0, 0)
  1597.     if(ErrorLevel)
  1598.     return false
  1599.     waitForSingleObject(hThread, 0xFFFFFFFF)
  1600.     return true
  1601. }
  1602.  
  1603. disconnectEx() {
  1604.     if(!checkHandles())
  1605.     return 0
  1606.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)
  1607.     if(ErrorLevel || dwAddress==0) {
  1608.         ErrorLevel := ERROR_READ_MEMORY
  1609.         return 0
  1610.     }
  1611.     dwAddress := readDWORD(hGTA, dwAddress + 0x3c9)
  1612.     if(ErrorLevel || dwAddress==0) {
  1613.         ErrorLevel := ERROR_READ_MEMORY
  1614.         return 0
  1615.     }
  1616.     ecx := dwAddress
  1617.     dwAddress := readDWORD(hGTA, dwAddress)
  1618.     if(ErrorLevel || dwAddress==0) {
  1619.         ErrorLevel := ERROR_READ_MEMORY
  1620.         return 0
  1621.     }
  1622.     VarSetCapacity(injectData, 24, 0)
  1623.     NumPut(0xB9, injectData, 0, "UChar")
  1624.     NumPut(ecx, injectData, 1, "UInt")
  1625.     NumPut(0xB8, injectData, 5, "UChar")
  1626.     NumPut(dwAddress, injectData, 6, "UInt")
  1627.     NumPut(0x68, injectData, 10, "UChar")
  1628.     NumPut(0, injectData, 11, "UInt")
  1629.     NumPut(0x68, injectData, 15, "UChar")
  1630.     NumPut(500, injectData, 16, "UInt")
  1631.     NumPut(0x50FF, injectData, 20, "UShort")
  1632.     NumPut(0x08, injectData, 22, "UChar")
  1633.     NumPut(0xC3, injectData, 23, "UChar")
  1634.     writeRaw(hGTA, pInjectFunc, &injectData, 24)
  1635.     if(ErrorLevel)
  1636.     return false
  1637.     hThread := createRemoteThread(hGTA, 0, 0, pInjectFunc, 0, 0, 0)
  1638.     if(ErrorLevel)
  1639.     return false
  1640.     waitForSingleObject(hThread, 0xFFFFFFFF)
  1641.     return true
  1642. }
  1643.  
  1644. setrestart()
  1645. {
  1646.     VarSetCapacity(old, 4, 0)
  1647.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)
  1648.     if(ErrorLevel || dwAddress==0) {
  1649.     ErrorLevel := ERROR_READ_MEMORY
  1650.     return 0
  1651.     }
  1652.     NumPut(9,old,0,"Int")
  1653.     writeRaw(hGTA, dwAddress + 957, &old, 4)
  1654. }
  1655.  
  1656. restart()
  1657. {
  1658.     restartGameEx()
  1659.     disconnectEx()
  1660.     addChatMessage("Reconnecting...")
  1661.     Sleep 15200 //Delay (Logout Pickup)
  1662.     setrestart()
  1663. }
  1664.  
  1665. StopAnim()
  1666. {
  1667.     SendChat("/Lay")
  1668.     Sleep 100
  1669.     Send, {Enter Down}
  1670.     Sleep 100
  1671.     Send, {Enter Up}
  1672. }
  1673.  
  1674. amk(o)
  1675. {
  1676.     global
  1677.     if(!o)
  1678.     return
  1679.     PlayerID:= o.ID
  1680.     PlayerSkin := getTargetPlayerSkinIdById(PlayerID)
  1681.     PlayerName := o.Name
  1682.     //Yakuza
  1683.     if(Playerskin=228 or Playerskin=186 or Playerskin=203 or Playerskin=204 or Playerskin=123 or Playerskin=122 or Playerskin=169)
  1684.     {
  1685.         Gegnerfound := 0
  1686.         Yakuza_Zeile := 0
  1687.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\Yakuza.txt
  1688.         {    
  1689.             If (Yakuza_Zeile >= A_Index)        
  1690.             {
  1691.                 Continue
  1692.             }
  1693.             else        
  1694.             {
  1695.                 if instr(A_Loopreadline,PlayerName)
  1696.                 {
  1697.                     Gegnerfound := 1
  1698.                 }
  1699.                 Yakuza_Zeile := A_Index
  1700.             }
  1701.         }
  1702.         if(Gegnerfound = 0)
  1703.         {
  1704.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\Yakuza.txt
  1705.             addchatmessage("{2E9AFE}* " Playername " wurde als Yakuza Mitglied eingetragen.")
  1706.         }
  1707.     }
  1708.    
  1709.     //Vagos
  1710.     if(Playerskin=109 or Playerskin=110 or Playerskin=108 or Playerskin=292 )
  1711.     {
  1712.         Gegnerfound := 0
  1713.         Vagos_Zeile := 0
  1714.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\Vagos.txt
  1715.         {    
  1716.             If (Vagos_Zeile >= A_Index)        
  1717.             {
  1718.                 Continue
  1719.             }
  1720.             else        
  1721.             {
  1722.                 if instr(A_Loopreadline,PlayerName)
  1723.                 {
  1724.                     Gegnerfound := 1
  1725.                 }
  1726.                 Vagos_Zeile := A_Index
  1727.             }
  1728.         }
  1729.         if(Gegnerfound = 0)
  1730.         {
  1731.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\Vagos.txt
  1732.             addchatmessage("{2E9AFE}* " Playername " wurde als Vagos Mitglied eingetragen.")
  1733.         }
  1734.     }
  1735.    
  1736.    
  1737.     //Triaden
  1738.     if(Playerskin=117 or Playerskin=118 or Playerskin=208 or Playerskin=120)
  1739.     {
  1740.         Gegnerfound := 0
  1741.         Triaden_Zeile := 0
  1742.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\Triaden.txt
  1743.         {    
  1744.             If (Triaden_Zeile >= A_Index)        
  1745.             {
  1746.                 Continue
  1747.             }
  1748.             else        
  1749.             {
  1750.                 if instr(A_Loopreadline,PlayerName)
  1751.                 {
  1752.                     Gegnerfound := 1
  1753.                 }
  1754.                 Triaden_Zeile := A_Index
  1755.             }
  1756.         }
  1757.         if(Gegnerfound = 0)
  1758.         {
  1759.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\Triaden.txt
  1760.             addchatmessage("{2E9AFE}* " Playername " wurde als Triaden Mitglied eingetragen.")
  1761.         }
  1762.     }
  1763.    
  1764.    
  1765.     //La Cosa Nostra
  1766.     if(Playerskin=225 or Playerskin=123 or Playerskin=125 or Playerskin=126 or Playerskin=223 or Playerskin=113)
  1767.     {
  1768.         Gegnerfound := 0
  1769.         lcn_Zeile := 0
  1770.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\La Cosa Nostra.txt
  1771.         {    
  1772.             If (lcn_Zeile >= A_Index)        
  1773.             {
  1774.                 Continue
  1775.             }
  1776.             else        
  1777.             {
  1778.                 if instr(A_Loopreadline,PlayerName)
  1779.                 {
  1780.                     Gegnerfound := 1
  1781.                 }
  1782.                 lcn_Zeile := A_Index
  1783.             }
  1784.         }
  1785.         if(Gegnerfound = 0)
  1786.         {
  1787.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\La Cosa Nostra.txt
  1788.             addchatmessage("{2E9AFE}* " Playername " wurde als La Cosa Nostra Mitglied eingetragen.")
  1789.         }
  1790.     }
  1791.    
  1792.     //Aztecas
  1793.     //114 115 116 173 174 175
  1794.     if(Playerskin=114 or Playerskin=115 or Playerskin=116 or Playerskin=173 or Playerskin=174 or Playerskin=175)
  1795.     {
  1796.         Gegnerfound := 0
  1797.         Aztecas_Zeile := 0
  1798.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\Aztecas.txt
  1799.         {    
  1800.             If (Aztecas_Zeile >= A_Index)        
  1801.             {
  1802.                 Continue
  1803.             }
  1804.             else        
  1805.             {
  1806.                 if instr(A_Loopreadline,PlayerName)
  1807.                 {
  1808.                     Gegnerfound := 1
  1809.                 }
  1810.                 Aztecas_Zeile := A_Index
  1811.             }
  1812.         }
  1813.         if(Gegnerfound = 0)
  1814.         {
  1815.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\Aztecas.txt
  1816.             addchatmessage("{2E9AFE}* " Playername " wurde als Aztecas Mitglied eingetragen.")
  1817.         }
  1818.     }
  1819.    
  1820.     //Ballas
  1821.     //102 103 104 13 195 293
  1822.     if(Playerskin=102 or Playerskin=103 or Playerskin=104 or Playerskin=13 or Playerskin=195 or Playerskin=293)
  1823.     {
  1824.         Gegnerfound := 0
  1825.         Ballas_Zeile := 0
  1826.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\Ballas.txt
  1827.         {    
  1828.             If (Ballas_Zeile >= A_Index)        
  1829.             {
  1830.                 Continue
  1831.             }
  1832.             else        
  1833.             {
  1834.                 if instr(A_Loopreadline,PlayerName)
  1835.                 {
  1836.                     Gegnerfound := 1
  1837.                 }
  1838.                 Ballas_Zeile := A_Index
  1839.             }
  1840.         }
  1841.         if(Gegnerfound = 0)
  1842.         {
  1843.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\Ballas.txt
  1844.             addchatmessage("{2E9AFE}* " Playername " wurde als Ballas Mitglied eingetragen.")
  1845.         }
  1846.     }
  1847.    
  1848.     //Los Santos Police Department
  1849.     //265 266 267 280 284 285 300 301 306 303 304
  1850.     if(Playerskin=265 or Playerskin=266 or Playerskin=267 or Playerskin=280 or Playerskin=284 or Playerskin=285 or Playerskin=300 or Playerskin=301 or Playerskin=306 or Playerskin=303 or Playerskin=304)
  1851.     {
  1852.         Gegnerfound := 0
  1853.         LSPD_Zeile := 0
  1854.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\Los Santos Police Department.txt
  1855.         {    
  1856.             If (LSPD_Zeile >= A_Index)        
  1857.             {
  1858.                 Continue
  1859.             }
  1860.             else        
  1861.             {
  1862.                 if instr(A_Loopreadline,PlayerName)
  1863.                 {
  1864.                     Gegnerfound := 1
  1865.                 }
  1866.                 LSPD_Zeile := A_Index
  1867.             }
  1868.         }
  1869.         if(Gegnerfound = 0)
  1870.         {
  1871.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\Los Santos Police Department.txt
  1872.             addchatmessage("{2E9AFE}* " Playername " wurde als Los Santos Police Department Mitglied eingetragen.")
  1873.         }
  1874.     }
  1875.    
  1876.     //NineDemons
  1877.     //100 247 248 254 291 261
  1878.     if(Playerskin=100 or Playerskin=247 or Playerskin=248 or Playerskin=254 or Playerskin=291 or Playerskin=261)
  1879.     {
  1880.         Gegnerfound := 0
  1881.         NineDemons_Zeile := 0
  1882.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\Nine Demons.txt
  1883.         {    
  1884.             If (NineDemons_Zeile >= A_Index)        
  1885.             {
  1886.                 Continue
  1887.             }
  1888.             else        
  1889.             {
  1890.                 if instr(A_Loopreadline,PlayerName)
  1891.                 {
  1892.                     Gegnerfound := 1
  1893.                 }
  1894.                 NineDemons_Zeile := A_Index
  1895.             }
  1896.         }
  1897.         if(Gegnerfound = 0)
  1898.         {
  1899.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\Nine Demons.txt
  1900.             addchatmessage("{2E9AFE}* " Playername " wurde als Nine Demons Mitglied eingetragen.")
  1901.         }
  1902.     }
  1903.    
  1904.     //Grove Street Family
  1905.     //105 106 107 269 270 271 65
  1906.     if(Playerskin=105 or Playerskin=106 or Playerskin=107 or Playerskin=269 or Playerskin=270 or Playerskin=271 or Playerskin=65)
  1907.     {
  1908.         Gegnerfound := 0
  1909.         GSF_Zeile := 0
  1910.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\Grove Street Family.txt
  1911.         {    
  1912.             If (GSF_Zeile >= A_Index)        
  1913.             {
  1914.                 Continue
  1915.             }
  1916.             else        
  1917.             {
  1918.                 if instr(A_Loopreadline,PlayerName)
  1919.                 {
  1920.                     Gegnerfound := 1
  1921.                 }
  1922.                 GSF_Zeile := A_Index
  1923.             }
  1924.         }
  1925.         if(Gegnerfound = 0)
  1926.         {
  1927.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\Grove Street Family.txt
  1928.             addchatmessage("{2E9AFE}* " Playername " wurde als Grove Street Family Mitglied eingetragen.")
  1929.         }
  1930.     }
  1931.    
  1932.     //Wheelman
  1933.     if(Playerskin=217 or Playerskin=211 or Playerskin=206 or Playerskin=202 or Playerskin=230)
  1934.     {
  1935.         Gegnerfound := 0
  1936.         Wheelman_Zeile := 0
  1937.         Loop, read, %A_MyDocuments%\Veyselbinder\Fraktionen\Wheelman.txt
  1938.         {    
  1939.             If (Wheelman_Zeile >= A_Index)        
  1940.             {
  1941.                 Continue
  1942.             }
  1943.             else        
  1944.             {
  1945.                 if instr(A_Loopreadline,PlayerName)
  1946.                 {
  1947.                     Gegnerfound := 1
  1948.                 }
  1949.                 Wheelman_Zeile := A_Index
  1950.             }
  1951.         }
  1952.         if(Gegnerfound = 0)
  1953.         {
  1954.             fileappend, %Playername%`n, %A_MyDocuments%\Veyselbinder\Fraktionen\Wheelman.txt
  1955.             addchatmessage("{2E9AFE}* " Playername " wurde als Wheelman Mitglied eingetragen.")
  1956.         }
  1957.     }
  1958. }
  1959.  
  1960. callFuncForAllStreamedInPlayers(cfunc,dist=0x7fffffff) {
  1961.     cfunc := "" cfunc
  1962.     dist += 0
  1963.     if(!IsFunc(cfunc))
  1964.         return false
  1965.     p := getStreamedInPlayersInfo()
  1966.     if(!p)
  1967.         return false
  1968.     if(dist<0x7fffffff)
  1969.     {
  1970.         lpos := getCoordinates()
  1971.         if(!lpos)
  1972.             return false
  1973.         For i, o in p
  1974.         {
  1975.             if(dist>getDist(lpos,o.POS))
  1976.                 %cfunc%(o)
  1977.         }
  1978.     }
  1979.     else
  1980.     {
  1981.         For i, o in p
  1982.             %cfunc%(o)
  1983.     }
  1984.     return true
  1985. }
  1986.  
  1987. getStreamedInPlayersInfo() {
  1988.     r:=[]
  1989.     if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  1990.     {
  1991.         For i, o in oScoreboardData
  1992.         {
  1993.             if(o.HasKey("PED"))
  1994.             {
  1995.                 p := getPedCoordinates(o.PED)
  1996.                 if(p)
  1997.                 {
  1998.                     o.POS := p
  1999.                     r[i] := o
  2000.                 }
  2001.             }
  2002.         }
  2003.         return r
  2004.     }
  2005.    
  2006.     if(!updateOScoreboardData())
  2007.         return ""
  2008.    
  2009.     For i, o in oScoreboardData
  2010.     {
  2011.         if(o.HasKey("PED"))
  2012.         {
  2013.             p := getPedCoordinates(o.PED)
  2014.             if(p)
  2015.             {
  2016.                 o.POS := p
  2017.                 r[i] := o
  2018.             }
  2019.         }
  2020.     }
  2021.     return r
  2022. }
  2023.  
  2024. UrlDownloadToVar(URL, ByRef Result, UserAgent = "", Proxy = "", ProxyBypass = "")
  2025. {
  2026. hModule := DllCall("LoadLibrary", "Str", "wininet.dll")
  2027. AccessType := Proxy != "" ? 3 : 1
  2028. io := DllCall("wininet\InternetOpenA"
  2029. , "Str", UserAgent
  2030. , "UInt", AccessType
  2031. , "Str", Proxy
  2032. , "Str", ProxyBypass
  2033. , "UInt", 0)
  2034. iou := DllCall("wininet\InternetOpenUrlA"
  2035. , "UInt", io
  2036. , "Str", url
  2037. , "Str", ""
  2038. , "UInt", 0
  2039. , "UInt", 0x80000000
  2040. , "UInt", 0)
  2041. If (ErrorLevel != 0 or iou = 0) {
  2042. DllCall("FreeLibrary", "UInt", hModule)
  2043. return 0
  2044. }
  2045. VarSetCapacity(buffer, 10240, 0)
  2046. VarSetCapacity(BytesRead, 4, 0)
  2047. Loop
  2048. {
  2049. irf := DllCall("wininet\InternetReadFile", "UInt", iou, "UInt", &buffer, "UInt", 10240, "UInt", &BytesRead)
  2050. VarSetCapacity(buffer, -1)
  2051. BytesRead_ = 0
  2052. Loop, 4
  2053. BytesRead_ += *(&BytesRead + A_Index-1) << 8*(A_Index-1)
  2054. If (irf = 1 and BytesRead_ = 0)
  2055. break
  2056. Else
  2057. Result .= SubStr(buffer, 1, BytesRead_)
  2058. }
  2059. DllCall("wininet\InternetCloseHandle", "UInt", iou)
  2060. DllCall("wininet\InternetCloseHandle", "UInt", io)
  2061. DllCall("FreeLibrary", "UInt", hModule)
  2062. }
  2063.  
  2064. getVehicleNumberPlate() {
  2065.     if(!checkHandles())
  2066.         return ""
  2067.    
  2068.     dwVehPtr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  2069.     if(ErrorLevel || dwVehPtr==0) {
  2070.         ErrorLevel := ERROR_READ_MEMORY
  2071.         return ""
  2072.     }
  2073.    
  2074.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)
  2075.     if(ErrorLevel || dwAddress==0) {
  2076.         ErrorLevel := ERROR_READ_MEMORY
  2077.         return ""
  2078.     }
  2079.    
  2080.     dwAddress := readDWORD(hGTA, dwAddress + SAMP_PPOOLS_OFFSET)
  2081.     if(ErrorLevel || dwAddress==0) {
  2082.         ErrorLevel := ERROR_READ_MEMORY
  2083.         return ""
  2084.     }
  2085.    
  2086.     vehpool := readDWORD(hGTA, dwAddress + 0x1C)
  2087.     if(ErrorLevel || vehpool==0) {
  2088.         ErrorLevel := ERROR_READ_MEMORY
  2089.         return ""
  2090.     }
  2091.    
  2092.     Loop, 2000
  2093.     {
  2094.         i := A_Index-1
  2095.        
  2096.         listed := readDWORD(hGTA, vehpool + 0x3074 + i*4)
  2097.         if(ErrorLevel) {
  2098.             ErrorLevel := ERROR_READ_MEMORY
  2099.             return ""
  2100.         }
  2101.        
  2102.         if(listed==0)
  2103.             continue
  2104.        
  2105.         svehptr := readDWORD(hGTA, vehpool + 0x4FB4 + i*4)
  2106.         if(ErrorLevel) {
  2107.             ErrorLevel := ERROR_READ_MEMORY
  2108.             return ""
  2109.         }
  2110.        
  2111.         if(svehptr==dwVehPtr) {
  2112.             sampveh := readDWORD(hGTA, vehpool + 0x1134 + i*4)
  2113.             if(ErrorLevel || sampveh==0) {
  2114.                 ErrorLevel := ERROR_READ_MEMORY
  2115.                 return ""
  2116.             }
  2117.            
  2118.             plate := readString(hGTA, sampveh + 0x93, 33)
  2119.             if(ErrorLevel) {
  2120.                 ErrorLevel := ERROR_READ_MEMORY
  2121.                 return ""
  2122.             }
  2123.            
  2124.             ErrorLevel := ERROR_OK
  2125.             return plate
  2126.         }
  2127.     }
  2128.    
  2129.     ErrorLevel := ERROR_OK
  2130.     return ""
  2131. }
  2132.  
  2133. getAttacker(bReset := false) {
  2134.     if (!checkHandles() || !updateOScoreboardData())
  2135.         return -1
  2136.     dwLocalPED := readDWORD(hGTA, ADDR_CPED_PTR)
  2137.     dwAttacker := readDWORD(hGTA, dwLocalPED + 0x764)
  2138.     if (!dwAttacker)
  2139.         return -1
  2140.     for i, o in oScoreboardData {
  2141.         if (!o.PED || o.ISNPC || dwAttacker != o.PED)
  2142.             continue
  2143.         if (bReset)
  2144.             writeMemory(hGTA, dwLocalPED + 0x764, 0, "UInt", 4)
  2145.         return o.ID
  2146.     }
  2147.     return -1
  2148. }
  2149.  
  2150. getKiller(bReset := false) {
  2151.     if (!checkHandles() || getPlayerHealth() > 0 || !updateOScoreboardData())
  2152.         return -1
  2153.     dwLocalPED := readDWORD(hGTA, ADDR_CPED_PTR)
  2154.     dwMurderer := readDWORD(hGTA, dwLocalPED + 0x764)
  2155.     if (!dwMurderer)
  2156.         return -1
  2157.     for i, o in oScoreboardData {
  2158.         if (!o.PED || o.ISNPC || dwMurderer != o.PED)
  2159.         continue
  2160.         if (bReset)
  2161.             writeMemory(hGTA, dwLocalPED + 0x764, 0, "UInt", 4)
  2162.            
  2163.         return o.ID
  2164.     }
  2165.     return -1
  2166. }
  2167.  
  2168. getClosestPlayerPed() {
  2169. dist := 0x7fffffff
  2170. p := getStreamedInPlayersInfo()
  2171. if(!p)
  2172. return -1
  2173. lpos := getCoordinates()
  2174. if(!lpos)
  2175. return -1
  2176. id := -1
  2177. For i, o in p
  2178. {
  2179. t:=getDist(lpos,o.POS)
  2180. if(t<dist)
  2181. {
  2182. dist := t
  2183. id := i
  2184. }
  2185. }
  2186. PED := getPedById(id)
  2187. return PED
  2188. }
  2189.  
  2190. getClosestPlayerId() {
  2191. dist := 0x7fffffff
  2192. p := getStreamedInPlayersInfo()
  2193. if(!p)
  2194. return -1
  2195. lpos := getCoordinates()
  2196. if(!lpos)
  2197. return -1
  2198. id := -1
  2199. For i, o in p
  2200. {
  2201. t:=getDist(lpos,o.POS)
  2202. if(t<dist)
  2203. {
  2204. dist := t
  2205. id := i
  2206. }
  2207. }
  2208. return id
  2209. }
  2210.  
  2211. isCheckpointEnabled() {
  2212.     if (!checkHandles()) {
  2213.         ErrorLevel := ERROR_INVALID_HANDLE
  2214.         return false
  2215.     }
  2216.  
  2217.     dwAddress := readDWORD(hGTA, dwSAMP + ADDR_SAMP_INCHAT_PTR)
  2218.     if (ErrorLevel || !dwAddress) {
  2219.         ErrorLevel := ERROR_READ_MEMORY
  2220.         return false
  2221.     }
  2222.  
  2223.     isSet := readMem(hGTA, dwAddress + 0x24, 1, "Byte")
  2224.     if (ErrorLevel) {
  2225.         ErrorLevel := ERROR_READ_MEMORY
  2226.         return false
  2227.     }
  2228.  
  2229.     ErrorLevel := ERROR_OK
  2230.     return isSet
  2231. }
  2232.  
  2233. getCheckpointSize() {
  2234.     if (!checkHandles()) {
  2235.         ErrorLevel := ERROR_INVALID_HANDLE
  2236.         return -1
  2237.     }
  2238.  
  2239.     dwAddress := readDWORD(hGTA, dwSAMP + ADDR_SAMP_INCHAT_PTR)
  2240.     if (ErrorLevel || !dwAddress) {
  2241.         ErrorLevel := ERROR_READ_MEMORY
  2242.             return -1
  2243.     }
  2244.    
  2245.     size := readMem(hGTA, dwAddress + 0x18, 4, "Float")
  2246.     if (ErrorLevel) {
  2247.         ErrorLevel := ERROR_READ_MEMORY
  2248.         return -1
  2249.     }
  2250.    
  2251.     ErrorLevel := ERROR_OK
  2252.     return size
  2253. }
  2254.  
  2255. getCheckpointPos() {
  2256.     if (!checkhandles()) {
  2257.         ErrorLevel := ERROR_INVALID_HANDLE
  2258.         return -1
  2259.     }
  2260.  
  2261.     dwAddress := readDWORD(hGTA, dwSAMP + ADDR_SAMP_INCHAT_PTR)
  2262.     if (ErrorLevel || !dwAddress) {
  2263.         ErrorLevel := ERROR_READ_MEMORY
  2264.         return -1
  2265.     }
  2266.  
  2267.     offsets := [0xC, 0x10, 0x14]
  2268.     for i, o in offsets
  2269.         pos%i% := readMem(hGTA, dwAddress + o, 4, "Float")
  2270.  
  2271.     if (ErrorLevel) {
  2272.         ErrorLevel := ERROR_READ_MEMORY
  2273.         return -1
  2274.     }
  2275.  
  2276.     ErrorLevel := ERROR_OK
  2277.     return [pos1, pos2, pos3]
  2278. }
  2279.  
  2280. enableCheckpoint() {
  2281.     if (!checkhandles()) {
  2282.         ErrorLevel := ERROR_INVALID_HANDLE
  2283.         return false
  2284.     }
  2285.  
  2286.     dwAddress := readDWORD(hGTA, dwSAMP + ADDR_SAMP_INCHAT_PTR)
  2287.     if (ErrorLevel || !dwAddress) {
  2288.         ErrorLevel := ERROR_READ_MEMORY
  2289.         return false
  2290.     }
  2291.    
  2292.     writeMemory(hGTA, dwAddress + 0x24, 1, "Byte", 1)
  2293.     if (ErrorLevel) {
  2294.         ErrorLevel := ERROR_READ_MEMORY
  2295.         return false
  2296.     }
  2297.  
  2298.     ErrorLevel := ERROR_OK
  2299.     return true
  2300. }
  2301.  
  2302. getLabelText() {
  2303. if(!checkHandles())
  2304. return 0
  2305. ADDR_3DText := readDWORD(hGTA, dwSAMP + SAMP_3DTEXT)
  2306. TEXT_3DTEXT := readString(hGTA, ADDR_3DText, 512)
  2307. return TEXT_3DTEXT
  2308. }
  2309.  
  2310. getDialogContent() {
  2311. if(!checkHandles())
  2312. return 0
  2313. dwAddress := readDWORD(hGTA, dwSAMP + SAMP_DIALOG_PTR)
  2314. dwAddress := readDWORD(hGTA, dwAddress + SAMP_DIALOG_OFFSET)
  2315. sContent := readString(hGTA, dwAddress, SAMP_DIALOG_SIZE)
  2316. return sContent
  2317. }
  2318.  
  2319. GetProcessList(){
  2320. strComputer := "."
  2321. objWMIService := ComObjGet("winmgmts:\\" . strComputer . "\root\cimv2")
  2322. colProcesses := objWMIService.ExecQuery("Select * From Win32_Process")._NewEnum
  2323. list := ""
  2324. While colProcesses[objProcess]
  2325. {
  2326. element := objProcess.Name
  2327. list = %list%`n%element%
  2328. }
  2329. return list
  2330. }
  2331. FormatNumber(_number) {
  2332. StringReplace _number, _number, -
  2333. IfEqual ErrorLevel,0, SetEnv Sign,-
  2334. Loop Parse, _number, .
  2335. If (A_Index = 1)
  2336. {
  2337. len := StrLen(A_LoopField)
  2338. Loop Parse, A_LoopField
  2339. If (Mod(len-A_Index,3) = 0 and A_Index != len)
  2340. x .= A_LoopField "."
  2341. Else
  2342. x .= A_LoopField
  2343. }
  2344. Else
  2345. Return Sign x "." A_LoopField
  2346. Return Sign x
  2347. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top