arrestpoints.pwn 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Dynamic Arrestpoint System
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. stock LoadArrestPoint(id)
  34. {
  35. new string[128];
  36. mysql_format(MainPipeline, string, sizeof(string), "SELECT * FROM `arrestpoints` WHERE `id`=%d", id);
  37. mysql_tquery(MainPipeline, string, "OnLoadArrestPoint", "i", id);
  38. }
  39. stock LoadArrestPoints()
  40. {
  41. printf("[LoadArrestPoints] Loading data from database...");
  42. mysql_tquery(MainPipeline, "SELECT * FROM `arrestpoints`", "OnLoadArrestPoints", "");
  43. }
  44. forward OnLoadArrestPoint(index);
  45. public OnLoadArrestPoint(index)
  46. {
  47. new rows;
  48. szMiscArray[0] = 0;
  49. cache_get_row_count(rows);
  50. for(new row; row < rows; row++)
  51. {
  52. cache_get_value_name_int(row, "id", ArrestPoints[index][arrestSQLId]);
  53. cache_get_value_name_float(row, "PosX", ArrestPoints[index][arrestPosX]);
  54. cache_get_value_name_float(row, "PosY", ArrestPoints[index][arrestPosY]);
  55. cache_get_value_name_float(row, "PosZ", ArrestPoints[index][arrestPosZ]);
  56. cache_get_value_name_int(row, "VW", ArrestPoints[index][arrestVW]);
  57. cache_get_value_name_int(row, "Int", ArrestPoints[index][arrestInt]);
  58. cache_get_value_name_int(row, "Type", ArrestPoints[index][arrestType]);
  59. if(ArrestPoints[index][arrestPosX] != 0)
  60. {
  61. switch(ArrestPoints[index][arrestType])
  62. {
  63. case 0:
  64. {
  65. format(szMiscArray, sizeof(szMiscArray), "/arrest\nArrest Point #%d", index);
  66. ArrestPoints[index][arrestTextID] = CreateDynamic3DTextLabel(szMiscArray, COLOR_DBLUE, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[index][arrestVW], ArrestPoints[index][arrestInt], -1);
  67. ArrestPoints[index][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ], ArrestPoints[index][arrestVW]);
  68. }
  69. case 2:
  70. {
  71. format(szMiscArray, sizeof(szMiscArray), "/docarrest\nArrest Point #%d", index);
  72. ArrestPoints[index][arrestTextID] = CreateDynamic3DTextLabel(szMiscArray, COLOR_DBLUE, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[index][arrestVW], ArrestPoints[index][arrestInt], -1);
  73. ArrestPoints[index][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ], ArrestPoints[index][arrestVW]);
  74. }
  75. case 3:
  76. {
  77. format(szMiscArray, sizeof(szMiscArray), "/warrantarrest\nArrest Point #%d", index);
  78. ArrestPoints[index][arrestTextID] = CreateDynamic3DTextLabel(szMiscArray, COLOR_DBLUE, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[index][arrestVW], ArrestPoints[index][arrestInt], -1);
  79. ArrestPoints[index][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ], ArrestPoints[index][arrestVW]);
  80. }
  81. case 4:
  82. {
  83. format(szMiscArray, sizeof(szMiscArray), "/jarrest\nArrest Point #%d", index);
  84. ArrestPoints[index][arrestTextID] = CreateDynamic3DTextLabel(szMiscArray, COLOR_DBLUE, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[index][arrestVW], ArrestPoints[index][arrestInt], -1);
  85. ArrestPoints[index][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[index][arrestPosX], ArrestPoints[index][arrestPosY], ArrestPoints[index][arrestPosZ], ArrestPoints[index][arrestVW]);
  86. }
  87. }
  88. }
  89. }
  90. return 1;
  91. }
  92. forward OnLoadArrestPoints();
  93. public OnLoadArrestPoints()
  94. {
  95. new i, rows;
  96. szMiscArray[0] = 0;
  97. cache_get_row_count(rows);
  98. while(i < rows)
  99. {
  100. /*ArrestPoints[i][arrestSQLId] = cache_get_field_content_int(i, "id", MainPipeline);
  101. ArrestPoints[i][arrestPosX] = cache_get_field_content_float(i, "PosX", MainPipeline);
  102. ArrestPoints[i][arrestPosY] = cache_get_field_content_float(i, "PosY", MainPipeline);
  103. ArrestPoints[i][arrestPosZ] = cache_get_field_content_float(i, "PosZ", MainPipeline);
  104. ArrestPoints[i][arrestVW] = cache_get_field_content_int(i, "VW", MainPipeline);
  105. ArrestPoints[i][arrestInt] = cache_get_field_content_int(i, "Int", MainPipeline);
  106. ArrestPoints[i][arrestType] = cache_get_field_content_int(i, "Type", MainPipeline);
  107. ArrestPoints[i][jailVW] = cache_get_field_content_int(i, "jailVW", MainPipeline);
  108. ArrestPoints[i][jailInt] = cache_get_field_content_int(i, "jailInt", MainPipeline);
  109. ArrestPoints[i][JailPos1][0] = cache_get_field_content_float(i, "jailpos1x", MainPipeline);
  110. ArrestPoints[i][JailPos1][1] = cache_get_field_content_float(i, "jailpos1y", MainPipeline);
  111. ArrestPoints[i][JailPos1][2] = cache_get_field_content_float(i, "jailpos1z", MainPipeline);
  112. ArrestPoints[i][JailPos2][0] = cache_get_field_content_float(i, "jailpos2x", MainPipeline);
  113. ArrestPoints[i][JailPos2][1] = cache_get_field_content_float(i, "jailpos2y", MainPipeline);
  114. ArrestPoints[i][JailPos2][2] = cache_get_field_content_float(i, "jailpos2z", MainPipeline);
  115. if(ArrestPoints[i][arrestPosX] != 0)
  116. {
  117. switch(ArrestPoints[i][arrestType])
  118. {
  119. case 0:
  120. {
  121. format(szMiscArray, sizeof(szMiscArray), "/arrest\nArrest Point #%d", i);
  122. ArrestPoints[i][arrestTextID] = CreateDynamic3DTextLabel(szMiscArray, COLOR_DBLUE, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[i][arrestVW], ArrestPoints[i][arrestInt], -1);
  123. ArrestPoints[i][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ], ArrestPoints[i][arrestVW]);
  124. }
  125. case 2:
  126. {
  127. format(szMiscArray, sizeof(szMiscArray), "/docarrest\nArrest Point #%d", i);
  128. ArrestPoints[i][arrestTextID] = CreateDynamic3DTextLabel(szMiscArray, COLOR_DBLUE, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[i][arrestVW], ArrestPoints[i][arrestInt], -1);
  129. ArrestPoints[i][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ], ArrestPoints[i][arrestVW]);
  130. }
  131. case 3:
  132. {
  133. format(szMiscArray, sizeof(szMiscArray), "/warrantarrest\nArrest Point #%d", i);
  134. ArrestPoints[i][arrestTextID] = CreateDynamic3DTextLabel(szMiscArray, COLOR_DBLUE, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[i][arrestVW], ArrestPoints[i][arrestInt], -1);
  135. ArrestPoints[i][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ], ArrestPoints[i][arrestVW]);
  136. }
  137. case 4:
  138. {
  139. format(szMiscArray, sizeof(szMiscArray), "/jarrest\nArrest Point #%d", i);
  140. ArrestPoints[i][arrestTextID] = CreateDynamic3DTextLabel(szMiscArray, COLOR_DBLUE, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[i][arrestVW], ArrestPoints[i][arrestInt], -1);
  141. ArrestPoints[i][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[i][arrestPosX], ArrestPoints[i][arrestPosY], ArrestPoints[i][arrestPosZ], ArrestPoints[i][arrestVW]);
  142. }
  143. }
  144. }*/
  145. LoadArrestPoint(i);
  146. i++;
  147. }
  148. }
  149. stock SaveArrestPoint(id)
  150. {
  151. new string[1024];
  152. mysql_format(MainPipeline, string, sizeof(string), "UPDATE `arrestpoints` SET \
  153. `PosX`=%f, \
  154. `PosY`=%f, \
  155. `PosZ`=%f, \
  156. `VW`=%d, \
  157. `Int`=%d, \
  158. `Type`=%d, \
  159. `jailVW`=%d, \
  160. `jailInt`=%d, \
  161. `jailpos1x`=%f, \
  162. `jailpos1y`=%f, \
  163. `jailpos1z`=%f, \
  164. `jailpos2x`=%f, \
  165. `jailpos2y`=%f, \
  166. `jailpos2z`=%f WHERE `id`=%d",
  167. ArrestPoints[id][arrestPosX],
  168. ArrestPoints[id][arrestPosY],
  169. ArrestPoints[id][arrestPosZ],
  170. ArrestPoints[id][arrestVW],
  171. ArrestPoints[id][arrestInt],
  172. ArrestPoints[id][arrestType],
  173. ArrestPoints[id][jailVW],
  174. ArrestPoints[id][jailInt],
  175. ArrestPoints[id][JailPos1][0],
  176. ArrestPoints[id][JailPos1][1],
  177. ArrestPoints[id][JailPos1][2],
  178. ArrestPoints[id][JailPos2][0],
  179. ArrestPoints[id][JailPos2][1],
  180. ArrestPoints[id][JailPos2][2],
  181. id
  182. );
  183. mysql_tquery(MainPipeline, string, "OnQueryFinish", "i", SENDDATA_THREAD);
  184. }
  185. stock SaveArrestPoints()
  186. {
  187. for(new i = 0; i < MAX_ARRESTPOINTS; i++)
  188. {
  189. SaveArrestPoint(i);
  190. }
  191. return 1;
  192. }
  193. stock RehashArrestPoint(id)
  194. {
  195. DestroyDynamic3DTextLabel(ArrestPoints[id][arrestTextID]);
  196. DestroyDynamicPickup(ArrestPoints[id][arrestPickupID]);
  197. ArrestPoints[id][arrestSQLId] = -1;
  198. ArrestPoints[id][arrestPosX] = 0.0;
  199. ArrestPoints[id][arrestPosY] = 0.0;
  200. ArrestPoints[id][arrestPosZ] = 0.0;
  201. ArrestPoints[id][arrestVW] = 0;
  202. ArrestPoints[id][arrestInt] = 0;
  203. ArrestPoints[id][arrestType] = 0;
  204. LoadArrestPoint(id);
  205. }
  206. stock RehashArrestPoints()
  207. {
  208. printf("[RehashArrestPoints] Deleting Arrest Points from server...");
  209. for(new i = 0; i < MAX_ARRESTPOINTS; i++)
  210. {
  211. RehashArrestPoint(i);
  212. }
  213. LoadArrestPoints();
  214. }
  215. GetArrestPointID(playerid) {
  216. new a = -1;
  217. for(new x = 0; x < MAX_ARRESTPOINTS; x++)
  218. {
  219. if(IsPlayerInRangeOfPoint(playerid, 8.0, ArrestPoints[x][arrestPosX], ArrestPoints[x][arrestPosY], ArrestPoints[x][arrestPosZ]) && GetPlayerInterior(playerid) == ArrestPoints[x][arrestInt] && GetPlayerVirtualWorld(playerid) == ArrestPoints[x][arrestVW])
  220. {
  221. a = x;
  222. break;
  223. }
  224. }
  225. return a;
  226. }
  227. stock IsAtArrestPoint(playerid, type)
  228. {
  229. if(IsPlayerConnected(playerid))
  230. {
  231. for(new x; x < MAX_ARRESTPOINTS; x++)
  232. {
  233. if(ArrestPoints[x][arrestPosX] != 0)
  234. {
  235. if(ArrestPoints[x][arrestType] == type)
  236. {
  237. switch(ArrestPoints[x][arrestType])
  238. {
  239. case 0:
  240. {
  241. if(IsPlayerInRangeOfPoint(playerid, 4.0, ArrestPoints[x][arrestPosX], ArrestPoints[x][arrestPosY], ArrestPoints[x][arrestPosZ]) && GetPlayerInterior(playerid) == ArrestPoints[x][arrestInt] && GetPlayerVirtualWorld(playerid) == ArrestPoints[x][arrestVW]) return 1;
  242. }
  243. case 1:
  244. {
  245. if(IsPlayerInRangeOfPoint(playerid, 50.0, ArrestPoints[x][arrestPosX], ArrestPoints[x][arrestPosY], ArrestPoints[x][arrestPosZ]) && GetPlayerInterior(playerid) == ArrestPoints[x][arrestInt] && GetPlayerVirtualWorld(playerid) == ArrestPoints[x][arrestVW]) return 1;
  246. }
  247. case 2:
  248. {
  249. if(IsPlayerInRangeOfPoint(playerid, 10.0, ArrestPoints[x][arrestPosX], ArrestPoints[x][arrestPosY], ArrestPoints[x][arrestPosZ]) && GetPlayerInterior(playerid) == ArrestPoints[x][arrestInt] && GetPlayerVirtualWorld(playerid) == ArrestPoints[x][arrestVW]) return 1;
  250. }
  251. case 3:
  252. {
  253. if(IsPlayerInRangeOfPoint(playerid, 4.0, ArrestPoints[x][arrestPosX], ArrestPoints[x][arrestPosY], ArrestPoints[x][arrestPosZ]) && GetPlayerInterior(playerid) == ArrestPoints[x][arrestInt] && GetPlayerVirtualWorld(playerid) == ArrestPoints[x][arrestVW]) return 1;
  254. }
  255. case 4:
  256. {
  257. if(IsPlayerInRangeOfPoint(playerid, 4.0, ArrestPoints[x][arrestPosX], ArrestPoints[x][arrestPosY], ArrestPoints[x][arrestPosZ]) && GetPlayerInterior(playerid) == ArrestPoints[x][arrestInt] && GetPlayerVirtualWorld(playerid) == ArrestPoints[x][arrestVW]) return 1;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. }
  264. return 0;
  265. }
  266. CMD:arrestedit(playerid, params[])
  267. {
  268. if (PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  269. {
  270. new string[128], choice[32], id, amount;
  271. if(sscanf(params, "s[32]dD", choice, id, amount))
  272. {
  273. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /arrestedit [name] [id] [amount]");
  274. SendClientMessageEx(playerid, COLOR_GREY, "Available names: Position, Type, jailpos1, jailpos2, Delete");
  275. return 1;
  276. }
  277. if(id >= MAX_ARRESTPOINTS)
  278. {
  279. SendClientMessageEx(playerid, COLOR_WHITE, "Invalid Arrest Points ID!");
  280. return 1;
  281. }
  282. if(strcmp(choice, "position", true) == 0)
  283. {
  284. GetPlayerPos(playerid, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]);
  285. ArrestPoints[id][arrestInt] = GetPlayerInterior(playerid);
  286. ArrestPoints[id][arrestVW] = GetPlayerVirtualWorld(playerid);
  287. format(string, sizeof(string), "You have changed the position on Arrest Point #%d.", id);
  288. SendClientMessageEx(playerid, COLOR_WHITE, string);
  289. DestroyDynamic3DTextLabel(ArrestPoints[id][arrestTextID]);
  290. DestroyDynamicPickup(ArrestPoints[id][arrestPickupID]);
  291. switch(ArrestPoints[id][arrestType])
  292. {
  293. case 0:
  294. {
  295. format(string, sizeof(string), "/arrest\nArrest Point #%d", id);
  296. ArrestPoints[id][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[id][arrestVW], ArrestPoints[id][arrestInt], -1);
  297. ArrestPoints[id][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ], ArrestPoints[id][arrestVW]);
  298. }
  299. case 2:
  300. {
  301. format(string, sizeof(string), "/docarrest\nArrest Point #%d", id);
  302. ArrestPoints[id][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[id][arrestVW], ArrestPoints[id][arrestInt], -1);
  303. ArrestPoints[id][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ], ArrestPoints[id][arrestVW]);
  304. }
  305. case 3:
  306. {
  307. format(string, sizeof(string), "/warrantarrest\nArrest Point #%d", id);
  308. ArrestPoints[id][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[id][arrestVW], ArrestPoints[id][arrestInt], -1);
  309. ArrestPoints[id][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ], ArrestPoints[id][arrestVW]);
  310. }
  311. case 4:
  312. {
  313. format(string, sizeof(string), "/jarrest\nArrest Point #%d", id);
  314. ArrestPoints[id][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[id][arrestVW], ArrestPoints[id][arrestInt], -1);
  315. ArrestPoints[id][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ], ArrestPoints[id][arrestVW]);
  316. }
  317. }
  318. SaveArrestPoint(id);
  319. format(string, sizeof(string), "%s has edited Arrest Point ID %d's position.", GetPlayerNameEx(playerid), id);
  320. Log("logs/arrestedit.log", string);
  321. return 1;
  322. }
  323. else if(strcmp(choice, "type", true) == 0)
  324. {
  325. if(ArrestPoints[id][arrestPosX] == 0)
  326. {
  327. format(string, sizeof(string), "Arrest Point #%d does not exist.", id);
  328. SendClientMessageEx(playerid, COLOR_WHITE, string);
  329. return 1;
  330. }
  331. ArrestPoints[id][arrestType] = amount;
  332. format(string, sizeof(string), "You have changed the type for Arrest Point #%d to %d.", id, amount);
  333. SendClientMessageEx(playerid, COLOR_WHITE, string);
  334. DestroyDynamic3DTextLabel(ArrestPoints[id][arrestTextID]);
  335. DestroyDynamicPickup(ArrestPoints[id][arrestPickupID]);
  336. switch(ArrestPoints[id][arrestType])
  337. {
  338. case 0:
  339. {
  340. format(string, sizeof(string), "/arrest\nArrest Point #%d", id);
  341. ArrestPoints[id][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[id][arrestVW], ArrestPoints[id][arrestInt], -1);
  342. ArrestPoints[id][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ], ArrestPoints[id][arrestVW]);
  343. }
  344. case 2:
  345. {
  346. format(string, sizeof(string), "/docarrest\nArrest Point #%d", id);
  347. ArrestPoints[id][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[id][arrestVW], ArrestPoints[id][arrestInt], -1);
  348. ArrestPoints[id][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ], ArrestPoints[id][arrestVW]);
  349. }
  350. case 3:
  351. {
  352. format(string, sizeof(string), "/warrantarrest\nArrest Point #%d", id);
  353. ArrestPoints[id][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[id][arrestVW], ArrestPoints[id][arrestInt], -1);
  354. ArrestPoints[id][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ], ArrestPoints[id][arrestVW]);
  355. }
  356. case 4:
  357. {
  358. format(string, sizeof(string), "/jarrest\nArrest Point #%d", id);
  359. ArrestPoints[id][arrestTextID] = CreateDynamic3DTextLabel(string, COLOR_DBLUE, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]+0.6, 4.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, ArrestPoints[id][arrestVW], ArrestPoints[id][arrestInt], -1);
  360. ArrestPoints[id][arrestPickupID] = CreateDynamicPickup(1247, 23, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ], ArrestPoints[id][arrestVW]);
  361. }
  362. }
  363. SaveArrestPoint(id);
  364. format(string, sizeof(string), "%s has changed the type on Arrest Point ID %d to %d.", GetPlayerNameEx(playerid), id, amount);
  365. Log("logs/arrestedit.log", string);
  366. return 1;
  367. }
  368. else if(strcmp(choice, "jailpos1", true) == 0)
  369. {
  370. if(ArrestPoints[id][arrestPosX] == 0)
  371. {
  372. format(string, sizeof(string), "Arrest Point #%d does not exist.", id);
  373. SendClientMessageEx(playerid, COLOR_WHITE, string);
  374. return 1;
  375. }
  376. GetPlayerPos(playerid, ArrestPoints[id][JailPos1][0], ArrestPoints[id][JailPos1][1], ArrestPoints[id][JailPos1][2]);
  377. ArrestPoints[id][jailVW] = GetPlayerVirtualWorld(playerid);
  378. ArrestPoints[id][jailInt] = GetPlayerInterior(playerid);
  379. format(string, sizeof(string), "You have changed the jail cell position 1 on Arrest Point #%d.", id);
  380. SendClientMessageEx(playerid, COLOR_WHITE, string);
  381. SaveArrestPoint(id);
  382. format(string, sizeof(string), "%s has changed the jail cell position 1 on Arrest Point ID %d.", GetPlayerNameEx(playerid), id);
  383. Log("logs/arrestedit.log", string);
  384. }
  385. else if(strcmp(choice, "jailpos2", true) == 0)
  386. {
  387. if(ArrestPoints[id][arrestPosX] == 0)
  388. {
  389. format(string, sizeof(string), "Arrest Point #%d does not exist.", id);
  390. SendClientMessageEx(playerid, COLOR_WHITE, string);
  391. return 1;
  392. }
  393. GetPlayerPos(playerid, ArrestPoints[id][JailPos2][0], ArrestPoints[id][JailPos2][1], ArrestPoints[id][JailPos2][2]);
  394. ArrestPoints[id][jailVW] = GetPlayerVirtualWorld(playerid);
  395. ArrestPoints[id][jailInt] = GetPlayerInterior(playerid);
  396. format(string, sizeof(string), "You have changed the jail cell position 2 on Arrest Point #%d.", id);
  397. SendClientMessageEx(playerid, COLOR_WHITE, string);
  398. SaveArrestPoint(id);
  399. format(string, sizeof(string), "%s has changed the jail cell position 2 on Arrest Point ID %d.", GetPlayerNameEx(playerid), id);
  400. Log("logs/arrestedit.log", string);
  401. }
  402. else if(strcmp(choice, "delete", true) == 0)
  403. {
  404. if(ArrestPoints[id][arrestPosX] == 0)
  405. {
  406. format(string, sizeof(string), "Arrest Point #%d does not exist.", id);
  407. SendClientMessageEx(playerid, COLOR_WHITE, string);
  408. return 1;
  409. }
  410. DestroyDynamic3DTextLabel(ArrestPoints[id][arrestTextID]);
  411. DestroyDynamicPickup(ArrestPoints[id][arrestPickupID]);
  412. ArrestPoints[id][arrestPosX] = 0.0;
  413. ArrestPoints[id][arrestPosY] = 0.0;
  414. ArrestPoints[id][arrestPosZ] = 0.0;
  415. ArrestPoints[id][arrestVW] = 0;
  416. ArrestPoints[id][arrestInt] = 0;
  417. ArrestPoints[id][arrestType] = 0;
  418. SaveArrestPoint(id);
  419. format(string, sizeof(string), "You have deleted Arrest Point #%d.", id);
  420. SendClientMessageEx(playerid, COLOR_WHITE, string);
  421. format(string, sizeof(string), "%s has deleted Arrest Point ID %d.", GetPlayerNameEx(playerid), id);
  422. Log("logs/arrestedit.log", string);
  423. return 1;
  424. }
  425. }
  426. else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  427. return 1;
  428. }
  429. CMD:arreststatus(playerid, params[])
  430. {
  431. new id;
  432. if(sscanf(params, "i", id))
  433. {
  434. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /arreststatus [id]");
  435. return 1;
  436. }
  437. if (PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pFactionModerator] >= 1)
  438. {
  439. new string[128];
  440. format(string,sizeof(string),"|___________ Arrest Point Status (ID: %d) ___________|", id);
  441. SendClientMessageEx(playerid, COLOR_GREEN, string);
  442. format(string, sizeof(string), "[Position] X: %f | Y: %f | Z: %f | VW: %d | Int: %d | Type: %d", ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ], ArrestPoints[id][arrestVW], ArrestPoints[id][arrestInt], ArrestPoints[id][arrestType]);
  443. SendClientMessageEx(playerid, COLOR_WHITE, string);
  444. format(string, sizeof(string), "[JailPos 1] X: %f | Y: %f | Z: %f | VW: %d | Int: %d", ArrestPoints[id][JailPos1][0], ArrestPoints[id][JailPos1][1], ArrestPoints[id][JailPos1][2], ArrestPoints[id][jailVW], ArrestPoints[id][jailInt]);
  445. SendClientMessageEx(playerid, COLOR_WHITE, string);
  446. format(string, sizeof(string), "[JailPos 2] X: %f | Y: %f | Z: %f", ArrestPoints[id][JailPos2][0], ArrestPoints[id][JailPos2][1], ArrestPoints[id][JailPos2][2]);
  447. SendClientMessageEx(playerid, COLOR_WHITE, string);
  448. }
  449. else
  450. {
  451. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  452. }
  453. return 1;
  454. }
  455. CMD:arrestnext(playerid, params[])
  456. {
  457. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  458. {
  459. SendClientMessageEx(playerid, COLOR_RED, "* Listing next available Arrest Point...");
  460. for(new x = 0; x < MAX_ARRESTPOINTS; x++)
  461. {
  462. if(ArrestPoints[x][arrestPosX] == 0)
  463. {
  464. new string[128];
  465. format(string, sizeof(string), "%d is available to use.", x);
  466. SendClientMessageEx(playerid, COLOR_WHITE, string);
  467. break;
  468. }
  469. }
  470. }
  471. else
  472. {
  473. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
  474. return 1;
  475. }
  476. return 1;
  477. }
  478. CMD:gotoarrestpoint(playerid, params[])
  479. {
  480. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pFactionModerator] >= 1)
  481. {
  482. new id;
  483. if(sscanf(params, "d", id)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /gotoarrestpoint [id]");
  484. SetPlayerPos(playerid, ArrestPoints[id][arrestPosX], ArrestPoints[id][arrestPosY], ArrestPoints[id][arrestPosZ]);
  485. SetPlayerInterior(playerid, ArrestPoints[id][arrestInt]);
  486. PlayerInfo[playerid][pInt] = ArrestPoints[id][arrestInt];
  487. SetPlayerVirtualWorld(playerid, ArrestPoints[id][arrestVW]);
  488. PlayerInfo[playerid][pVW] = ArrestPoints[id][arrestVW];
  489. }
  490. return 1;
  491. }