Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 94.17 KB | None | 0 0
  1. #IfWinActive, GTA:SA:MP
  2. #SingleInstance, Force
  3. #Persistent
  4. #UseHook
  5. #NoEnv
  6.  
  7. ; #### SAMP UDF ####
  8. ; SAMP Version: 0.3.7 R1
  9. ; https://github.com/paul-phoenix
  10. ; ####################
  11.  
  12.  
  13.  
  14. ; ErrorLevels
  15. global ERROR_OK := 0
  16. global ERROR_PROCESS_NOT_FOUND := 1
  17. global ERROR_OPEN_PROCESS := 2
  18. global ERROR_INVALID_HANDLE := 3
  19. global ERROR_MODULE_NOT_FOUND := 4
  20. global ERROR_ENUM_PROCESS_MODULES := 5
  21. global ERROR_ZONE_NOT_FOUND := 6
  22. global ERROR_CITY_NOT_FOUND := 7
  23. global ERROR_READ_MEMORY := 8
  24. global ERROR_WRITE_MEMORY := 9
  25. global ERROR_ALLOC_MEMORY := 10
  26. global ERROR_FREE_MEMORY := 11
  27. global ERROR_WAIT_FOR_OBJECT := 12
  28. global ERROR_CREATE_THREAD := 13
  29.  
  30. ; GTA Addresses
  31. global ADDR_ZONECODE := 0xA49AD4
  32. global ADDR_POSITION_X := 0xB6F2E4
  33. global ADDR_POSITION_Y := 0xB6F2E8
  34. global ADDR_POSITION_Z := 0xB6F2EC
  35. global ADDR_CPED_PTR := 0xB6F5F0
  36. global ADDR_CPED_HPOFF := 0x540
  37. global ADDR_CPED_ARMOROFF := 0x548
  38. global ADDR_VEHICLE_PTR := 0xBA18FC
  39. global ADDR_VEHICLE_HPOFF := 0x4C0
  40. global ADDR_CPED_MONEY := 0xB7CE50
  41. global ADDR_CPED_INTID := 0xA4ACE8
  42. global ADDR_VEHICLE_DOORSTATE := 0x4F8
  43. global ADDR_VEHICLE_ENGINESTATE := 0x428
  44. global ADDR_VEHICLE_LIGHTSTATE := 0x428
  45. global ADDR_VEHICLE_MODEL := 0x22
  46. global ADDR_VEHICLE_TYPE := 0x590
  47. global ADDR_VEHICLE_DRIVER := 0x460
  48.  
  49. global oAirplaneModels := [417, 425, 447, 460, 469, 476, 487, 488, 497, 511, 512, 513, 519, 520, 548, 553, 563, 577, 592, 593]
  50. global oBikeModels := [481,509,510]
  51. global ovehicleNames := ["Landstalker","Bravura","Buffalo","Linerunner","Perrenial","Sentinel","Dumper","Firetruck","Trashmaster","Stretch","Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto","Taxi","Washington","Bobcat","Whoopee","BFInjection","Hunter","Premier","Enforcer","Securicar","Banshee","Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie","Stallion","Rumpo","RCBandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer","Turismo","Speeder","Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley'sRCVan","Skimmer","PCJ-600","Faggio","Freeway","RCBaron","RCRaider","Glendale","Oceanic","Sanchez","Sparrow","Patriot","Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR-350","Walton","Regina","Comet","BMX","Burrito","Camper","Marquis","Baggage","Dozer","Maverick","NewsChopper","Rancher","FBIRancher","Virgo","Greenwood","Jetmax","Hotring","Sandking","BlistaCompact","PoliceMaverick","Boxvillde","Benson","Mesa","RCGoblin","HotringRacerA","HotringRacerB","BloodringBanger","Rancher","SuperGT","Elegant","Journey","Bike","MountainBike","Beagle","Cropduster","Stunt","Tanker","Roadtrain","Nebula","Majestic","Buccaneer","Shamal","hydra","FCR-900","NRG-500","HPV1000","CementTruck","TowTruck","Fortune","Cadrona","FBITruck","Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight","Streak","Vortex","Vincent","Bullet","Clover","Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob","Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster","Monster","Uranus","Jester","Sultan","Stratum","Elegy","Raindance","RCTiger","Flash","Tahoma","Savanna","Bandito","FreightFlat","StreakCarriage","Kart","Mower","Dune","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford","BF-400","NewsVan","Tug","Trailer","Emperor","Wayfarer","Euros","Hotdog","Club","FreightBox","Trailer","Andromada","Dodo","RCCam","Launch","PoliceCar","PoliceCar","PoliceCar","PoliceRanger","Picador","S.W.A.T","Alpha","Phoenix","GlendaleShit","SadlerShit","Luggage","Luggage","Stairs","Boxville","Tiller","UtilityTrailer"]
  52.  
  53. ; SAMP Addresses
  54. global ADDR_SAMP_INCHAT_PTR := 0x21A10C
  55. global ADDR_SAMP_INCHAT_PTR_OFF := 0x55
  56. global ADDR_SAMP_USERNAME := 0x219A6F
  57. global ADDR_SAMP_CHATMSG_PTR := 0x21A0E4
  58. global ADDR_SAMP_SHOWDLG_PTR := 0x21A0B8
  59. global FUNC_SAMP_SENDCMD := 0x65C60
  60. global FUNC_SAMP_SENDSAY := 0x57F0
  61. global FUNC_SAMP_ADDTOCHATWND := 0x64520
  62. global FUNC_SAMP_SHOWGAMETEXT := 0x9C2C0
  63. global FUNC_SAMP_PLAYAUDIOSTR := 0x62DA0
  64. global FUNC_SAMP_STOPAUDIOSTR := 0x629A0
  65. global FUNC_SAMP_SHOWDIALOG := 0x6B9C0
  66. global FUNC_UPDATESCOREBOARD := 0x8A10
  67.  
  68. global SAMP_INFO_OFFSET := 0x21A0F8
  69. global SAMP_PPOOLS_OFFSET := 0x3CD
  70. global SAMP_PPOOL_PLAYER_OFFSET := 0x18
  71. global SAMP_SLOCALPLAYERID_OFFSET := 0x4
  72. global SAMP_ISTRLEN_LOCALPLAYERNAME_OFFSET := 0x1A
  73. global SAMP_SZLOCALPLAYERNAME_OFFSET := 0xA
  74. global SAMP_PSZLOCALPLAYERNAME_OFFSET := 0xA
  75. global SAMP_PREMOTEPLAYER_OFFSET := 0x2E
  76. global SAMP_ISTRLENNAME___OFFSET := 0x1C
  77. global SAMP_SZPLAYERNAME_OFFSET := 0xC
  78. global SAMP_PSZPLAYERNAME_OFFSET := 0xC
  79. global SAMP_ILOCALPLAYERPING_OFFSET := 0x26
  80. global SAMP_ILOCALPLAYERSCORE_OFFSET := 0x2A
  81. global SAMP_IPING_OFFSET := 0x28
  82. global SAMP_ISCORE_OFFSET := 0x24
  83. global SAMP_ISNPC_OFFSET := 0x4
  84.  
  85. global SAMP_PLAYER_MAX := 1004
  86.  
  87. ; Sizes
  88. global SIZE_SAMP_CHATMSG := 0xFC
  89.  
  90. ; Internal
  91. global hGTA := 0x0
  92. global dwGTAPID := 0x0
  93. global dwSAMP := 0x0
  94. global pMemory := 0x0
  95. global pParam1 := 0x0
  96. global pParam2 := 0x0
  97. global pParam3 := 0x0
  98. global pInjectFunc := 0x0
  99. global nZone := 1
  100. global nCity := 1
  101. global bInitZaC := 0
  102. global iRefreshScoreboard := 0
  103. global oScoreboardData := ""
  104. global iRefreshHandles := 0
  105. global iUpdateTick := 2500 ;time in ms, used for getPlayerNameById etc. to refresh data
  106.  
  107. ; #####################################################################################################################
  108. ; # SAMP-Functions: #
  109. ; # - isInChat() check if dialog or chatbox is active #
  110. ; # - getUsername() get local player name #
  111. ; # - getId() get local player id #
  112. ; # - sendChatMessage(wText) send a message to the server #
  113. ; # - addMessageToChatWindow(wText) add a "private" text to the chatbox #
  114. ; # - showGameText(wText, dwTime, dwTextsize) show a text on the sreen #
  115. ; # - showDialog(dwStyle, wCaption, show a dialog-box #
  116. ; # wInfo, wButton1) #
  117. ; # - playAudioStream(wUrl) play an "audio stream" #
  118. ; # - stopAudioStream() stopp an audio stream #
  119. ; # - blockChatInput() call this func to block chat messages to server #
  120. ; # - unBlockChatInput() call this func to unblock chat messages to server #
  121. ; # ----------------------------------------------------------------------------------------------------------------- #
  122. ; # - patchRadio() (internal stuff) #
  123. ; # - unPatchRadio() (internal stuff) #
  124. ; #####################################################################################################################
  125. ; # - getPlayerNameById(dwId) get some player's name #
  126. ; # - getPlayerIdByName(wName) get some player's id #
  127. ; # - getPlayerScoreById(dwId) get some player's score #
  128. ; # - getPlayerPingById(dwId) get some player's ping #
  129. ; # - isNPCById(dwId) check if player is a NPC #
  130. ; # ----------------------------------------------------------------------------------------------------------------- #
  131. ; # - updateScoreboardDataEx() (internal stuff) #
  132. ; # - updateOScoreboardData() (internal stuff) #
  133. ; #####################################################################################################################
  134. ; # Player Functions : #
  135. ; # - getPlayerHealth() get HP #
  136. ; # - getPlayerArmor() get ARMOR #
  137. ; # - getPlayerInteriorId() get interior id #
  138. ; # - getPlayerMoney() get player money #
  139. ; #####################################################################################################################
  140. ; # Vehicle Functions: #
  141. ; # - isPlayerInAnyVehicle() check if the local player is inside some vehicle #
  142. ; # - isPlayerDriver() check if player is driver #
  143. ; # - getVehicleHealth() get vehicle health #
  144. ; # - getVehicleType() get vehicle type #
  145. ; # - getVehicleModelId() get vehicle model id #
  146. ; # - getVehicleModelName() get vehicle model name #
  147. ; # - getVehicleLightState() get vehicle light state #
  148. ; # - getVehicleEngineState() get vehicle engine state #
  149. ; # - getVehicleLockState() get vehicle door lock state #
  150. ; #####################################################################################################################
  151. ; # Coordinates: #
  152. ; # - getCoordinates() get local player's position #
  153. ; # ----------------------------------------------------------------------------------------------------------------- #
  154. ; # - calculateZone(X, Y, Z) get zone #
  155. ; # - calculateCity(X, Y, Z) get city #
  156. ; # - getCurrentZonecode() get zone code (buggy) #
  157. ; #####################################################################################################################
  158. ; # Internal Functions: #
  159. ; # - initZonesAndCities() #
  160. ; # - AddZone(Name, X1, Y1, Z1, X2, Y2, Z2) #
  161. ; # - AddCity(Name, X1, Y1, Z1, X2, Y2, Z2) #
  162. ; #####################################################################################################################
  163. ; # Memory Functions: #
  164. ; # - checkHandles() #
  165. ; # - refreshGTA() #
  166. ; # - refreshSAMP() #
  167. ; # - refreshMemory() #
  168. ; # - getPID(szWindow) #
  169. ; # - openProcess(dwPID, dwRights) #
  170. ; # - closeProcess(hProcess) #
  171. ; # - getModuleBaseAddress(sModule, dwPID) #
  172. ; # - readString(hProcess, dwAddress, dwLen) #
  173. ; # - readFloat(hProcess, dwAddress) #
  174. ; # - readDWORD(hProcess, dwAddress) #
  175. ; # - readMem(hProcess, dwAddress, dwLen=4, type="UInt") #
  176. ; # - writeString(hProcess, dwAddress, wString) #
  177. ; # - writeRaw(hProcess, dwAddress, data, dwLen) #
  178. ; # - callWithParams(hProcess, dwFunc, aParams, bCleanupStack = true) #
  179. ; # - virtualAllocEx(hProcess, dwSize, flAllocationType, flProtect) #
  180. ; # - virtualFreeEx(hProcess, lpAddress, dwSize, dwFreeType) #
  181. ; # - createRemoteThread(hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, #
  182. ; # dwCreationFlags, lpThreadId) #
  183. ; # - waitForSingleObject(hThread, dwMilliseconds) #
  184. ; # - __ansiToUnicode(sString, nLen = 0) #
  185. ; # - __unicodeToAnsi(wString, nLen = 0) #
  186. ; #####################################################################################################################
  187.  
  188. ; ##### SAMP-Functions #####
  189.  
  190. ; 1 = chat/dialog open
  191. ; 0 = not open
  192. ; -1 = error
  193. isInChat() {
  194. if(!checkHandles())
  195. return -1
  196.  
  197. dwPtr := dwSAMP + ADDR_SAMP_INCHAT_PTR
  198. dwAddress := readDWORD(hGTA, dwPtr) + ADDR_SAMP_INCHAT_PTR_OFF
  199. if(ErrorLevel) {
  200. ErrorLevel := ERROR_READ_MEMORY
  201. return -1
  202. }
  203.  
  204. dwInChat := readDWORD(hGTA, dwAddress)
  205. if(ErrorLevel) {
  206. ErrorLevel := ERROR_READ_MEMORY
  207. return -1
  208. }
  209.  
  210. ErrorLevel := ERROR_OK
  211. if(dwInChat > 0) {
  212. return true
  213. } else {
  214. return false
  215. }
  216. }
  217.  
  218. ; get nickname or empty string ""
  219. getUsername() {
  220. if(!checkHandles())
  221. return ""
  222.  
  223. dwAddress := dwSAMP + ADDR_SAMP_USERNAME
  224. sUsername := readString(hGTA, dwAddress, 25)
  225. if(ErrorLevel) {
  226. ErrorLevel := ERROR_READ_MEMORY
  227. return ""
  228. }
  229.  
  230. ErrorLevel := ERROR_OK
  231. return sUsername
  232. }
  233.  
  234. ; get local player id or -1 on error
  235. getId() {
  236. s:=getUsername()
  237. return getPlayerIdByName(s)
  238. }
  239.  
  240. ; pass a string to send a chat message to the server
  241. SendChat(wText) {
  242. wText := "" wText
  243.  
  244. if(!checkHandles())
  245. return false
  246.  
  247. dwFunc:=0
  248. if(SubStr(wText, 1, 1) == "/") {
  249. dwFunc := dwSAMP + FUNC_SAMP_SENDCMD
  250. } else {
  251. dwFunc := dwSAMP + FUNC_SAMP_SENDSAY
  252. }
  253.  
  254. callWithParams(hGTA, dwFunc, [["s", wText]], false)
  255.  
  256. ErrorLevel := ERROR_OK
  257. return true
  258. }
  259.  
  260. ; similar to: http://wiki.sa-mp.com/wiki/SendClientMessage
  261. ; pass a string to add a private message to the chatbox
  262. AddChatMessage(wText) {
  263. wText := "" wText
  264.  
  265. if(!checkHandles())
  266. return false
  267.  
  268. dwFunc := dwSAMP + FUNC_SAMP_ADDTOCHATWND
  269. dwChatInfo := readDWORD(hGTA, dwSAMP + ADDR_SAMP_CHATMSG_PTR)
  270. if(ErrorLevel) {
  271. ErrorLevel := ERROR_READ_MEMORY
  272. return false
  273. }
  274.  
  275. callWithParams(hGTA, dwFunc, [["p", dwChatInfo], ["s", wText]], true)
  276.  
  277. ErrorLevel := ERROR_OK
  278. return true
  279. }
  280.  
  281. ; similar to: http://wiki.sa-mp.com/wiki/GameTextForPlayer
  282. ; wText The text to be displayed.
  283. ; dwTime The duration of the text being shown in milliseconds.
  284. ; dwStyle The style of text to be displayed.
  285. showGameText(wText, dwTime, dwSize) {
  286. wText := "" wText
  287. dwTime += 0
  288. dwTime := Floor(dwTime)
  289. dwSize += 0
  290. dwSize := Floor(dwSize)
  291.  
  292. if(!checkHandles())
  293. return false
  294.  
  295. dwFunc := dwSAMP + FUNC_SAMP_SHOWGAMETEXT
  296.  
  297. callWithParams(hGTA, dwFunc, [["s", wText], ["i", dwTime], ["i", dwSize]], false)
  298.  
  299. ErrorLevel := ERROR_OK
  300. return true
  301. }
  302.  
  303. ; similar to: http://wiki.sa-mp.com/wiki/ShowPlayerDialog
  304. ; dwStyle The style of the dialog.
  305. ; wCaption The title at the top of the dialog. The length of the caption can not exceed more than 64 characters before it starts to cut off.
  306. ; wInfo The text to display in the main dialog. Use \n to start a new line and \t to tabulate.
  307. ; wButton1 The text on the left button.
  308. showDialog(dwStyle, wCaption, wInfo, wButton1 ) {
  309. dwStyle += 0
  310. dwStyle := Floor(dwStyle)
  311. wCaption := "" wCaption
  312. wInfo := "" wInfo
  313. wButton1 := "" wButton1
  314.  
  315. if(!checkHandles())
  316. return false
  317.  
  318.  
  319. dwFunc := dwSAMP + FUNC_SAMP_SHOWDIALOG
  320.  
  321. dwAddress := readDWORD(hGTA, dwSAMP + ADDR_SAMP_SHOWDLG_PTR)
  322. if(ErrorLevel || dwAddress==0) {
  323. ErrorLevel := ERROR_READ_MEMORY
  324. return false
  325. }
  326.  
  327. writeString(hGTA, pParam1, wCaption)
  328. if(ErrorLevel)
  329. return false
  330. writeString(hGTA, pParam2, wInfo)
  331. if(ErrorLevel)
  332. return false
  333. writeString(hGTA, pParam3, wButton1)
  334. if(ErrorLevel)
  335. return false
  336.  
  337. ;mov + 7*push + call + retn
  338. dwLen := 5 + 7*5 + 5 + 1
  339.  
  340.  
  341. VarSetCapacity(injectData, dwLen, 0)
  342.  
  343. NumPut(0xB9, injectData, 0, "UChar") ;0 + 1 ;mov ecx
  344. NumPut(dwAddress, injectData, 1, "UInt") ;1 + 4
  345. NumPut(0x68, injectData, 5, "UChar") ;5 + 1 ;push 0
  346. NumPut(0, injectData, 6, "UInt") ;6 + 4
  347. NumPut(0x68, injectData, 10, "UChar") ;10 + 1 ;push 0
  348. NumPut(pParam1+StrLen(wCaption), injectData, 11, "UInt") ;11 + 4
  349. NumPut(0x68, injectData, 15, "UChar") ;15 + 1 ;push button1
  350. NumPut(pParam3, injectData, 16, "UInt") ;16 + 4
  351. NumPut(0x68, injectData, 20, "UChar") ;20 + 1 ;push info
  352. NumPut(pParam2, injectData, 21, "UInt") ;21 + 4
  353. NumPut(0x68, injectData, 25, "UChar") ;25 + 1 ;push caption
  354. NumPut(pParam1, injectData, 26, "UInt") ;26 + 4
  355. NumPut(0x68, injectData, 30, "UChar") ;30 + 1 ;push style
  356. NumPut(dwStyle, injectData, 31, "UInt") ;31 + 4
  357. NumPut(0x68, injectData, 35, "UChar") ;35 + 1 ;push 1
  358. NumPut(1, injectData, 36, "UInt") ;36 + 4
  359.  
  360. NumPut(0xE8, injectData, 40, "UChar") ;40 + 1 ;call
  361. offset := dwFunc - (pInjectFunc + 45)
  362. NumPut(offset, injectData, 41, "Int") ;41 + 4
  363. NumPut(0xC3, injectData, 45, "UChar") ;45 + 1 ;retn
  364.  
  365. writeRaw(hGTA, pInjectFunc, &injectData, dwLen)
  366. if(ErrorLevel)
  367. return false
  368.  
  369. hThread := createRemoteThread(hGTA, 0, 0, pInjectFunc, 0, 0, 0)
  370. if(ErrorLevel)
  371. return false
  372.  
  373. waitForSingleObject(hThread, 0xFFFFFFFF)
  374.  
  375. closeProcess(hThread)
  376.  
  377. return true
  378. }
  379.  
  380. ; similar to: http://wiki.sa-mp.com/wiki/PlayAudioStreamForPlayer
  381. ; pass a url to play some sound
  382. playAudioStream(wUrl) {
  383. wUrl := "" wUrl
  384.  
  385. if(!checkHandles())
  386. return false
  387.  
  388. dwFunc := dwSAMP + FUNC_SAMP_PLAYAUDIOSTR
  389.  
  390. patchRadio()
  391.  
  392. callWithParams(hGTA, dwFunc, [["s", wUrl], ["i", 0], ["i", 0], ["i", 0], ["i", 0], ["i", 0]], false)
  393.  
  394. unPatchRadio()
  395.  
  396. ErrorLevel := ERROR_OK
  397. return true
  398. }
  399.  
  400. ; stop a audio stream
  401. stopAudioStream() {
  402. if(!checkHandles())
  403. return false
  404.  
  405. dwFunc := dwSAMP + FUNC_SAMP_STOPAUDIOSTR
  406.  
  407. patchRadio()
  408.  
  409. callWithParams(hGTA, dwFunc, [["i", 1]], false)
  410.  
  411. unPatchRadio()
  412.  
  413. ErrorLevel := ERROR_OK
  414. return true
  415. }
  416.  
  417. ; call this func to block chat messages to server
  418. blockChatInput() {
  419. if(!checkHandles())
  420. return false
  421.  
  422. VarSetCapacity(nop, 2, 0)
  423.  
  424. dwFunc := dwSAMP + FUNC_SAMP_SENDSAY
  425. NumPut(0x04C2,nop,0,"Short")
  426. writeRaw(hGTA, dwFunc, &nop, 2)
  427.  
  428. dwFunc := dwSAMP + FUNC_SAMP_SENDCMD
  429. writeRaw(hGTA, dwFunc, &nop, 2)
  430.  
  431. return true
  432. }
  433.  
  434. ; call this func to unblock chat messages to server
  435. unBlockChatInput() {
  436. if(!checkHandles())
  437. return false
  438.  
  439. VarSetCapacity(nop, 2, 0)
  440.  
  441. dwFunc := dwSAMP + FUNC_SAMP_SENDSAY
  442. NumPut(0xA164,nop,0,"Short")
  443. writeRaw(hGTA, dwFunc, &nop, 2)
  444.  
  445. dwFunc := dwSAMP + FUNC_SAMP_SENDCMD
  446. writeRaw(hGTA, dwFunc, &nop, 2)
  447.  
  448. return true
  449. }
  450.  
  451. ; needed for audio stream
  452. patchRadio() {
  453. if(!checkHandles())
  454. return false
  455.  
  456. VarSetCapacity(nop, 4, 0)
  457. NumPut(0x90909090,nop,0,"UInt")
  458.  
  459. dwFunc := dwSAMP + FUNC_SAMP_PLAYAUDIOSTR
  460. writeRaw(hGTA, dwFunc, &nop, 4)
  461. writeRaw(hGTA, dwFunc+4, &nop, 1)
  462.  
  463. dwFunc := dwSAMP + FUNC_SAMP_STOPAUDIOSTR
  464. writeRaw(hGTA, dwFunc, &nop, 4)
  465. writeRaw(hGTA, dwFunc+4, &nop, 1)
  466. return true
  467. }
  468.  
  469. ; needed for audio stream
  470. unPatchRadio() {
  471. if(!checkHandles())
  472. return false
  473.  
  474. VarSetCapacity(old, 4, 0)
  475.  
  476. dwFunc := dwSAMP + FUNC_SAMP_PLAYAUDIOSTR
  477. NumPut(0x74003980,old,0,"UInt")
  478. writeRaw(hGTA, dwFunc, &old, 4)
  479. NumPut(0x39,old,0,"UChar")
  480. writeRaw(hGTA, dwFunc+4, &old, 1)
  481.  
  482. dwFunc := dwSAMP + FUNC_SAMP_STOPAUDIOSTR
  483. NumPut(0x74003980,old,0,"UInt")
  484. writeRaw(hGTA, dwFunc, &old, 4)
  485. NumPut(0x09,old,0,"UChar")
  486. writeRaw(hGTA, dwFunc+4, &old, 1)
  487. return true
  488. }
  489.  
  490. ; pass an id to get nickname
  491. ; returns an empty string on error
  492. getPlayerNameById(dwId) {
  493. dwId += 0
  494. dwId := Floor(dwId)
  495. if(dwId < 0 || dwId >= SAMP_PLAYER_MAX)
  496. return ""
  497.  
  498. if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  499. {
  500. if(oScoreboardData[dwId])
  501. return oScoreboardData[dwId].NAME
  502. return ""
  503. }
  504.  
  505. if(!updateOScoreboardData())
  506. return ""
  507.  
  508. if(oScoreboardData[dwId])
  509. return oScoreboardData[dwId].NAME
  510. return ""
  511. }
  512.  
  513. ; pass a nickname or a part of it to get id
  514. ; (not case sensivite)
  515. ; returns -1 on error
  516. getPlayerIdByName(wName) {
  517. wName := "" wName
  518. if(StrLen(wName) < 1 || StrLen(wName) > 20)
  519. return -1
  520.  
  521. if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  522. {
  523. For i, o in oScoreboardData
  524. {
  525. if(InStr(o.NAME,wName)==1)
  526. return i
  527. }
  528. return -1
  529. }
  530.  
  531. if(!updateOScoreboardData())
  532. return -1
  533.  
  534. For i, o in oScoreboardData
  535. {
  536. if(InStr(o.NAME,wName)==1)
  537. return i
  538. }
  539. return -1
  540. }
  541.  
  542. ; pass an id to get score
  543. ; returns an empty string on error
  544. getPlayerScoreById(dwId) {
  545. dwId += 0
  546. dwId := Floor(dwId)
  547. if(dwId < 0 || dwId >= SAMP_PLAYER_MAX)
  548. return ""
  549.  
  550. if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  551. {
  552. if(oScoreboardData[dwId])
  553. return oScoreboardData[dwId].SCORE
  554. return ""
  555. }
  556.  
  557. if(!updateOScoreboardData())
  558. return ""
  559.  
  560. if(oScoreboardData[dwId])
  561. return oScoreboardData[dwId].SCORE
  562. return ""
  563. }
  564.  
  565. ; pass an id to get ping
  566. ; returns -1 on error
  567. getPlayerPingById(dwId) {
  568. dwId += 0
  569. dwId := Floor(dwId)
  570. if(dwId < 0 || dwId >= SAMP_PLAYER_MAX)
  571. return -1
  572.  
  573. if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  574. {
  575. if(oScoreboardData[dwId])
  576. return oScoreboardData[dwId].PING
  577. return -1
  578. }
  579.  
  580. if(!updateOScoreboardData())
  581. return -1
  582.  
  583. if(oScoreboardData[dwId])
  584. return oScoreboardData[dwId].PING
  585. return -1
  586. }
  587.  
  588. ; pass an id to check if id is a NPC
  589. ; 1 = id is a NPC
  590. ; 0 = id is a human, usually ;)
  591. ; returns -1 on error
  592. isNPCById(dwId) {
  593. dwId += 0
  594. dwId := Floor(dwId)
  595. if(dwId < 0 || dwId >= SAMP_PLAYER_MAX)
  596. return -1
  597.  
  598. if(iRefreshScoreboard+iUpdateTick > A_TickCount)
  599. {
  600. if(oScoreboardData[dwId])
  601. return oScoreboardData[dwId].ISNPC
  602. return -1
  603. }
  604.  
  605. if(!updateOScoreboardData())
  606. return -1
  607.  
  608. if(oScoreboardData[dwId])
  609. return oScoreboardData[dwId].ISNPC
  610. return -1
  611. }
  612.  
  613. ; internal stuff
  614. updateScoreboardDataEx() {
  615.  
  616. if(!checkHandles())
  617. return false
  618.  
  619. dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET) ;g_SAMP
  620. if(ErrorLevel || dwAddress==0) {
  621. ErrorLevel := ERROR_READ_MEMORY
  622. return false
  623. }
  624.  
  625. dwFunc := dwSAMP + FUNC_UPDATESCOREBOARD
  626.  
  627. VarSetCapacity(injectData, 11, 0) ;mov + call + retn
  628.  
  629. NumPut(0xB9, injectData, 0, "UChar")
  630. NumPut(dwAddress, injectData, 1, "UInt")
  631.  
  632. NumPut(0xE8, injectData, 5, "UChar")
  633. offset := dwFunc - (pInjectFunc + 10)
  634. NumPut(offset, injectData, 6, "Int")
  635. NumPut(0xC3, injectData, 10, "UChar")
  636.  
  637. writeRaw(hGTA, pInjectFunc, &injectData, 11)
  638. if(ErrorLevel)
  639. return false
  640.  
  641. hThread := createRemoteThread(hGTA, 0, 0, pInjectFunc, 0, 0, 0)
  642. if(ErrorLevel)
  643. return false
  644.  
  645. waitForSingleObject(hThread, 0xFFFFFFFF)
  646.  
  647. closeProcess(hThread)
  648.  
  649. return true
  650.  
  651. }
  652.  
  653. ; internal stuff
  654. updateOScoreboardData() {
  655. if(!checkHandles())
  656. return 0
  657.  
  658. oScoreboardData := []
  659.  
  660. if(!updateScoreboardDataEx())
  661. return 0
  662.  
  663. iRefreshScoreboard := A_TickCount
  664.  
  665. dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)
  666. if(ErrorLevel || dwAddress==0) {
  667. ErrorLevel := ERROR_READ_MEMORY
  668. return 0
  669. }
  670.  
  671. dwAddress := readDWORD(hGTA, dwAddress + SAMP_PPOOLS_OFFSET)
  672. if(ErrorLevel || dwAddress==0) {
  673. ErrorLevel := ERROR_READ_MEMORY
  674. return 0
  675. }
  676.  
  677. dwPlayers := readDWORD(hGTA, dwAddress + SAMP_PPOOL_PLAYER_OFFSET)
  678. if(ErrorLevel || dwPlayers==0) {
  679. ErrorLevel := ERROR_READ_MEMORY
  680. return 0
  681. }
  682.  
  683. wID := readMem(hGTA, dwPlayers + SAMP_SLOCALPLAYERID_OFFSET, 2, "Short") ;sLocalPlayerID
  684. if(ErrorLevel) {
  685. ErrorLevel := ERROR_READ_MEMORY
  686. return 0
  687. }
  688.  
  689. dwPing := readMem(hGTA, dwPlayers + SAMP_ILOCALPLAYERPING_OFFSET, 4, "Int")
  690. if(ErrorLevel) {
  691. ErrorLevel := ERROR_READ_MEMORY
  692. return 0
  693. }
  694.  
  695. dwScore := readMem(hGTA, dwPlayers + SAMP_ILOCALPLAYERSCORE_OFFSET, 4, "Int")
  696. if(ErrorLevel) {
  697. ErrorLevel := ERROR_READ_MEMORY
  698. return 0
  699. }
  700.  
  701. dwTemp := readMem(hGTA, dwPlayers + SAMP_ISTRLEN_LOCALPLAYERNAME_OFFSET, 4, "Int") ;iStrlen_LocalPlayerName
  702. if(ErrorLevel) {
  703. ErrorLevel := ERROR_READ_MEMORY
  704. return 0
  705. }
  706.  
  707. sUsername := ""
  708. if(dwTemp <= 0xf) {
  709. sUsername := readString(hGTA, dwPlayers + SAMP_SZLOCALPLAYERNAME_OFFSET, 16) ;szLocalPlayerName
  710. if(ErrorLevel) {
  711. ErrorLevel := ERROR_READ_MEMORY
  712. return 0
  713. }
  714. }
  715. else {
  716. dwAddress := readDWORD(hGTA, dwPlayers + SAMP_PSZLOCALPLAYERNAME_OFFSET) ;pszLocalPlayerName
  717. if(ErrorLevel) {
  718. ErrorLevel := ERROR_READ_MEMORY
  719. return 0
  720. }
  721. sUsername := readString(hGTA, dwAddress, 25)
  722. if(ErrorLevel) {
  723. ErrorLevel := ERROR_READ_MEMORY
  724. return 0
  725. }
  726. }
  727. oScoreboardData[wID] := Object("NAME", sUsername, "ID", wID, "PING", dwPing, "SCORE", dwScore, "ISNPC", 0)
  728.  
  729. Loop, % SAMP_PLAYER_MAX
  730. {
  731. i := A_Index-1
  732.  
  733. dwRemoteplayer := readDWORD(hGTA, dwPlayers+SAMP_PREMOTEPLAYER_OFFSET+i*4) ;pRemotePlayer
  734. if(ErrorLevel) {
  735. ErrorLevel := ERROR_READ_MEMORY
  736. return 0
  737. }
  738.  
  739. if(dwRemoteplayer==0)
  740. continue
  741.  
  742. dwPing := readMem(hGTA, dwRemoteplayer + SAMP_IPING_OFFSET, 4, "Int")
  743. if(ErrorLevel) {
  744. ErrorLevel := ERROR_READ_MEMORY
  745. return 0
  746. }
  747.  
  748. dwScore := readMem(hGTA, dwRemoteplayer + SAMP_ISCORE_OFFSET, 4, "Int")
  749. if(ErrorLevel) {
  750. ErrorLevel := ERROR_READ_MEMORY
  751. return 0
  752. }
  753.  
  754. dwIsNPC := readMem(hGTA, dwRemoteplayer + SAMP_ISNPC_OFFSET, 4, "Int")
  755. if(ErrorLevel) {
  756. ErrorLevel := ERROR_READ_MEMORY
  757. return 0
  758. }
  759.  
  760. dwTemp := readMem(hGTA, dwRemoteplayer + SAMP_ISTRLENNAME___OFFSET, 4, "Int")
  761. if(ErrorLevel) {
  762. ErrorLevel := ERROR_READ_MEMORY
  763. return 0
  764. }
  765. sUsername := ""
  766. if(dwTemp <= 0xf)
  767. {
  768. sUsername := readString(hGTA, dwRemoteplayer+SAMP_SZPLAYERNAME_OFFSET, 16)
  769. if(ErrorLevel) {
  770. ErrorLevel := ERROR_READ_MEMORY
  771. return 0
  772. }
  773. }
  774. else {
  775. dwAddress := readDWORD(hGTA, dwRemoteplayer + SAMP_PSZPLAYERNAME_OFFSET)
  776. if(ErrorLevel || dwAddress==0) {
  777. ErrorLevel := ERROR_READ_MEMORY
  778. return 0
  779. }
  780. sUsername := readString(hGTA, dwAddress, 25)
  781. if(ErrorLevel) {
  782. ErrorLevel := ERROR_READ_MEMORY
  783. return 0
  784. }
  785. }
  786. o := Object("NAME", sUsername, "ID", i, "PING", dwPing, "SCORE", dwScore, "ISNPC", dwIsNPC)
  787. oScoreboardData[i] := o
  788. }
  789. ErrorLevel := ERROR_OK
  790. return 1
  791. }
  792.  
  793. ; ##### Player Functions #####
  794.  
  795. ; return HP or -1 on error
  796. getPlayerHealth() {
  797. if(!checkHandles())
  798. return -1
  799.  
  800. dwCPedPtr := readDWORD(hGTA, ADDR_CPED_PTR)
  801. if(ErrorLevel) {
  802. ErrorLevel := ERROR_READ_MEMORY
  803. return -1
  804. }
  805.  
  806. dwAddr := dwCPedPtr + ADDR_CPED_HPOFF
  807. fHealth := readFloat(hGTA, dwAddr)
  808. if(ErrorLevel) {
  809. ErrorLevel := ERROR_READ_MEMORY
  810. return -1
  811. }
  812.  
  813. ErrorLevel := ERROR_OK
  814. return Round(fHealth)
  815. }
  816.  
  817. ; return ARMOR or -1 on error
  818. getPlayerArmor() {
  819. if(!checkHandles())
  820. return -1
  821.  
  822. dwCPedPtr := readDWORD(hGTA, ADDR_CPED_PTR)
  823. if(ErrorLevel) {
  824. ErrorLevel := ERROR_READ_MEMORY
  825. return -1
  826. }
  827.  
  828. dwAddr := dwCPedPtr + ADDR_CPED_ARMOROFF
  829. fHealth := readFloat(hGTA, dwAddr)
  830. if(ErrorLevel) {
  831. ErrorLevel := ERROR_READ_MEMORY
  832. return -1
  833. }
  834.  
  835. ErrorLevel := ERROR_OK
  836. return Round(fHealth)
  837. }
  838.  
  839. ; returns -1 on error or some interior id
  840. getPlayerInteriorId() {
  841. if(!checkHandles())
  842. return -1
  843.  
  844. iid := readMem(hGTA, ADDR_CPED_INTID, 4, "Int")
  845. if(ErrorLevel) {
  846. ErrorLevel := ERROR_READ_MEMORY
  847. return -1
  848. }
  849.  
  850. ErrorLevel := ERROR_OK
  851. return iid
  852. }
  853.  
  854. ; returns local players money or an empty string on error
  855. getPlayerMoney() {
  856. if(!checkHandles())
  857. return ""
  858.  
  859. money := readMem(hGTA, ADDR_CPED_MONEY, 4, "Int")
  860. if(ErrorLevel) {
  861. ErrorLevel := ERROR_READ_MEMORY
  862. return ""
  863. }
  864.  
  865. ErrorLevel := ERROR_OK
  866. return money
  867. }
  868.  
  869. ; ##### Vehicle Functions #####
  870.  
  871. ; 1 = local player is inside a vehicle
  872. ; 0 = local player is not inside a vehicle
  873. ; -1 = some error
  874. isPlayerInAnyVehicle()
  875. {
  876. if(!checkHandles())
  877. return -1
  878.  
  879. dwVehPtr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  880. if(ErrorLevel) {
  881. ErrorLevel := ERROR_READ_MEMORY
  882. return -1
  883. }
  884.  
  885. return (dwVehPtr > 0)
  886. }
  887.  
  888. ; 1 = local player is driver
  889. ; 0 = local player is not driver
  890. ; -1 = not inside a car or error
  891. isPlayerDriver() {
  892. if(!checkHandles())
  893. return -1
  894.  
  895. dwAddr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  896. if(ErrorLevel) {
  897. ErrorLevel := ERROR_READ_MEMORY
  898. return -1
  899. }
  900.  
  901. if(!dwAddr)
  902. return -1
  903.  
  904. dwCPedPtr := readDWORD(hGTA, ADDR_CPED_PTR)
  905. if(ErrorLevel) {
  906. ErrorLevel := ERROR_READ_MEMORY
  907. return -1
  908. }
  909.  
  910. dwVal := readDWORD(hGTA, dwAddr + ADDR_VEHICLE_DRIVER)
  911. if(ErrorLevel) {
  912. ErrorLevel := ERROR_READ_MEMORY
  913. return -1
  914. }
  915.  
  916. ErrorLevel := ERROR_OK
  917. return (dwVal==dwCPedPtr)
  918. }
  919.  
  920. ; get -1 on error or vehicle health
  921. getVehicleHealth() {
  922. if(!checkHandles())
  923. return -1
  924.  
  925. dwVehPtr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  926. if(ErrorLevel) {
  927. ErrorLevel := ERROR_READ_MEMORY
  928. return -1
  929. }
  930.  
  931. dwAddr := dwVehPtr + ADDR_VEHICLE_HPOFF
  932. fHealth := readFloat(hGTA, dwAddr)
  933. if(ErrorLevel) {
  934. ErrorLevel := ERROR_READ_MEMORY
  935. return -1
  936. }
  937.  
  938. ErrorLevel := ERROR_OK
  939. return Round(fHealth)
  940. }
  941.  
  942. ; 1=car, 2=boat, 3=train, 4=motorbike, 5=plane, 6=bike
  943. ; 0 on error
  944. getVehicleType() {
  945. if(!checkHandles())
  946. return 0
  947.  
  948. dwAddr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  949. if(ErrorLevel) {
  950. ErrorLevel := ERROR_READ_MEMORY
  951. return 0
  952. }
  953.  
  954. if(!dwAddr)
  955. return 0
  956.  
  957. cVal := readMem(hGTA, dwAddr + ADDR_VEHICLE_TYPE, 1, "Char")
  958. if(ErrorLevel) {
  959. ErrorLevel := ERROR_READ_MEMORY
  960. return 0
  961. }
  962.  
  963. ErrorLevel := ERROR_OK
  964. if(!cVal)
  965. {
  966. mid := getVehicleModelId()
  967. Loop % oAirplaneModels.MaxIndex()
  968. {
  969. if(oAirplaneModels[A_Index]==mid)
  970. return 5
  971. }
  972. return 1
  973. }
  974. else if(cVal==5)
  975. return 2
  976. else if(cVal==6)
  977. return 3
  978. else if(cVal==9)
  979. {
  980. mid := getVehicleModelId()
  981. Loop % oBikeModels.MaxIndex()
  982. {
  983. if(oBikeModels[A_Index]==mid)
  984. return 6
  985. }
  986. return 4
  987. }
  988. return 0
  989. }
  990.  
  991. ; 0 on error or a vehicle id
  992. getVehicleModelId() {
  993. if(!checkHandles())
  994. return 0
  995.  
  996. dwAddr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  997. if(ErrorLevel) {
  998. ErrorLevel := ERROR_READ_MEMORY
  999. return 0
  1000. }
  1001.  
  1002. if(!dwAddr)
  1003. return 0
  1004.  
  1005. sVal := readMem(hGTA, dwAddr + ADDR_VEHICLE_MODEL, 2, "Short")
  1006. if(ErrorLevel) {
  1007. ErrorLevel := ERROR_READ_MEMORY
  1008. return 0
  1009. }
  1010.  
  1011. ErrorLevel := ERROR_OK
  1012. return sVal
  1013. }
  1014.  
  1015. ; retuns a vehicle model name or an empty string on error/not inside a car
  1016. getVehicleModelName() {
  1017. id:=getVehicleModelId()
  1018. if(id>400 && id <611)
  1019. {
  1020. return ovehicleNames[id-399]
  1021. }
  1022. return ""
  1023. }
  1024.  
  1025. ; 1 = Lights on
  1026. ; 0 = Lights off
  1027. ; -1 = some error/not inside a car
  1028. getVehicleLightState() {
  1029. if(!checkHandles())
  1030. return -1
  1031.  
  1032. dwAddr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  1033. if(ErrorLevel) {
  1034. ErrorLevel := ERROR_READ_MEMORY
  1035. return -1
  1036. }
  1037.  
  1038. if(!dwAddr)
  1039. return -1
  1040.  
  1041. dwVal := readMem(hGTA, dwAddr + ADDR_VEHICLE_LIGHTSTATE, 4, "Int")
  1042. if(ErrorLevel) {
  1043. ErrorLevel := ERROR_READ_MEMORY
  1044. return -1
  1045. }
  1046.  
  1047. ErrorLevel := ERROR_OK
  1048. return (dwVal>0)
  1049. }
  1050.  
  1051. ; 0 = engine not running
  1052. ; 1 = engine is runnig
  1053. ; -1 = some error/not inside a car
  1054. getVehicleEngineState() {
  1055. if(!checkHandles())
  1056. return -1
  1057.  
  1058. dwAddr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  1059. if(ErrorLevel) {
  1060. ErrorLevel := ERROR_READ_MEMORY
  1061. return -1
  1062. }
  1063.  
  1064. if(!dwAddr)
  1065. return -1
  1066.  
  1067. cVal := readMem(hGTA, dwAddr + ADDR_VEHICLE_ENGINESTATE, 1, "Char")
  1068. if(ErrorLevel) {
  1069. ErrorLevel := ERROR_READ_MEMORY
  1070. return -1
  1071. }
  1072.  
  1073. ErrorLevel := ERROR_OK
  1074. return (cVal==24 || cVal==56 || cVal==88 || cVal==120)
  1075. }
  1076.  
  1077. ; 1 = Vehicle locked
  1078. ; 0 = Vehicle not locked
  1079. ; -1 = some error/not inside a car
  1080. getVehicleLockState() {
  1081. if(!checkHandles())
  1082. return -1
  1083.  
  1084. dwAddr := readDWORD(hGTA, ADDR_VEHICLE_PTR)
  1085. if(ErrorLevel) {
  1086. ErrorLevel := ERROR_READ_MEMORY
  1087. return -1
  1088. }
  1089.  
  1090. if(!dwAddr)
  1091. return -1
  1092.  
  1093. dwVal := readDWORD(hGTA, dwAddr + ADDR_VEHICLE_DOORSTATE)
  1094. if(ErrorLevel) {
  1095. ErrorLevel := ERROR_READ_MEMORY
  1096. return -1
  1097. }
  1098.  
  1099. ErrorLevel := ERROR_OK
  1100. return (dwVal==2)
  1101. }
  1102.  
  1103. ; ##### Coordinates #####
  1104.  
  1105. ; returns an object which contains local players position
  1106. ; returns an empty string on error
  1107. ; example:
  1108. ; o := getCoordinates()
  1109. ; o[1] //x pos
  1110. ; o[2] //y pos
  1111. ; o[3] //z pos
  1112. getCoordinates() {
  1113. if(!checkHandles())
  1114. return ""
  1115.  
  1116. fX := readFloat(hGTA, ADDR_POSITION_X)
  1117. if(ErrorLevel) {
  1118. ErrorLevel := ERROR_READ_MEMORY
  1119. return ""
  1120. }
  1121.  
  1122. fY := readFloat(hGTA, ADDR_POSITION_Y)
  1123. if(ErrorLevel) {
  1124. ErrorLevel := ERROR_READ_MEMORY
  1125. return ""
  1126. }
  1127.  
  1128. fZ := readFloat(hGTA, ADDR_POSITION_Z)
  1129. if(ErrorLevel) {
  1130. ErrorLevel := ERROR_READ_MEMORY
  1131. return ""
  1132. }
  1133.  
  1134. ErrorLevel := ERROR_OK
  1135. return [fX, fY, fZ]
  1136. }
  1137.  
  1138. ; pass coordinates to get a zone name or get an empty string on error
  1139. calculateZone(posX, posY, posZ) {
  1140. posX += 0
  1141. posY += 0
  1142. posZ += 0
  1143.  
  1144. if ( !bInitZaC )
  1145. {
  1146. initZonesAndCities()
  1147. bInitZaC := 1
  1148. }
  1149.  
  1150. Loop % nZone-1
  1151. {
  1152. if (posX >= zone%A_Index%_x1) && (posY >= zone%A_Index%_y1) && (posZ >= zone%A_Index%_z1) && (posX <= zone%A_Index%_x2) && (posY <= zone%A_Index%_y2) && (posZ <= zone%A_Index%_z2)
  1153. {
  1154. ErrorLevel := ERROR_OK
  1155. return zone%A_Index%_name
  1156. }
  1157. }
  1158.  
  1159. ErrorLevel := ERROR_ZONE_NOT_FOUND
  1160. return ""
  1161. }
  1162.  
  1163. ; pass coordinates to get a city name or get an empty string on error
  1164. calculateCity(posX, posY, posZ) {
  1165. posX += 0
  1166. posY += 0
  1167. posZ += 0
  1168.  
  1169. if ( !bInitZaC )
  1170. {
  1171. initZonesAndCities()
  1172. bInitZaC := 1
  1173. }
  1174. smallestCity := ""
  1175. currentCitySize := 0
  1176. smallestCitySize := 0
  1177.  
  1178. Loop % nCity-1
  1179. {
  1180. if (posX >= city%A_Index%_x1) && (posY >= city%A_Index%_y1) && (posZ >= city%A_Index%_z1) && (posX <= city%A_Index%_x2) && (posY <= city%A_Index%_y2) && (posZ <= city%A_Index%_z2)
  1181. {
  1182. currentCitySize := ((city%A_Index%_x2 - city%A_Index%_x1) * (city%A_Index%_y2 - city%A_Index%_y1) * (city%A_Index%_z2 - city%A_Index%_z1))
  1183. if (!smallestCity) || (currentCitySize < smallestCitySize)
  1184. {
  1185. smallestCity := city%A_Index%_name
  1186. smallestCitySize := currentCitySize
  1187. }
  1188. }
  1189. }
  1190.  
  1191. if(!smallestCity) {
  1192. ErrorLevel := ERROR_CITY_NOT_FOUND
  1193. } else {
  1194. ErrorLevel := ERROR_OK
  1195. }
  1196. return smallestCity
  1197. }
  1198.  
  1199. /*
  1200. ;buggy
  1201. getCurrentZonecode() {
  1202. if(!checkHandles())
  1203. return ""
  1204.  
  1205. return readString(hGTA, ADDR_ZONECODE, 5)
  1206. }
  1207. */
  1208.  
  1209. ;############### INTERNAL FUNCTIONS
  1210.  
  1211. ; internal stuff
  1212. initZonesAndCities() {
  1213. if(bInitZaC)
  1214. return
  1215. AddCity("Las Venturas", 685.0, 476.093, -500.0, 3000.0, 3000.0, 500.0)
  1216. AddCity("San Fierro", -3000.0, -742.306, -500.0, -1270.53, 1530.24, 500.0)
  1217. AddCity("San Fierro", -1270.53, -402.481, -500.0, -1038.45, 832.495, 500.0)
  1218. AddCity("San Fierro", -1038.45, -145.539, -500.0, -897.546, 376.632, 500.0)
  1219. AddCity("Los Santos", 480.0, -3000.0, -500.0, 3000.0, -850.0, 500.0)
  1220. AddCity("Los Santos", 80.0, -2101.61, -500.0, 1075.0, -1239.61, 500.0)
  1221. AddCity("Tierra Robada", -1213.91, 596.349, -242.99, -480.539, 1659.68, 900.0)
  1222. AddCity("Red County", -1213.91, -768.027, -242.99, 2997.06, 596.349, 900.0)
  1223. AddCity("Flint County", -1213.91, -2892.97, -242.99, 44.6147, -768.027, 900.0)
  1224. AddCity("Whetstone", -2997.47, -2892.97, -242.99, -1213.91, -1115.58, 900.0)
  1225.  
  1226. AddZone("Avispa Country Club", -2667.810, -302.135, -28.831, -2646.400, -262.320, 71.169)
  1227. AddZone("Easter Bay Airport", -1315.420, -405.388, 15.406, -1264.400, -209.543, 25.406)
  1228. AddZone("Avispa Country Club", -2550.040, -355.493, 0.000, -2470.040, -318.493, 39.700)
  1229. AddZone("Easter Bay Airport", -1490.330, -209.543, 15.406, -1264.400, -148.388, 25.406)
  1230. AddZone("Garcia", -2395.140, -222.589, -5.3, -2354.090, -204.792, 200.000)
  1231. AddZone("Shady Cabin", -1632.830, -2263.440, -3.0, -1601.330, -2231.790, 200.000)
  1232. AddZone("East Los Santos", 2381.680, -1494.030, -89.084, 2421.030, -1454.350, 110.916)
  1233. AddZone("LVA Freight Depot", 1236.630, 1163.410, -89.084, 1277.050, 1203.280, 110.916)
  1234. AddZone("Blackfield Intersection", 1277.050, 1044.690, -89.084, 1315.350, 1087.630, 110.916)
  1235. AddZone("Avispa Country Club", -2470.040, -355.493, 0.000, -2270.040, -318.493, 46.100)
  1236. AddZone("Temple", 1252.330, -926.999, -89.084, 1357.000, -910.170, 110.916)
  1237. AddZone("Unity Station", 1692.620, -1971.800, -20.492, 1812.620, -1932.800, 79.508)
  1238. AddZone("LVA Freight Depot", 1315.350, 1044.690, -89.084, 1375.600, 1087.630, 110.916)
  1239. AddZone("Los Flores", 2581.730, -1454.350, -89.084, 2632.830, -1393.420, 110.916)
  1240. AddZone("Starfish Casino", 2437.390, 1858.100, -39.084, 2495.090, 1970.850, 60.916)
  1241. AddZone("Easter Bay Chemicals", -1132.820, -787.391, 0.000, -956.476, -768.027, 200.000)
  1242. AddZone("Downtown Los Santos", 1370.850, -1170.870, -89.084, 1463.900, -1130.850, 110.916)
  1243. AddZone("Esplanade East", -1620.300, 1176.520, -4.5, -1580.010, 1274.260, 200.000)
  1244. AddZone("Market Station", 787.461, -1410.930, -34.126, 866.009, -1310.210, 65.874)
  1245. AddZone("Linden Station", 2811.250, 1229.590, -39.594, 2861.250, 1407.590, 60.406)
  1246. AddZone("Montgomery Intersection", 1582.440, 347.457, 0.000, 1664.620, 401.750, 200.000)
  1247. AddZone("Frederick Bridge", 2759.250, 296.501, 0.000, 2774.250, 594.757, 200.000)
  1248. AddZone("Yellow Bell Station", 1377.480, 2600.430, -21.926, 1492.450, 2687.360, 78.074)
  1249. AddZone("Downtown Los Santos", 1507.510, -1385.210, 110.916, 1582.550, -1325.310, 335.916)
  1250. AddZone("Jefferson", 2185.330, -1210.740, -89.084, 2281.450, -1154.590, 110.916)
  1251. AddZone("Mulholland", 1318.130, -910.170, -89.084, 1357.000, -768.027, 110.916)
  1252. AddZone("Avispa Country Club", -2361.510, -417.199, 0.000, -2270.040, -355.493, 200.000)
  1253. AddZone("Jefferson", 1996.910, -1449.670, -89.084, 2056.860, -1350.720, 110.916)
  1254. AddZone("Julius Thruway West", 1236.630, 2142.860, -89.084, 1297.470, 2243.230, 110.916)
  1255. AddZone("Jefferson", 2124.660, -1494.030, -89.084, 2266.210, -1449.670, 110.916)
  1256. AddZone("Julius Thruway North", 1848.400, 2478.490, -89.084, 1938.800, 2553.490, 110.916)
  1257. AddZone("Rodeo", 422.680, -1570.200, -89.084, 466.223, -1406.050, 110.916)
  1258. AddZone("Cranberry Station", -2007.830, 56.306, 0.000, -1922.000, 224.782, 100.000)
  1259. AddZone("Downtown Los Santos", 1391.050, -1026.330, -89.084, 1463.900, -926.999, 110.916)
  1260. AddZone("Redsands West", 1704.590, 2243.230, -89.084, 1777.390, 2342.830, 110.916)
  1261. AddZone("Little Mexico", 1758.900, -1722.260, -89.084, 1812.620, -1577.590, 110.916)
  1262. AddZone("Blackfield Intersection", 1375.600, 823.228, -89.084, 1457.390, 919.447, 110.916)
  1263. AddZone("Los Santos International", 1974.630, -2394.330, -39.084, 2089.000, -2256.590, 60.916)
  1264. AddZone("Beacon Hill", -399.633, -1075.520, -1.489, -319.033, -977.516, 198.511)
  1265. AddZone("Rodeo", 334.503, -1501.950, -89.084, 422.680, -1406.050, 110.916)
  1266. AddZone("Richman", 225.165, -1369.620, -89.084, 334.503, -1292.070, 110.916)
  1267. AddZone("Downtown Los Santos", 1724.760, -1250.900, -89.084, 1812.620, -1150.870, 110.916)
  1268. AddZone("The Strip", 2027.400, 1703.230, -89.084, 2137.400, 1783.230, 110.916)
  1269. AddZone("Downtown Los Santos", 1378.330, -1130.850, -89.084, 1463.900, -1026.330, 110.916)
  1270. AddZone("Blackfield Intersection", 1197.390, 1044.690, -89.084, 1277.050, 1163.390, 110.916)
  1271. AddZone("Conference Center", 1073.220, -1842.270, -89.084, 1323.900, -1804.210, 110.916)
  1272. AddZone("Montgomery", 1451.400, 347.457, -6.1, 1582.440, 420.802, 200.000)
  1273. AddZone("Foster Valley", -2270.040, -430.276, -1.2, -2178.690, -324.114, 200.000)
  1274. AddZone("Blackfield Chapel", 1325.600, 596.349, -89.084, 1375.600, 795.010, 110.916)
  1275. AddZone("Los Santos International", 2051.630, -2597.260, -39.084, 2152.450, -2394.330, 60.916)
  1276. AddZone("Mulholland", 1096.470, -910.170, -89.084, 1169.130, -768.027, 110.916)
  1277. AddZone("Yellow Bell Gol Course", 1457.460, 2723.230, -89.084, 1534.560, 2863.230, 110.916)
  1278. AddZone("The Strip", 2027.400, 1783.230, -89.084, 2162.390, 1863.230, 110.916)
  1279. AddZone("Jefferson", 2056.860, -1210.740, -89.084, 2185.330, -1126.320, 110.916)
  1280. AddZone("Mulholland", 952.604, -937.184, -89.084, 1096.470, -860.619, 110.916)
  1281. AddZone("Aldea Malvada", -1372.140, 2498.520, 0.000, -1277.590, 2615.350, 200.000)
  1282. AddZone("Las Colinas", 2126.860, -1126.320, -89.084, 2185.330, -934.489, 110.916)
  1283. AddZone("Las Colinas", 1994.330, -1100.820, -89.084, 2056.860, -920.815, 110.916)
  1284. AddZone("Richman", 647.557, -954.662, -89.084, 768.694, -860.619, 110.916)
  1285. AddZone("LVA Freight Depot", 1277.050, 1087.630, -89.084, 1375.600, 1203.280, 110.916)
  1286. AddZone("Julius Thruway North", 1377.390, 2433.230, -89.084, 1534.560, 2507.230, 110.916)
  1287. AddZone("Willowfield", 2201.820, -2095.000, -89.084, 2324.000, -1989.900, 110.916)
  1288. AddZone("Julius Thruway North", 1704.590, 2342.830, -89.084, 1848.400, 2433.230, 110.916)
  1289. AddZone("Temple", 1252.330, -1130.850, -89.084, 1378.330, -1026.330, 110.916)
  1290. AddZone("Little Mexico", 1701.900, -1842.270, -89.084, 1812.620, -1722.260, 110.916)
  1291. AddZone("Queens", -2411.220, 373.539, 0.000, -2253.540, 458.411, 200.000)
  1292. AddZone("Las Venturas Airport", 1515.810, 1586.400, -12.500, 1729.950, 1714.560, 87.500)
  1293. AddZone("Richman", 225.165, -1292.070, -89.084, 466.223, -1235.070, 110.916)
  1294. AddZone("Temple", 1252.330, -1026.330, -89.084, 1391.050, -926.999, 110.916)
  1295. AddZone("East Los Santos", 2266.260, -1494.030, -89.084, 2381.680, -1372.040, 110.916)
  1296. AddZone("Julius Thruway East", 2623.180, 943.235, -89.084, 2749.900, 1055.960, 110.916)
  1297. AddZone("Willowfield", 2541.700, -1941.400, -89.084, 2703.580, -1852.870, 110.916)
  1298. AddZone("Las Colinas", 2056.860, -1126.320, -89.084, 2126.860, -920.815, 110.916)
  1299. AddZone("Julius Thruway East", 2625.160, 2202.760, -89.084, 2685.160, 2442.550, 110.916)
  1300. AddZone("Rodeo", 225.165, -1501.950, -89.084, 334.503, -1369.620, 110.916)
  1301. AddZone("Las Brujas", -365.167, 2123.010, -3.0, -208.570, 2217.680, 200.000)
  1302. AddZone("Julius Thruway East", 2536.430, 2442.550, -89.084, 2685.160, 2542.550, 110.916)
  1303. AddZone("Rodeo", 334.503, -1406.050, -89.084, 466.223, -1292.070, 110.916)
  1304. AddZone("Vinewood", 647.557, -1227.280, -89.084, 787.461, -1118.280, 110.916)
  1305. AddZone("Rodeo", 422.680, -1684.650, -89.084, 558.099, -1570.200, 110.916)
  1306. AddZone("Julius Thruway North", 2498.210, 2542.550, -89.084, 2685.160, 2626.550, 110.916)
  1307. AddZone("Downtown Los Santos", 1724.760, -1430.870, -89.084, 1812.620, -1250.900, 110.916)
  1308. AddZone("Rodeo", 225.165, -1684.650, -89.084, 312.803, -1501.950, 110.916)
  1309. AddZone("Jefferson", 2056.860, -1449.670, -89.084, 2266.210, -1372.040, 110.916)
  1310. AddZone("Hampton Barns", 603.035, 264.312, 0.000, 761.994, 366.572, 200.000)
  1311. AddZone("Temple", 1096.470, -1130.840, -89.084, 1252.330, -1026.330, 110.916)
  1312. AddZone("Kincaid Bridge", -1087.930, 855.370, -89.084, -961.950, 986.281, 110.916)
  1313. AddZone("Verona Beach", 1046.150, -1722.260, -89.084, 1161.520, -1577.590, 110.916)
  1314. AddZone("Commerce", 1323.900, -1722.260, -89.084, 1440.900, -1577.590, 110.916)
  1315. AddZone("Mulholland", 1357.000, -926.999, -89.084, 1463.900, -768.027, 110.916)
  1316. AddZone("Rodeo", 466.223, -1570.200, -89.084, 558.099, -1385.070, 110.916)
  1317. AddZone("Mulholland", 911.802, -860.619, -89.084, 1096.470, -768.027, 110.916)
  1318. AddZone("Mulholland", 768.694, -954.662, -89.084, 952.604, -860.619, 110.916)
  1319. AddZone("Julius Thruway South", 2377.390, 788.894, -89.084, 2537.390, 897.901, 110.916)
  1320. AddZone("Idlewood", 1812.620, -1852.870, -89.084, 1971.660, -1742.310, 110.916)
  1321. AddZone("Ocean Docks", 2089.000, -2394.330, -89.084, 2201.820, -2235.840, 110.916)
  1322. AddZone("Commerce", 1370.850, -1577.590, -89.084, 1463.900, -1384.950, 110.916)
  1323. AddZone("Julius Thruway North", 2121.400, 2508.230, -89.084, 2237.400, 2663.170, 110.916)
  1324. AddZone("Temple", 1096.470, -1026.330, -89.084, 1252.330, -910.170, 110.916)
  1325. AddZone("Glen Park", 1812.620, -1449.670, -89.084, 1996.910, -1350.720, 110.916)
  1326. AddZone("Easter Bay Airport", -1242.980, -50.096, 0.000, -1213.910, 578.396, 200.000)
  1327. AddZone("Martin Bridge", -222.179, 293.324, 0.000, -122.126, 476.465, 200.000)
  1328. AddZone("The Strip", 2106.700, 1863.230, -89.084, 2162.390, 2202.760, 110.916)
  1329. AddZone("Willowfield", 2541.700, -2059.230, -89.084, 2703.580, -1941.400, 110.916)
  1330. AddZone("Marina", 807.922, -1577.590, -89.084, 926.922, -1416.250, 110.916)
  1331. AddZone("Las Venturas Airport", 1457.370, 1143.210, -89.084, 1777.400, 1203.280, 110.916)
  1332. AddZone("Idlewood", 1812.620, -1742.310, -89.084, 1951.660, -1602.310, 110.916)
  1333. AddZone("Esplanade East", -1580.010, 1025.980, -6.1, -1499.890, 1274.260, 200.000)
  1334. AddZone("Downtown Los Santos", 1370.850, -1384.950, -89.084, 1463.900, -1170.870, 110.916)
  1335. AddZone("The Mako Span", 1664.620, 401.750, 0.000, 1785.140, 567.203, 200.000)
  1336. AddZone("Rodeo", 312.803, -1684.650, -89.084, 422.680, -1501.950, 110.916)
  1337. AddZone("Pershing Square", 1440.900, -1722.260, -89.084, 1583.500, -1577.590, 110.916)
  1338. AddZone("Mulholland", 687.802, -860.619, -89.084, 911.802, -768.027, 110.916)
  1339. AddZone("Gant Bridge", -2741.070, 1490.470, -6.1, -2616.400, 1659.680, 200.000)
  1340. AddZone("Las Colinas", 2185.330, -1154.590, -89.084, 2281.450, -934.489, 110.916)
  1341. AddZone("Mulholland", 1169.130, -910.170, -89.084, 1318.130, -768.027, 110.916)
  1342. AddZone("Julius Thruway North", 1938.800, 2508.230, -89.084, 2121.400, 2624.230, 110.916)
  1343. AddZone("Commerce", 1667.960, -1577.590, -89.084, 1812.620, -1430.870, 110.916)
  1344. AddZone("Rodeo", 72.648, -1544.170, -89.084, 225.165, -1404.970, 110.916)
  1345. AddZone("Roca Escalante", 2536.430, 2202.760, -89.084, 2625.160, 2442.550, 110.916)
  1346. AddZone("Rodeo", 72.648, -1684.650, -89.084, 225.165, -1544.170, 110.916)
  1347. AddZone("Market", 952.663, -1310.210, -89.084, 1072.660, -1130.850, 110.916)
  1348. AddZone("Las Colinas", 2632.740, -1135.040, -89.084, 2747.740, -945.035, 110.916)
  1349. AddZone("Mulholland", 861.085, -674.885, -89.084, 1156.550, -600.896, 110.916)
  1350. AddZone("King's", -2253.540, 373.539, -9.1, -1993.280, 458.411, 200.000)
  1351. AddZone("Redsands East", 1848.400, 2342.830, -89.084, 2011.940, 2478.490, 110.916)
  1352. AddZone("Downtown", -1580.010, 744.267, -6.1, -1499.890, 1025.980, 200.000)
  1353. AddZone("Conference Center", 1046.150, -1804.210, -89.084, 1323.900, -1722.260, 110.916)
  1354. AddZone("Richman", 647.557, -1118.280, -89.084, 787.461, -954.662, 110.916)
  1355. AddZone("Ocean Flats", -2994.490, 277.411, -9.1, -2867.850, 458.411, 200.000)
  1356. AddZone("Greenglass College", 964.391, 930.890, -89.084, 1166.530, 1044.690, 110.916)
  1357. AddZone("Glen Park", 1812.620, -1100.820, -89.084, 1994.330, -973.380, 110.916)
  1358. AddZone("LVA Freight Depot", 1375.600, 919.447, -89.084, 1457.370, 1203.280, 110.916)
  1359. AddZone("Regular Tom", -405.770, 1712.860, -3.0, -276.719, 1892.750, 200.000)
  1360. AddZone("Verona Beach", 1161.520, -1722.260, -89.084, 1323.900, -1577.590, 110.916)
  1361. AddZone("East Los Santos", 2281.450, -1372.040, -89.084, 2381.680, -1135.040, 110.916)
  1362. AddZone("Caligula's Palace", 2137.400, 1703.230, -89.084, 2437.390, 1783.230, 110.916)
  1363. AddZone("Idlewood", 1951.660, -1742.310, -89.084, 2124.660, -1602.310, 110.916)
  1364. AddZone("Pilgrim", 2624.400, 1383.230, -89.084, 2685.160, 1783.230, 110.916)
  1365. AddZone("Idlewood", 2124.660, -1742.310, -89.084, 2222.560, -1494.030, 110.916)
  1366. AddZone("Queens", -2533.040, 458.411, 0.000, -2329.310, 578.396, 200.000)
  1367. AddZone("Downtown", -1871.720, 1176.420, -4.5, -1620.300, 1274.260, 200.000)
  1368. AddZone("Commerce", 1583.500, -1722.260, -89.084, 1758.900, -1577.590, 110.916)
  1369. AddZone("East Los Santos", 2381.680, -1454.350, -89.084, 2462.130, -1135.040, 110.916)
  1370. AddZone("Marina", 647.712, -1577.590, -89.084, 807.922, -1416.250, 110.916)
  1371. AddZone("Richman", 72.648, -1404.970, -89.084, 225.165, -1235.070, 110.916)
  1372. AddZone("Vinewood", 647.712, -1416.250, -89.084, 787.461, -1227.280, 110.916)
  1373. AddZone("East Los Santos", 2222.560, -1628.530, -89.084, 2421.030, -1494.030, 110.916)
  1374. AddZone("Rodeo", 558.099, -1684.650, -89.084, 647.522, -1384.930, 110.916)
  1375. AddZone("Easter Tunnel", -1709.710, -833.034, -1.5, -1446.010, -730.118, 200.000)
  1376. AddZone("Rodeo", 466.223, -1385.070, -89.084, 647.522, -1235.070, 110.916)
  1377. AddZone("Redsands East", 1817.390, 2202.760, -89.084, 2011.940, 2342.830, 110.916)
  1378. AddZone("The Clown's Pocket", 2162.390, 1783.230, -89.084, 2437.390, 1883.230, 110.916)
  1379. AddZone("Idlewood", 1971.660, -1852.870, -89.084, 2222.560, -1742.310, 110.916)
  1380. AddZone("Montgomery Intersection", 1546.650, 208.164, 0.000, 1745.830, 347.457, 200.000)
  1381. AddZone("Willowfield", 2089.000, -2235.840, -89.084, 2201.820, -1989.900, 110.916)
  1382. AddZone("Temple", 952.663, -1130.840, -89.084, 1096.470, -937.184, 110.916)
  1383. AddZone("Prickle Pine", 1848.400, 2553.490, -89.084, 1938.800, 2863.230, 110.916)
  1384. AddZone("Los Santos International", 1400.970, -2669.260, -39.084, 2189.820, -2597.260, 60.916)
  1385. AddZone("Garver Bridge", -1213.910, 950.022, -89.084, -1087.930, 1178.930, 110.916)
  1386. AddZone("Garver Bridge", -1339.890, 828.129, -89.084, -1213.910, 1057.040, 110.916)
  1387. AddZone("Kincaid Bridge", -1339.890, 599.218, -89.084, -1213.910, 828.129, 110.916)
  1388. AddZone("Kincaid Bridge", -1213.910, 721.111, -89.084, -1087.930, 950.022, 110.916)
  1389. AddZone("Verona Beach", 930.221, -2006.780, -89.084, 1073.220, -1804.210, 110.916)
  1390. AddZone("Verdant Bluffs", 1073.220, -2006.780, -89.084, 1249.620, -1842.270, 110.916)
  1391. AddZone("Vinewood", 787.461, -1130.840, -89.084, 952.604, -954.662, 110.916)
  1392. AddZone("Vinewood", 787.461, -1310.210, -89.084, 952.663, -1130.840, 110.916)
  1393. AddZone("Commerce", 1463.900, -1577.590, -89.084, 1667.960, -1430.870, 110.916)
  1394. AddZone("Market", 787.461, -1416.250, -89.084, 1072.660, -1310.210, 110.916)
  1395. AddZone("Rockshore West", 2377.390, 596.349, -89.084, 2537.390, 788.894, 110.916)
  1396. AddZone("Julius Thruway North", 2237.400, 2542.550, -89.084, 2498.210, 2663.170, 110.916)
  1397. AddZone("East Beach", 2632.830, -1668.130, -89.084, 2747.740, -1393.420, 110.916)
  1398. AddZone("Fallow Bridge", 434.341, 366.572, 0.000, 603.035, 555.680, 200.000)
  1399. AddZone("Willowfield", 2089.000, -1989.900, -89.084, 2324.000, -1852.870, 110.916)
  1400. AddZone("Chinatown", -2274.170, 578.396, -7.6, -2078.670, 744.170, 200.000)
  1401. AddZone("El Castillo del Diablo", -208.570, 2337.180, 0.000, 8.430, 2487.180, 200.000)
  1402. AddZone("Ocean Docks", 2324.000, -2145.100, -89.084, 2703.580, -2059.230, 110.916)
  1403. AddZone("Easter Bay Chemicals", -1132.820, -768.027, 0.000, -956.476, -578.118, 200.000)
  1404. AddZone("The Visage", 1817.390, 1703.230, -89.084, 2027.400, 1863.230, 110.916)
  1405. AddZone("Ocean Flats", -2994.490, -430.276, -1.2, -2831.890, -222.589, 200.000)
  1406. AddZone("Richman", 321.356, -860.619, -89.084, 687.802, -768.027, 110.916)
  1407. AddZone("Green Palms", 176.581, 1305.450, -3.0, 338.658, 1520.720, 200.000)
  1408. AddZone("Richman", 321.356, -768.027, -89.084, 700.794, -674.885, 110.916)
  1409. AddZone("Starfish Casino", 2162.390, 1883.230, -89.084, 2437.390, 2012.180, 110.916)
  1410. AddZone("East Beach", 2747.740, -1668.130, -89.084, 2959.350, -1498.620, 110.916)
  1411. AddZone("Jefferson", 2056.860, -1372.040, -89.084, 2281.450, -1210.740, 110.916)
  1412. AddZone("Downtown Los Santos", 1463.900, -1290.870, -89.084, 1724.760, -1150.870, 110.916)
  1413. AddZone("Downtown Los Santos", 1463.900, -1430.870, -89.084, 1724.760, -1290.870, 110.916)
  1414. AddZone("Garver Bridge", -1499.890, 696.442, -179.615, -1339.890, 925.353, 20.385)
  1415. AddZone("Julius Thruway South", 1457.390, 823.228, -89.084, 2377.390, 863.229, 110.916)
  1416. AddZone("East Los Santos", 2421.030, -1628.530, -89.084, 2632.830, -1454.350, 110.916)
  1417. AddZone("Greenglass College", 964.391, 1044.690, -89.084, 1197.390, 1203.220, 110.916)
  1418. AddZone("Las Colinas", 2747.740, -1120.040, -89.084, 2959.350, -945.035, 110.916)
  1419. AddZone("Mulholland", 737.573, -768.027, -89.084, 1142.290, -674.885, 110.916)
  1420. AddZone("Ocean Docks", 2201.820, -2730.880, -89.084, 2324.000, -2418.330, 110.916)
  1421. AddZone("East Los Santos", 2462.130, -1454.350, -89.084, 2581.730, -1135.040, 110.916)
  1422. AddZone("Ganton", 2222.560, -1722.330, -89.084, 2632.830, -1628.530, 110.916)
  1423. AddZone("Avispa Country Club", -2831.890, -430.276, -6.1, -2646.400, -222.589, 200.000)
  1424. AddZone("Willowfield", 1970.620, -2179.250, -89.084, 2089.000, -1852.870, 110.916)
  1425. AddZone("Esplanade North", -1982.320, 1274.260, -4.5, -1524.240, 1358.900, 200.000)
  1426. AddZone("The High Roller", 1817.390, 1283.230, -89.084, 2027.390, 1469.230, 110.916)
  1427. AddZone("Ocean Docks", 2201.820, -2418.330, -89.084, 2324.000, -2095.000, 110.916)
  1428. AddZone("Last Dime Motel", 1823.080, 596.349, -89.084, 1997.220, 823.228, 110.916)
  1429. AddZone("Bayside Marina", -2353.170, 2275.790, 0.000, -2153.170, 2475.790, 200.000)
  1430. AddZone("King's", -2329.310, 458.411, -7.6, -1993.280, 578.396, 200.000)
  1431. AddZone("El Corona", 1692.620, -2179.250, -89.084, 1812.620, -1842.270, 110.916)
  1432. AddZone("Blackfield Chapel", 1375.600, 596.349, -89.084, 1558.090, 823.228, 110.916)
  1433. AddZone("The Pink Swan", 1817.390, 1083.230, -89.084, 2027.390, 1283.230, 110.916)
  1434. AddZone("Julius Thruway West", 1197.390, 1163.390, -89.084, 1236.630, 2243.230, 110.916)
  1435. AddZone("Los Flores", 2581.730, -1393.420, -89.084, 2747.740, -1135.040, 110.916)
  1436. AddZone("The Visage", 1817.390, 1863.230, -89.084, 2106.700, 2011.830, 110.916)
  1437. AddZone("Prickle Pine", 1938.800, 2624.230, -89.084, 2121.400, 2861.550, 110.916)
  1438. AddZone("Verona Beach", 851.449, -1804.210, -89.084, 1046.150, -1577.590, 110.916)
  1439. AddZone("Robada Intersection", -1119.010, 1178.930, -89.084, -862.025, 1351.450, 110.916)
  1440. AddZone("Linden Side", 2749.900, 943.235, -89.084, 2923.390, 1198.990, 110.916)
  1441. AddZone("Ocean Docks", 2703.580, -2302.330, -89.084, 2959.350, -2126.900, 110.916)
  1442. AddZone("Willowfield", 2324.000, -2059.230, -89.084, 2541.700, -1852.870, 110.916)
  1443. AddZone("King's", -2411.220, 265.243, -9.1, -1993.280, 373.539, 200.000)
  1444. AddZone("Commerce", 1323.900, -1842.270, -89.084, 1701.900, -1722.260, 110.916)
  1445. AddZone("Mulholland", 1269.130, -768.027, -89.084, 1414.070, -452.425, 110.916)
  1446. AddZone("Marina", 647.712, -1804.210, -89.084, 851.449, -1577.590, 110.916)
  1447. AddZone("Battery Point", -2741.070, 1268.410, -4.5, -2533.040, 1490.470, 200.000)
  1448. AddZone("The Four Dragons Casino", 1817.390, 863.232, -89.084, 2027.390, 1083.230, 110.916)
  1449. AddZone("Blackfield", 964.391, 1203.220, -89.084, 1197.390, 1403.220, 110.916)
  1450. AddZone("Julius Thruway North", 1534.560, 2433.230, -89.084, 1848.400, 2583.230, 110.916)
  1451. AddZone("Yellow Bell Gol Course", 1117.400, 2723.230, -89.084, 1457.460, 2863.230, 110.916)
  1452. AddZone("Idlewood", 1812.620, -1602.310, -89.084, 2124.660, -1449.670, 110.916)
  1453. AddZone("Redsands West", 1297.470, 2142.860, -89.084, 1777.390, 2243.230, 110.916)
  1454. AddZone("Doherty", -2270.040, -324.114, -1.2, -1794.920, -222.589, 200.000)
  1455. AddZone("Hilltop Farm", 967.383, -450.390, -3.0, 1176.780, -217.900, 200.000)
  1456. AddZone("Las Barrancas", -926.130, 1398.730, -3.0, -719.234, 1634.690, 200.000)
  1457. AddZone("Pirates in Men's Pants", 1817.390, 1469.230, -89.084, 2027.400, 1703.230, 110.916)
  1458. AddZone("City Hall", -2867.850, 277.411, -9.1, -2593.440, 458.411, 200.000)
  1459. AddZone("Avispa Country Club", -2646.400, -355.493, 0.000, -2270.040, -222.589, 200.000)
  1460. AddZone("The Strip", 2027.400, 863.229, -89.084, 2087.390, 1703.230, 110.916)
  1461. AddZone("Hashbury", -2593.440, -222.589, -1.0, -2411.220, 54.722, 200.000)
  1462. AddZone("Los Santos International", 1852.000, -2394.330, -89.084, 2089.000, -2179.250, 110.916)
  1463. AddZone("Whitewood Estates", 1098.310, 1726.220, -89.084, 1197.390, 2243.230, 110.916)
  1464. AddZone("Sherman Reservoir", -789.737, 1659.680, -89.084, -599.505, 1929.410, 110.916)
  1465. AddZone("El Corona", 1812.620, -2179.250, -89.084, 1970.620, -1852.870, 110.916)
  1466. AddZone("Downtown", -1700.010, 744.267, -6.1, -1580.010, 1176.520, 200.000)
  1467. AddZone("Foster Valley", -2178.690, -1250.970, 0.000, -1794.920, -1115.580, 200.000)
  1468. AddZone("Las Payasadas", -354.332, 2580.360, 2.0, -133.625, 2816.820, 200.000)
  1469. AddZone("Valle Ocultado", -936.668, 2611.440, 2.0, -715.961, 2847.900, 200.000)
  1470. AddZone("Blackfield Intersection", 1166.530, 795.010, -89.084, 1375.600, 1044.690, 110.916)
  1471. AddZone("Ganton", 2222.560, -1852.870, -89.084, 2632.830, -1722.330, 110.916)
  1472. AddZone("Easter Bay Airport", -1213.910, -730.118, 0.000, -1132.820, -50.096, 200.000)
  1473. AddZone("Redsands East", 1817.390, 2011.830, -89.084, 2106.700, 2202.760, 110.916)
  1474. AddZone("Esplanade East", -1499.890, 578.396, -79.615, -1339.890, 1274.260, 20.385)
  1475. AddZone("Caligula's Palace", 2087.390, 1543.230, -89.084, 2437.390, 1703.230, 110.916)
  1476. AddZone("Royal Casino", 2087.390, 1383.230, -89.084, 2437.390, 1543.230, 110.916)
  1477. AddZone("Richman", 72.648, -1235.070, -89.084, 321.356, -1008.150, 110.916)
  1478. AddZone("Starfish Casino", 2437.390, 1783.230, -89.084, 2685.160, 2012.180, 110.916)
  1479. AddZone("Mulholland", 1281.130, -452.425, -89.084, 1641.130, -290.913, 110.916)
  1480. AddZone("Downtown", -1982.320, 744.170, -6.1, -1871.720, 1274.260, 200.000)
  1481. AddZone("Hankypanky Point", 2576.920, 62.158, 0.000, 2759.250, 385.503, 200.000)
  1482. AddZone("K.A.C.C. Military Fuels", 2498.210, 2626.550, -89.084, 2749.900, 2861.550, 110.916)
  1483. AddZone("Harry Gold Parkway", 1777.390, 863.232, -89.084, 1817.390, 2342.830, 110.916)
  1484. AddZone("Bayside Tunnel", -2290.190, 2548.290, -89.084, -1950.190, 2723.290, 110.916)
  1485. AddZone("Ocean Docks", 2324.000, -2302.330, -89.084, 2703.580, -2145.100, 110.916)
  1486. AddZone("Richman", 321.356, -1044.070, -89.084, 647.557, -860.619, 110.916)
  1487. AddZone("Randolph Industrial Estate", 1558.090, 596.349, -89.084, 1823.080, 823.235, 110.916)
  1488. AddZone("East Beach", 2632.830, -1852.870, -89.084, 2959.350, -1668.130, 110.916)
  1489. AddZone("Flint Water", -314.426, -753.874, -89.084, -106.339, -463.073, 110.916)
  1490. AddZone("Blueberry", 19.607, -404.136, 3.8, 349.607, -220.137, 200.000)
  1491. AddZone("Linden Station", 2749.900, 1198.990, -89.084, 2923.390, 1548.990, 110.916)
  1492. AddZone("Glen Park", 1812.620, -1350.720, -89.084, 2056.860, -1100.820, 110.916)
  1493. AddZone("Downtown", -1993.280, 265.243, -9.1, -1794.920, 578.396, 200.000)
  1494. AddZone("Redsands West", 1377.390, 2243.230, -89.084, 1704.590, 2433.230, 110.916)
  1495. AddZone("Richman", 321.356, -1235.070, -89.084, 647.522, -1044.070, 110.916)
  1496. AddZone("Gant Bridge", -2741.450, 1659.680, -6.1, -2616.400, 2175.150, 200.000)
  1497. AddZone("Lil' Probe Inn", -90.218, 1286.850, -3.0, 153.859, 1554.120, 200.000)
  1498. AddZone("Flint Intersection", -187.700, -1596.760, -89.084, 17.063, -1276.600, 110.916)
  1499. AddZone("Las Colinas", 2281.450, -1135.040, -89.084, 2632.740, -945.035, 110.916)
  1500. AddZone("Sobell Rail Yards", 2749.900, 1548.990, -89.084, 2923.390, 1937.250, 110.916)
  1501. AddZone("The Emerald Isle", 2011.940, 2202.760, -89.084, 2237.400, 2508.230, 110.916)
  1502. AddZone("El Castillo del Diablo", -208.570, 2123.010, -7.6, 114.033, 2337.180, 200.000)
  1503. AddZone("Santa Flora", -2741.070, 458.411, -7.6, -2533.040, 793.411, 200.000)
  1504. AddZone("Playa del Seville", 2703.580, -2126.900, -89.084, 2959.350, -1852.870, 110.916)
  1505. AddZone("Market", 926.922, -1577.590, -89.084, 1370.850, -1416.250, 110.916)
  1506. AddZone("Queens", -2593.440, 54.722, 0.000, -2411.220, 458.411, 200.000)
  1507. AddZone("Pilson Intersection", 1098.390, 2243.230, -89.084, 1377.390, 2507.230, 110.916)
  1508. AddZone("Spinybed", 2121.400, 2663.170, -89.084, 2498.210, 2861.550, 110.916)
  1509. AddZone("Pilgrim", 2437.390, 1383.230, -89.084, 2624.400, 1783.230, 110.916)
  1510. AddZone("Blackfield", 964.391, 1403.220, -89.084, 1197.390, 1726.220, 110.916)
  1511. AddZone("'The Big Ear'", -410.020, 1403.340, -3.0, -137.969, 1681.230, 200.000)
  1512. AddZone("Dillimore", 580.794, -674.885, -9.5, 861.085, -404.790, 200.000)
  1513. AddZone("El Quebrados", -1645.230, 2498.520, 0.000, -1372.140, 2777.850, 200.000)
  1514. AddZone("Esplanade North", -2533.040, 1358.900, -4.5, -1996.660, 1501.210, 200.000)
  1515. AddZone("Easter Bay Airport", -1499.890, -50.096, -1.0, -1242.980, 249.904, 200.000)
  1516. AddZone("Fisher's Lagoon", 1916.990, -233.323, -100.000, 2131.720, 13.800, 200.000)
  1517. AddZone("Mulholland", 1414.070, -768.027, -89.084, 1667.610, -452.425, 110.916)
  1518. AddZone("East Beach", 2747.740, -1498.620, -89.084, 2959.350, -1120.040, 110.916)
  1519. AddZone("San Andreas Sound", 2450.390, 385.503, -100.000, 2759.250, 562.349, 200.000)
  1520. AddZone("Shady Creeks", -2030.120, -2174.890, -6.1, -1820.640, -1771.660, 200.000)
  1521. AddZone("Market", 1072.660, -1416.250, -89.084, 1370.850, -1130.850, 110.916)
  1522. AddZone("Rockshore West", 1997.220, 596.349, -89.084, 2377.390, 823.228, 110.916)
  1523. AddZone("Prickle Pine", 1534.560, 2583.230, -89.084, 1848.400, 2863.230, 110.916)
  1524. AddZone("Easter Basin", -1794.920, -50.096, -1.04, -1499.890, 249.904, 200.000)
  1525. AddZone("Leafy Hollow", -1166.970, -1856.030, 0.000, -815.624, -1602.070, 200.000)
  1526. AddZone("LVA Freight Depot", 1457.390, 863.229, -89.084, 1777.400, 1143.210, 110.916)
  1527. AddZone("Prickle Pine", 1117.400, 2507.230, -89.084, 1534.560, 2723.230, 110.916)
  1528. AddZone("Blueberry", 104.534, -220.137, 2.3, 349.607, 152.236, 200.000)
  1529. AddZone("El Castillo del Diablo", -464.515, 2217.680, 0.000, -208.570, 2580.360, 200.000)
  1530. AddZone("Downtown", -2078.670, 578.396, -7.6, -1499.890, 744.267, 200.000)
  1531. AddZone("Rockshore East", 2537.390, 676.549, -89.084, 2902.350, 943.235, 110.916)
  1532. AddZone("San Fierro Bay", -2616.400, 1501.210, -3.0, -1996.660, 1659.680, 200.000)
  1533. AddZone("Paradiso", -2741.070, 793.411, -6.1, -2533.040, 1268.410, 200.000)
  1534. AddZone("The Camel's Toe", 2087.390, 1203.230, -89.084, 2640.400, 1383.230, 110.916)
  1535. AddZone("Old Venturas Strip", 2162.390, 2012.180, -89.084, 2685.160, 2202.760, 110.916)
  1536. AddZone("Juniper Hill", -2533.040, 578.396, -7.6, -2274.170, 968.369, 200.000)
  1537. AddZone("Juniper Hollow", -2533.040, 968.369, -6.1, -2274.170, 1358.900, 200.000)
  1538. AddZone("Roca Escalante", 2237.400, 2202.760, -89.084, 2536.430, 2542.550, 110.916)
  1539. AddZone("Julius Thruway East", 2685.160, 1055.960, -89.084, 2749.900, 2626.550, 110.916)
  1540. AddZone("Verona Beach", 647.712, -2173.290, -89.084, 930.221, -1804.210, 110.916)
  1541. AddZone("Foster Valley", -2178.690, -599.884, -1.2, -1794.920, -324.114, 200.000)
  1542. AddZone("Arco del Oeste", -901.129, 2221.860, 0.000, -592.090, 2571.970, 200.000)
  1543. AddZone("Fallen Tree", -792.254, -698.555, -5.3, -452.404, -380.043, 200.000)
  1544. AddZone("The Farm", -1209.670, -1317.100, 114.981, -908.161, -787.391, 251.981)
  1545. AddZone("The Sherman Dam", -968.772, 1929.410, -3.0, -481.126, 2155.260, 200.000)
  1546. AddZone("Esplanade North", -1996.660, 1358.900, -4.5, -1524.240, 1592.510, 200.000)
  1547. AddZone("Financial", -1871.720, 744.170, -6.1, -1701.300, 1176.420, 300.000)
  1548. AddZone("Garcia", -2411.220, -222.589, -1.14, -2173.040, 265.243, 200.000)
  1549. AddZone("Montgomery", 1119.510, 119.526, -3.0, 1451.400, 493.323, 200.000)
  1550. AddZone("Creek", 2749.900, 1937.250, -89.084, 2921.620, 2669.790, 110.916)
  1551. AddZone("Los Santos International", 1249.620, -2394.330, -89.084, 1852.000, -2179.250, 110.916)
  1552. AddZone("Santa Maria Beach", 72.648, -2173.290, -89.084, 342.648, -1684.650, 110.916)
  1553. AddZone("Mulholland Intersection", 1463.900, -1150.870, -89.084, 1812.620, -768.027, 110.916)
  1554. AddZone("Angel Pine", -2324.940, -2584.290, -6.1, -1964.220, -2212.110, 200.000)
  1555. AddZone("Verdant Meadows", 37.032, 2337.180, -3.0, 435.988, 2677.900, 200.000)
  1556. AddZone("Octane Springs", 338.658, 1228.510, 0.000, 664.308, 1655.050, 200.000)
  1557. AddZone("Come-A-Lot", 2087.390, 943.235, -89.084, 2623.180, 1203.230, 110.916)
  1558. AddZone("Redsands West", 1236.630, 1883.110, -89.084, 1777.390, 2142.860, 110.916)
  1559. AddZone("Santa Maria Beach", 342.648, -2173.290, -89.084, 647.712, -1684.650, 110.916)
  1560. AddZone("Verdant Bluffs", 1249.620, -2179.250, -89.084, 1692.620, -1842.270, 110.916)
  1561. AddZone("Las Venturas Airport", 1236.630, 1203.280, -89.084, 1457.370, 1883.110, 110.916)
  1562. AddZone("Flint Range", -594.191, -1648.550, 0.000, -187.700, -1276.600, 200.000)
  1563. AddZone("Verdant Bluffs", 930.221, -2488.420, -89.084, 1249.620, -2006.780, 110.916)
  1564. AddZone("Palomino Creek", 2160.220, -149.004, 0.000, 2576.920, 228.322, 200.000)
  1565. AddZone("Ocean Docks", 2373.770, -2697.090, -89.084, 2809.220, -2330.460, 110.916)
  1566. AddZone("Easter Bay Airport", -1213.910, -50.096, -4.5, -947.980, 578.396, 200.000)
  1567. AddZone("Whitewood Estates", 883.308, 1726.220, -89.084, 1098.310, 2507.230, 110.916)
  1568. AddZone("Calton Heights", -2274.170, 744.170, -6.1, -1982.320, 1358.900, 200.000)
  1569. AddZone("Easter Basin", -1794.920, 249.904, -9.1, -1242.980, 578.396, 200.000)
  1570. AddZone("Los Santos Inlet", -321.744, -2224.430, -89.084, 44.615, -1724.430, 110.916)
  1571. AddZone("Doherty", -2173.040, -222.589, -1.0, -1794.920, 265.243, 200.000)
  1572. AddZone("Mount Chiliad", -2178.690, -2189.910, -47.917, -2030.120, -1771.660, 576.083)
  1573. AddZone("Fort Carson", -376.233, 826.326, -3.0, 123.717, 1220.440, 200.000)
  1574. AddZone("Foster Valley", -2178.690, -1115.580, 0.000, -1794.920, -599.884, 200.000)
  1575. AddZone("Ocean Flats", -2994.490, -222.589, -1.0, -2593.440, 277.411, 200.000)
  1576. AddZone("Fern Ridge", 508.189, -139.259, 0.000, 1306.660, 119.526, 200.000)
  1577. AddZone("Bayside", -2741.070, 2175.150, 0.000, -2353.170, 2722.790, 200.000)
  1578. AddZone("Las Venturas Airport", 1457.370, 1203.280, -89.084, 1777.390, 1883.110, 110.916)
  1579. AddZone("Blueberry Acres", -319.676, -220.137, 0.000, 104.534, 293.324, 200.000)
  1580. AddZone("Palisades", -2994.490, 458.411, -6.1, -2741.070, 1339.610, 200.000)
  1581. AddZone("North Rock", 2285.370, -768.027, 0.000, 2770.590, -269.740, 200.000)
  1582. AddZone("Hunter Quarry", 337.244, 710.840, -115.239, 860.554, 1031.710, 203.761)
  1583. AddZone("Los Santos International", 1382.730, -2730.880, -89.084, 2201.820, -2394.330, 110.916)
  1584. AddZone("Missionary Hill", -2994.490, -811.276, 0.000, -2178.690, -430.276, 200.000)
  1585. AddZone("San Fierro Bay", -2616.400, 1659.680, -3.0, -1996.660, 2175.150, 200.000)
  1586. AddZone("Restricted Area", -91.586, 1655.050, -50.000, 421.234, 2123.010, 250.000)
  1587. AddZone("Mount Chiliad", -2997.470, -1115.580, -47.917, -2178.690, -971.913, 576.083)
  1588. AddZone("Mount Chiliad", -2178.690, -1771.660, -47.917, -1936.120, -1250.970, 576.083)
  1589. AddZone("Easter Bay Airport", -1794.920, -730.118, -3.0, -1213.910, -50.096, 200.000)
  1590. AddZone("The Panopticon", -947.980, -304.320, -1.1, -319.676, 327.071, 200.000)
  1591. AddZone("Shady Creeks", -1820.640, -2643.680, -8.0, -1226.780, -1771.660, 200.000)
  1592. AddZone("Back o Beyond", -1166.970, -2641.190, 0.000, -321.744, -1856.030, 200.000)
  1593. AddZone("Mount Chiliad", -2994.490, -2189.910, -47.917, -2178.690, -1115.580, 576.083)
  1594. AddZone("Tierra Robada", -1213.910, 596.349, -242.990, -480.539, 1659.680, 900.000)
  1595. AddZone("Flint County", -1213.910, -2892.970, -242.990, 44.615, -768.027, 900.000)
  1596. AddZone("Whetstone", -2997.470, -2892.970, -242.990, -1213.910, -1115.580, 900.000)
  1597. AddZone("Bone County", -480.539, 596.349, -242.990, 869.461, 2993.870, 900.000)
  1598. AddZone("Tierra Robada", -2997.470, 1659.680, -242.990, -480.539, 2993.870, 900.000)
  1599. AddZone("San Fierro", -2997.470, -1115.580, -242.990, -1213.910, 1659.680, 900.000)
  1600. AddZone("Las Venturas", 869.461, 596.349, -242.990, 2997.060, 2993.870, 900.000)
  1601. AddZone("Red County", -1213.910, -768.027, -242.990, 2997.060, 596.349, 900.000)
  1602. AddZone("Los Santos", 44.615, -2892.970, -242.990, 2997.060, -768.027, 900.000)
  1603. }
  1604.  
  1605. ; internal stuff
  1606. AddZone(sName, x1, y1, z1, x2, y2, z2) {
  1607. global
  1608. zone%nZone%_name := sName
  1609. zone%nZone%_x1 := x1
  1610. zone%nZone%_y1 := y1
  1611. zone%nZone%_z1 := z1
  1612. zone%nZone%_x2 := x2
  1613. zone%nZone%_y2 := y2
  1614. zone%nZone%_z2 := z2
  1615. nZone := nZone + 1
  1616. }
  1617.  
  1618. ; internal stuff
  1619. AddCity(sName, x1, y1, z1, x2, y2, z2) {
  1620. global
  1621. city%nCity%_name := sName
  1622. city%nCity%_x1 := x1
  1623. city%nCity%_y1 := y1
  1624. city%nCity%_z1 := z1
  1625. city%nCity%_x2 := x2
  1626. city%nCity%_y2 := y2
  1627. city%nCity%_z2 := z2
  1628. nCity := nCity + 1
  1629. }
  1630.  
  1631. ; ##### Memory Stuff #####
  1632.  
  1633. ; internal stuff
  1634. checkHandles() {
  1635. if(iRefreshHandles+500>A_TickCount)
  1636. return true
  1637. iRefreshHandles:=A_TickCount
  1638. if(!refreshGTA() || !refreshSAMP() || !refreshMemory()) {
  1639. return false
  1640. } else {
  1641. return true
  1642. }
  1643.  
  1644. return true
  1645. }
  1646.  
  1647. ; internal stuff
  1648. hahapisser = AndersonBeschterMann
  1649. refreshGTA() {
  1650. newPID := getPID("GTA:SA:MP")
  1651. if(!newPID) { ; GTA not found
  1652. if(hGTA) { ; open handle
  1653. virtualFreeEx(hGTA, pMemory, 0, 0x8000)
  1654. closeProcess(hGTA)
  1655. hGTA := 0x0
  1656. }
  1657. dwGTAPID := 0
  1658. hGTA := 0x0
  1659. dwSAMP := 0x0
  1660. pMemory := 0x0
  1661. return false
  1662. }
  1663.  
  1664. if(!hGTA || (dwGTAPID != newPID)) { ; changed PID, closed handle
  1665. hGTA := openProcess(newPID)
  1666. if(ErrorLevel) { ; openProcess fail
  1667. dwGTAPID := 0
  1668. hGTA := 0x0
  1669. dwSAMP := 0x0
  1670. pMemory := 0x0
  1671. return false
  1672. }
  1673. dwGTAPID := newPID
  1674. dwSAMP := 0x0
  1675. pMemory := 0x0
  1676. return true
  1677. }
  1678. return true
  1679. }
  1680.  
  1681. ; internal stuff
  1682. refreshSAMP() {
  1683. if(dwSAMP)
  1684. return true
  1685.  
  1686. dwSAMP := getModuleBaseAddress("samp.dll", hGTA)
  1687. if(!dwSAMP)
  1688. return false
  1689.  
  1690. return true
  1691. }
  1692.  
  1693. ; internal stuff
  1694. refreshMemory() {
  1695. if(!pMemory) {
  1696. pMemory := virtualAllocEx(hGTA, 4096, 0x1000 | 0x2000, 0x40)
  1697. if(ErrorLevel) {
  1698. pMemory := 0x0
  1699. return false
  1700. }
  1701. pParam1 := pMemory
  1702. pParam2 := pMemory + 1024
  1703. pParam3 := pMemory + 2048
  1704. pInjectFunc := pMemory + 3072
  1705. }
  1706. return true
  1707. }
  1708.  
  1709. ; internal stuff
  1710. getPID(szWindow) {
  1711. local dwPID := 0
  1712. WinGet, dwPID, PID, %szWindow%
  1713. return dwPID
  1714. }
  1715.  
  1716. ; internal stuff
  1717. openProcess(dwPID, dwRights = 0x1F0FFF) {
  1718. hProcess := DllCall("OpenProcess"
  1719. , "UInt", dwRights
  1720. , "int", 0
  1721. , "UInt", dwPID
  1722. , "Uint")
  1723. if(hProcess == 0) {
  1724. ErrorLevel := ERROR_OPEN_PROCESS
  1725. return 0
  1726. }
  1727.  
  1728. ErrorLevel := ERROR_OK
  1729. return hProcess
  1730. }
  1731.  
  1732. ; internal stuff
  1733. closeProcess(hProcess) {
  1734. if(hProcess == 0) {
  1735. ErrorLevel := ERROR_INVALID_HANDLE
  1736. return 0
  1737. }
  1738.  
  1739. dwRet := DllCall( "CloseHandle"
  1740. , "Uint", hProcess
  1741. , "UInt")
  1742. ErrorLevel := ERROR_OK
  1743. }
  1744.  
  1745. ; internal stuff
  1746. getModuleBaseAddress(sModule, hProcess) {
  1747. if(!sModule) {
  1748. ErrorLevel := ERROR_MODULE_NOT_FOUND
  1749. return 0
  1750. }
  1751.  
  1752. if(!hProcess) {
  1753. ErrorLevel := ERROR_INVALID_HANDLE
  1754. return 0
  1755. }
  1756.  
  1757. dwSize = 1024*4 ; 1024 * sizeof(HMODULE = 4)
  1758. VarSetCapacity(hMods, dwSize)
  1759. VarSetCapacity(cbNeeded, 4) ; DWORD = 4
  1760. dwRet := DllCall( "Psapi.dll\EnumProcessModules"
  1761. , "UInt", hProcess
  1762. , "UInt", &hMods
  1763. , "UInt", dwSize
  1764. , "UInt*", cbNeeded
  1765. , "UInt")
  1766. if(dwRet == 0) {
  1767. ErrorLevel := ERROR_ENUM_PROCESS_MODULES
  1768. return 0
  1769. }
  1770.  
  1771. dwMods := cbNeeded / 4 ; cbNeeded / sizeof(HMDOULE = 4)
  1772. i := 0
  1773. VarSetCapacity(hModule, 4) ; HMODULE = 4
  1774. VarSetCapacity(sCurModule, 260) ; MAX_PATH = 260
  1775. while(i < dwMods) {
  1776. hModule := NumGet(hMods, i*4)
  1777. DllCall("Psapi.dll\GetModuleFileNameEx"
  1778. , "UInt", hProcess
  1779. , "UInt", hModule
  1780. , "Str", sCurModule
  1781. , "UInt", 260)
  1782. SplitPath, sCurModule, sFilename
  1783. if(sModule == sFilename) {
  1784. ErrorLevel := ERROR_OK
  1785. return hModule
  1786. }
  1787. i := i + 1
  1788. }
  1789.  
  1790. ErrorLevel := ERROR_MODULE_NOT_FOUND
  1791. return 0
  1792. }
  1793.  
  1794. ; internal stuff
  1795. readString(hProcess, dwAddress, dwLen) {
  1796. if(!hProcess) {
  1797. ErrorLevel := ERROR_INVALID_HANDLE
  1798. return 0
  1799. }
  1800.  
  1801. VarSetCapacity(sRead, dwLen)
  1802. dwRet := DllCall( "ReadProcessMemory"
  1803. , "UInt", hProcess
  1804. , "UInt", dwAddress
  1805. , "Str", sRead
  1806. , "UInt", dwLen
  1807. , "UInt*", 0
  1808. , "UInt")
  1809. if(dwRet == 0) {
  1810. ErrorLevel := ERROR_READ_MEMORY
  1811. return 0
  1812. }
  1813.  
  1814. ErrorLevel := ERROR_OK
  1815. if A_IsUnicode
  1816. return __ansiToUnicode(sRead)
  1817. return sRead
  1818. }
  1819.  
  1820. ; internal stuff
  1821. readFloat(hProcess, dwAddress) {
  1822. if(!hProcess) {
  1823. ErrorLevel := ERROR_INVALID_HANDLE
  1824. return 0
  1825. }
  1826.  
  1827. VarSetCapacity(dwRead, 4) ; float = 4
  1828. dwRet := DllCall( "ReadProcessMemory"
  1829. , "UInt", hProcess
  1830. , "UInt", dwAddress
  1831. , "Str", dwRead
  1832. , "UInt", 4
  1833. , "UInt*", 0
  1834. , "UInt")
  1835. if(dwRet == 0) {
  1836. ErrorLevel := ERROR_READ_MEMORY
  1837. return 0
  1838. }
  1839.  
  1840. ErrorLevel := ERROR_OK
  1841. return NumGet(dwRead, 0, "Float")
  1842. }
  1843.  
  1844. ; internal stuff
  1845. readDWORD(hProcess, dwAddress) {
  1846. if(!hProcess) {
  1847. ErrorLevel := ERROR_INVALID_HANDLE
  1848. return 0
  1849. }
  1850.  
  1851. VarSetCapacity(dwRead, 4) ; DWORD = 4
  1852. dwRet := DllCall( "ReadProcessMemory"
  1853. , "UInt", hProcess
  1854. , "UInt", dwAddress
  1855. , "Str", dwRead
  1856. , "UInt", 4
  1857. , "UInt*", 0)
  1858. if(dwRet == 0) {
  1859. ErrorLevel := ERROR_READ_MEMORY
  1860. return 0
  1861. }
  1862.  
  1863. ErrorLevel := ERROR_OK
  1864. return NumGet(dwRead, 0, "UInt")
  1865. }
  1866.  
  1867. ; internal stuff
  1868. readMem(hProcess, dwAddress, dwLen=4, type="UInt") {
  1869. if(!hProcess) {
  1870. ErrorLevel := ERROR_INVALID_HANDLE
  1871. return 0
  1872. }
  1873.  
  1874. VarSetCapacity(dwRead, dwLen)
  1875. dwRet := DllCall( "ReadProcessMemory"
  1876. , "UInt", hProcess
  1877. , "UInt", dwAddress
  1878. , "Str", dwRead
  1879. , "UInt", dwLen
  1880. , "UInt*", 0)
  1881. if(dwRet == 0) {
  1882. ErrorLevel := ERROR_READ_MEMORY
  1883. return 0
  1884. }
  1885.  
  1886. ErrorLevel := ERROR_OK
  1887. return NumGet(dwRead, 0, type)
  1888. }
  1889.  
  1890. ; internal stuff
  1891. writeString(hProcess, dwAddress, wString) {
  1892. if(!hProcess) {
  1893. ErrorLevel := ERROR_INVALID_HANDLE
  1894. return false
  1895. }
  1896.  
  1897. sString := wString
  1898. if A_IsUnicode
  1899. sString := __unicodeToAnsi(wString)
  1900.  
  1901. dwRet := DllCall( "WriteProcessMemory"
  1902. , "UInt", hProcess
  1903. , "UInt", dwAddress
  1904. , "Str", sString
  1905. , "UInt", StrLen(wString) + 1
  1906. , "UInt", 0
  1907. , "UInt")
  1908. if(dwRet == 0) {
  1909. ErrorLEvel := ERROR_WRITE_MEMORY
  1910. return false
  1911. }
  1912.  
  1913. ErrorLevel := ERROR_OK
  1914. return true
  1915. }
  1916.  
  1917. ; internal stuff
  1918. writeRaw(hProcess, dwAddress, pBuffer, dwLen) {
  1919. if(!hProcess) {
  1920. ErrorLevel := ERROR_INVALID_HANDLE
  1921. return false
  1922. }
  1923.  
  1924. dwRet := DllCall( "WriteProcessMemory"
  1925. , "UInt", hProcess
  1926. , "UInt", dwAddress
  1927. , "UInt", pBuffer
  1928. , "UInt", dwLen
  1929. , "UInt", 0
  1930. , "UInt")
  1931. if(dwRet == 0) {
  1932. ErrorLEvel := ERROR_WRITE_MEMORY
  1933. return false
  1934. }
  1935.  
  1936. ErrorLevel := ERROR_OK
  1937. return true
  1938. }
  1939.  
  1940. ; internal stuff
  1941. callWithParams(hProcess, dwFunc, aParams, bCleanupStack = true) {
  1942. if(!hProcess) {
  1943. ErrorLevel := ERROR_INVALID_HANDLE
  1944. return false
  1945. }
  1946. validParams := 0
  1947.  
  1948. i := aParams.MaxIndex()
  1949.  
  1950. ; i * PUSH + CALL + RETN
  1951. dwLen := i * 5 + 5 + 1
  1952. if(bCleanupStack)
  1953. dwLen += 3
  1954. VarSetCapacity(injectData, i * 5 + 5 + 3 + 1, 0)
  1955.  
  1956. i_ := 1
  1957. while(i > 0) {
  1958. if(aParams[i][1] != "") {
  1959. dwMemAddress := 0x0
  1960. if(aParams[i][1] == "p") {
  1961. dwMemAddress := aParams[i][2]
  1962. } else if(aParams[i][1] == "s") {
  1963. if(i_>3)
  1964. return false
  1965. dwMemAddress := pParam%i_%
  1966. writeString(hProcess, dwMemAddress, aParams[i][2])
  1967. if(ErrorLevel)
  1968. return false
  1969. i_ += 1
  1970. } else if(aParams[i][1] == "i") {
  1971. dwMemAddress := aParams[i][2]
  1972. } else {
  1973. return false
  1974. }
  1975. NumPut(0x68, injectData, validParams * 5, "UChar")
  1976. NumPut(dwMemAddress, injectData, validParams * 5 + 1, "UInt")
  1977. validParams += 1
  1978. }
  1979. i -= 1
  1980. }
  1981.  
  1982. offset := dwFunc - ( pInjectFunc + validParams * 5 + 5 )
  1983. NumPut(0xE8, injectData, validParams * 5, "UChar")
  1984. NumPut(offset, injectData, validParams * 5 + 1, "Int")
  1985.  
  1986. if(bCleanupStack) {
  1987. NumPut(0xC483, injectData, validParams * 5 + 5, "UShort")
  1988. NumPut(validParams*4, injectData, validParams * 5 + 7, "UChar")
  1989.  
  1990. NumPut(0xC3, injectData, validParams * 5 + 8, "UChar")
  1991. } else {
  1992. NumPut(0xC3, injectData, validParams * 5 + 5, "UChar")
  1993. }
  1994.  
  1995. writeRaw(hGTA, pInjectFunc, &injectData, dwLen)
  1996. if(ErrorLevel)
  1997. return false
  1998.  
  1999. hThread := createRemoteThread(hGTA, 0, 0, pInjectFunc, 0, 0, 0)
  2000. if(ErrorLevel)
  2001. return false
  2002.  
  2003. waitForSingleObject(hThread, 0xFFFFFFFF)
  2004.  
  2005. closeProcess(hThread)
  2006.  
  2007. return true
  2008. }
  2009.  
  2010. ; internal stuff
  2011. virtualAllocEx(hProcess, dwSize, flAllocationType, flProtect) {
  2012. if(!hProcess) {
  2013. ErrorLevel := ERROR_INVALID_HANDLE
  2014. return 0
  2015. }
  2016.  
  2017. dwRet := DllCall( "VirtualAllocEx"
  2018. , "UInt", hProcess
  2019. , "UInt", 0
  2020. , "UInt", dwSize
  2021. , "UInt", flAllocationType
  2022. , "UInt", flProtect
  2023. , "UInt")
  2024. if(dwRet == 0) {
  2025. ErrorLEvel := ERROR_ALLOC_MEMORY
  2026. return 0
  2027. }
  2028.  
  2029. ErrorLevel := ERROR_OK
  2030. return dwRet
  2031. }
  2032.  
  2033. ; internal stuff
  2034. virtualFreeEx(hProcess, lpAddress, dwSize, dwFreeType) {
  2035. if(!hProcess) {
  2036. ErrorLevel := ERROR_INVALID_HANDLE
  2037. return 0
  2038. }
  2039.  
  2040. dwRet := DllCall( "VirtualFreeEx"
  2041. , "UInt", hProcess
  2042. , "UInt", lpAddress
  2043. , "UInt", dwSize
  2044. , "UInt", dwFreeType
  2045. , "UInt")
  2046. if(dwRet == 0) {
  2047. ErrorLEvel := ERROR_FREE_MEMORY
  2048. return 0
  2049. }
  2050.  
  2051. ErrorLevel := ERROR_OK
  2052. return dwRet
  2053. }
  2054.  
  2055. ; internal stuff
  2056. createRemoteThread(hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId) {
  2057. if(!hProcess) {
  2058. ErrorLevel := ERROR_INVALID_HANDLE
  2059. return 0
  2060. }
  2061.  
  2062. dwRet := DllCall( "CreateRemoteThread"
  2063. , "UInt", hProcess
  2064. , "UInt", lpThreadAttributes
  2065. , "UInt", dwStackSize
  2066. , "UInt", lpStartAddress
  2067. , "UInt", lpParameter
  2068. , "UInt", dwCreationFlags
  2069. , "UInt", lpThreadId
  2070. , "UInt")
  2071. if(dwRet == 0) {
  2072. ErrorLEvel := ERROR_ALLOC_MEMORY
  2073. return 0
  2074. }
  2075.  
  2076. ErrorLevel := ERROR_OK
  2077. return dwRet
  2078. }
  2079.  
  2080. ; internal stuff
  2081. waitForSingleObject(hThread, dwMilliseconds) {
  2082. if(!hThread) {
  2083. ErrorLevel := ERROR_INVALID_HANDLE
  2084. return 0
  2085. }
  2086.  
  2087. dwRet := DllCall( "WaitForSingleObject"
  2088. , "UInt", hThread
  2089. , "UInt", dwMilliseconds
  2090. , "UInt")
  2091. if(dwRet == 0xFFFFFFFF) {
  2092. ErrorLEvel := ERROR_WAIT_FOR_OBJECT
  2093. return 0
  2094. }
  2095.  
  2096. ErrorLevel := ERROR_OK
  2097. return dwRet
  2098. }
  2099.  
  2100. ; internal stuff
  2101. __ansiToUnicode(sString, nLen = 0) {
  2102. If !nLen
  2103. {
  2104. nLen := DllCall("MultiByteToWideChar"
  2105. , "Uint", 0
  2106. , "Uint", 0
  2107. , "Uint", &sString
  2108. , "int", -1
  2109. , "Uint", 0
  2110. , "int", 0)
  2111. }
  2112.  
  2113. VarSetCapacity(wString, nLen * 2)
  2114.  
  2115. DllCall("MultiByteToWideChar"
  2116. , "Uint", 0
  2117. , "Uint", 0
  2118. , "Uint", &sString
  2119. , "int", -1
  2120. , "Uint", &wString
  2121. , "int", nLen)
  2122.  
  2123. return wString
  2124. }
  2125.  
  2126. ; internal stuff
  2127. __unicodeToAnsi(wString, nLen = 0) {
  2128. pString := wString + 1 > 65536 ? wString : &wString
  2129.  
  2130. If !nLen
  2131. {
  2132. nLen := DllCall("WideCharToMultiByte"
  2133. , "Uint", 0
  2134. , "Uint", 0
  2135. , "Uint", pString
  2136. , "int", -1
  2137. , "Uint", 0
  2138. , "int", 0
  2139. , "Uint", 0
  2140. , "Uint", 0)
  2141. }
  2142.  
  2143. VarSetCapacity(sString, nLen)
  2144.  
  2145. DllCall("WideCharToMultiByte"
  2146. , "Uint", 0
  2147. , "Uint", 0
  2148. , "Uint", pString
  2149. , "int", -1
  2150. , "str", sString
  2151. , "int", nLen
  2152. , "Uint", 0
  2153. , "Uint", 0)
  2154. return sString
  2155. }
  2156.  
  2157. IsPlayerInAnyInterrior()
  2158. {
  2159. HWND := OpenMemoryFromTitle("GTA:SA:MP")
  2160. address := ReadMemory(HWND,0xB6F5F0,int,4,0)
  2161. address := ReadMemory(HWND,address,"byte",4,0x2F)
  2162. ;~ DllCall("CloseHandle", "UInt", HWND)
  2163. if(address == 0)
  2164. {
  2165. return false
  2166. }
  2167. else
  2168. {
  2169. return true
  2170. }
  2171. }
  2172. ;-------------------------------------------------------------------------------------------
  2173.  
  2174.  
  2175. GetCityName(ByRef City) {
  2176. coords := getcoordinates()
  2177. City := CalculateCity(coords[1], coords[2], coords[3])
  2178. return City
  2179. }
  2180.  
  2181. GetZoneName(ByRef Zone) {
  2182. coords := getcoordinates()
  2183. Zone := CalculateZone(coords[1], coords[2], coords[3])
  2184. return Zone
  2185. }
  2186.  
  2187. UrlDownloadToVar(URL, Proxy="", ProxyBypass="") {
  2188. AutoTrim, Off
  2189. hModule := DllCall("LoadLibrary", "str", "wininet.dll")
  2190.  
  2191. If (Proxy != "")
  2192. AccessType=3
  2193. Else
  2194. AccessType=1
  2195. ;INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
  2196. ;INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
  2197. ;INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
  2198. ;INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
  2199.  
  2200. io_hInternet := DllCall("wininet\InternetOpenA"
  2201. , "str", "" ;lpszAgent
  2202. , "uint", AccessType
  2203. , "str", Proxy
  2204. , "str", ProxyBypass
  2205. , "uint", 0) ;dwFlags
  2206.  
  2207. iou := DllCall("wininet\InternetOpenUrlA"
  2208. , "uint", io_hInternet
  2209. , "str", url
  2210. , "str", "" ;lpszHeaders
  2211. , "uint", 0 ;dwHeadersLength
  2212. , "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
  2213. , "uint", 0) ;dwContext
  2214.  
  2215. If (ErrorLevel != 0 or iou = 0) {
  2216. DllCall("FreeLibrary", "uint", hModule)
  2217. return 0
  2218. }
  2219.  
  2220. VarSetCapacity(buffer, 512, 0)
  2221. VarSetCapacity(NumberOfBytesRead, 4, 0)
  2222. Loop
  2223. {
  2224. irf := DllCall("wininet\InternetReadFile", "uint", iou, "uint", &buffer, "uint", 512, "uint", &NumberOfBytesRead)
  2225. NOBR = 0
  2226. Loop 4 ; Build the integer by adding up its bytes. - ExtractInteger
  2227. NOBR += *(&NumberOfBytesRead + A_Index-1) << 8*(A_Index-1)
  2228. IfEqual, NOBR, 0, break
  2229. ;BytesReadTotal += NOBR
  2230. DllCall("lstrcpy", "str", buffer, "uint", &buffer)
  2231. res = %res%%buffer%
  2232. }
  2233. ; StringTrimRight, res, res, 2
  2234.  
  2235. DllCall("wininet\InternetCloseHandle", "uint", iou)
  2236. DllCall("wininet\InternetCloseHandle", "uint", io_hInternet)
  2237. DllCall("FreeLibrary", "uint", hModule)
  2238. AutoTrim, on
  2239. return, res
  2240. }
  2241.  
  2242.  
  2243. GetVehicleSeatState(seat)
  2244. {
  2245. HWND := OpenMemoryFromTitle("GTA:SA:MP")
  2246. address := ReadMemory(HWND,0xBA18FC,int,4,0)
  2247. ;~ DllCall("CloseHandle", "UInt", HWND)
  2248. if(seat == 1)
  2249. {
  2250. address := ReadMemory(HWND,address,"int",4,0x464)
  2251. }
  2252. else if(seat == 2)
  2253. {
  2254. address := ReadMemory(HWND,address,"int",4,0x468)
  2255. }
  2256. else if(seat == 3)
  2257. {
  2258. address := ReadMemory(HWND,address,"int",4,0x46C)
  2259. }
  2260. if(address == 0)
  2261. {
  2262. return false
  2263. }
  2264. else
  2265. {
  2266. return true
  2267. }
  2268. return address
  2269. }
  2270.  
  2271. GetPlayerPos(ByRef fX,ByRef fY,ByRef fZ) {
  2272. if(!checkHandles())
  2273. return 0
  2274.  
  2275. fX := readFloat(hGTA, ADDR_POSITION_X)
  2276. if(ErrorLevel) {
  2277. ErrorLevel := ERROR_READ_MEMORY
  2278. return 0
  2279. }
  2280.  
  2281. fY := readFloat(hGTA, ADDR_POSITION_Y)
  2282. if(ErrorLevel) {
  2283. ErrorLevel := ERROR_READ_MEMORY
  2284. return 0
  2285. }
  2286.  
  2287. fZ := readFloat(hGTA, ADDR_POSITION_Z)
  2288. if(ErrorLevel) {
  2289. ErrorLevel := ERROR_READ_MEMORY
  2290. return 0
  2291. }
  2292.  
  2293. ErrorLevel := ERROR_OK
  2294. }
  2295.  
  2296. IsPlayerInRangeOfPoint(_posX, _posY, _posZ, _posRadius)
  2297. {
  2298. GetPlayerPos(posX, posY, posZ)
  2299. X := posX -_posX
  2300. Y := posY -_posY
  2301. Z := posZ -_posZ
  2302. if(((X < _posRadius) && (X > -_posRadius)) && ((Y < _posRadius) && (Y > -_posRadius)) && ((Z < _posRadius) && (Z > -_posRadius)))
  2303. return TRUE
  2304. return FALSE
  2305. }
  2306.  
  2307. IsPlayerInRangeOfPoint2D(_posX, _posY, _posRadius)
  2308. {
  2309. GetPlayerPos(posX, posY, posZ)
  2310. X := posX - _posX
  2311. Y := posY - _posY
  2312. if(((X < _posRadius) && (X > -_posRadius)) && ((Y < _posRadius) && (Y > -_posRadius)))
  2313. return TRUE
  2314. return FALSE
  2315. }
  2316.  
  2317. getchatline(Line, ByRef Output, timestamp=0, color=0){
  2318. chatindex := 0
  2319. FileRead, file, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
  2320. loop, Parse, file, `n, `r
  2321. {
  2322. if(A_LoopField)
  2323. chatindex := A_Index
  2324. }
  2325. loop, Parse, file, `n, `r
  2326. {
  2327. if(A_Index = chatindex - line){
  2328. output := A_LoopField
  2329. break
  2330. }
  2331. }
  2332. file := ""
  2333. if(!timestamp)
  2334. output := RegExReplace(output, "U)^\[\d{2}:\d{2}:\d{2}\]")
  2335. if(!color)
  2336. output := RegExReplace(output, "Ui)\{[a-f0-9]{6}\}")
  2337. return
  2338. }
  2339.  
  2340. getlogline(Line, ByRef Output, timestamp=0, color=0){
  2341. chatindex := 0
  2342. FileRead, file, %A_MyDocuments%\GTA San Andreas User Files\SAMP\log.txt
  2343. loop, Parse, file, `n, `r
  2344. {
  2345. if(A_LoopField)
  2346. chatindex := A_Index
  2347. }
  2348. loop, Parse, file, `n, `r
  2349. {
  2350. if(A_Index = chatindex - line){
  2351. output := A_LoopField
  2352. break
  2353. }
  2354. }
  2355. file := ""
  2356. if(!timestamp)
  2357. output := RegExReplace(output, "U)^\[\d{2}:\d{2}:\d{2}\]")
  2358. if(!color)
  2359. output := RegExReplace(output, "Ui)\{[a-f0-9]{6}\}")
  2360. return
  2361. }
  2362.  
  2363.  
  2364. getgametext(Line, ByRef Output, timestamp=0, color=0){
  2365. chatindex := 0
  2366. FileRead, file, %A_MyDocuments%\GTA San Andreas User Files\SAMP\gametexts.txt
  2367. loop, Parse, file, `n, `r
  2368. {
  2369. if(A_LoopField)
  2370. chatindex := A_Index
  2371. }
  2372. loop, Parse, file, `n, `r
  2373. {
  2374. if(A_Index = chatindex - line){
  2375. output := A_LoopField
  2376. break
  2377. }
  2378. }
  2379. file := ""
  2380. if(!timestamp)
  2381. output := RegExReplace(output, "U)^\[\d{2}:\d{2}:\d{2}\]")
  2382. if(!color)
  2383. output := RegExReplace(output, "Ui)\{[a-f0-9]{6}\}")
  2384. return
  2385. }
  2386.  
  2387. OpenMemoryfromTitle(title,right=0x1F0FFF)
  2388. {
  2389. WinGet,PID,PID,%title%
  2390. HWND := DllCall("OpenProcess","Uint",right,"int",0,"int",PID)
  2391. return HWND
  2392. }
  2393.  
  2394. ReadMemory(hwnd,address,datatype="int",length=4,offset=0)
  2395. {
  2396. VarSetCapacity(readvalue,length, 0)
  2397. DllCall("ReadProcessMemory","Uint",hwnd,"Uint",address+offset,"Str",readvalue,"Uint",length,"Uint *",0)
  2398. finalvalue := NumGet(readvalue,0,datatype)
  2399. return finalvalue
  2400. }
  2401.  
  2402.  
  2403. ~space::
  2404. if(isInChat())
  2405. return
  2406. if(IsPlayerInAnyVehicle())
  2407. return
  2408. if(checklaufscript = 0)
  2409. return
  2410. Loop
  2411. {
  2412. Sleep, 40
  2413. If !GetKeyState("space", "p")
  2414. break
  2415. SendInput {SPACE down}
  2416. sleep, 20
  2417. SendInput {SPACE up}
  2418. sleep, 20
  2419. }
  2420. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement