Advertisement
bruno_travi

handcuff.inc

Aug 2nd, 2016
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 120.76 KB | None | 0 0
  1. /*
  2. Handcuffs System(Sistema de algemas)
  3. O Sistema de Algemas conta com uma maneira realista de algemar
  4. pessoas dentro do modo de jogo SA-MP, acompanhado de um controle
  5. de tais ações de maneira fácil e completa.
  6.  
  7. Copyright (C) 2016 Bruno Travi(Bruno13)
  8.  
  9. This program is free software: you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation, either version 3 of the License, or
  12. (at your option) any later version.
  13.  
  14. This program is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with this program. If not, see <http://www.gnu.org/licenses/>.
  21.  
  22. Esqueleto do código:
  23. |
  24. *
  25. * INCLUDES
  26. *
  27. |
  28. *
  29. * DEFINITIONS
  30. *
  31. |
  32. *
  33. * ENUMERATORS
  34. *
  35. |
  36. *
  37. * VARIABLES
  38. *
  39. |
  40. *
  41. * NATIVE CALLBACKS
  42. *
  43. |
  44. *
  45. * MY CALLBACKS
  46. *
  47. |
  48. *
  49. * FUNCTIONS
  50. *
  51. |
  52. *
  53. * COMPLEMENTS
  54. *
  55. |
  56. *
  57. * INCLUDE FUNCTIONS
  58. *
  59. |
  60.  
  61.  
  62. INCLUDE FUNCTIONS:
  63. native GivePlayerHandcuff(playerid, amount);
  64. native RemovePlayerHandcuff(playerid, bool:unshackleTargets);
  65. native GetPlayerHandcuffAmmo(playerid);
  66. native GetPlayerHandcuffUsed(playerid);
  67. native PlayerHandcuffs(playerid);
  68. native IsPlayerWithHandcuffsInHands(playerid);
  69. native UnshacklePlayer(playerid, reason, auxAdmin = -1);
  70. native UnshacklePlayerOffline(playerid, playerName[]);
  71. native ListPlayerHandcuffKeys(playerid);
  72. native ShowPlayerPanelOfHandcuffs(playerid);
  73. */
  74. /*
  75. *****************************************************************************
  76. */
  77. //CODE DEFINITIONS:
  78. #define RESET_TO_DISCONNECT false
  79.  
  80. #define MAX_HANDCUFFS 5
  81.  
  82. #if defined MAX_PLAYERS
  83. #undef MAX_PLAYERS
  84. #endif
  85. #define MAX_PLAYERS 20
  86. //-------------------------------
  87.  
  88. //MACROS:
  89. static stock stringf[256];
  90.  
  91. #define call:%0(%1) forward %0(%1); public %0(%1)
  92.  
  93. #define SendClientMessageEx(%0,%1,%2,%3) format(stringf, sizeof(stringf),%2,%3) && SendClientMessage(%0, %1, stringf)
  94.  
  95. #if !defined isnull
  96. #define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
  97. #endif
  98.  
  99. //DEFINITIONS:
  100. #define MAX_SKINS 312
  101.  
  102. #define TYPE_HANDCUFF 0
  103. #define TYPE_UNSHACKLE 1
  104. #define TYPE_HANDCUFFING 2
  105. #define TYPE_UNSHACKLING 3
  106. #define TYPE_AMOUNT 4
  107.  
  108. #define INDEX_ATTACH_HANDCUFF 9
  109.  
  110. #define REASON_DEATH 0
  111. #define REASON_DISCONNECT 1
  112. #define REASON_ADMIN 2
  113.  
  114. #define DIALOG_SUSPECTS_CUFFED 7059
  115. #define DIALOG_PANEL_HANDCUFFS 7084
  116.  
  117. #define TARGET_STATE_OFFLINE -1
  118.  
  119. #define INVALID_PLAYER_3DTEXT_ID PlayerText3D:(0xFFFF)
  120. /*
  121. *****************************************************************************
  122. */
  123. const
  124. COLOR_RED = 0xE84F33AA,
  125. COLOR_GREEN = 0x9ACD32AA,
  126. COLOR_YELLOW = 0xFCD440AA,
  127.  
  128. size_E_TIME_CUFFED = MAX_HANDCUFFS * 36;
  129.  
  130. enum E_TEXT_HANDCUFF_GLOBAL
  131. {
  132. Text:E_BACKGROUND[5],
  133. Text:E_PREVIEW,
  134. Text:E_DIVIDER
  135. }
  136. enum E_TEXT_HANDCUFF_PRIVATE
  137. {
  138. PlayerText:E_AMOUNT,
  139. PlayerText:E_TARGET_CLOSE,
  140. PlayerText:E_TEXT_ACTION
  141. }
  142.  
  143. enum E_PLAYER_HANDCUFF
  144. {
  145. bool:E_HAVE_HANDCUFF,
  146. bool:E_HANDCUFF_IN_HANDS,
  147. bool:E_HANDCUFFING_TARGET,
  148. bool:E_UNSHACKLING_TARGET,
  149. E_HANDCUFF_AMOUNT,
  150. E_HANDCUFFS_USED,
  151. E_HANDCUFFED_PLAYERS[MAX_HANDCUFFS],
  152. E_CURRENT_TARGET,
  153. E_AUX_TARGET_HANDCUFF_SLOT[MAX_HANDCUFFS],
  154. E_TIMESTAMP_CUFFED[MAX_HANDCUFFS],
  155. E_TIME_CUFFED[size_E_TIME_CUFFED]
  156. }
  157.  
  158. #define E_TIME_CUFFED][%1][%2] E_TIME_CUFFED][((%1)*36)+(%2)]
  159.  
  160. enum E_CUFFED_PLAYER
  161. {
  162. bool:E_PLAYER_HANDCUFFED,
  163. E_OWNER_HANDCUFF_ID,
  164. PlayerText3D:E_OWNER_LABEL_INFO
  165. }
  166.  
  167. enum E_ATTACH_HANDCUFF
  168. {
  169. Float:E_ATTACH_OFFSETX,
  170. Float:E_ATTACH_OFFSETY,
  171. Float:E_ATTACH_OFFSETZ,
  172. Float:E_ATTACH_ROTX,
  173. Float:E_ATTACH_ROTY,
  174. Float:E_ATTACH_ROTZ,
  175. Float:E_ATTACH_SCALEX,
  176. Float:E_ATTACH_SCALEY,
  177. Float:E_ATTACH_SCALEZ
  178. }
  179. /*
  180. *****************************************************************************
  181. */
  182. static
  183. /// <summary>
  184. /// Variáveis de controle das TextDraws Globais/Privadas.</summary>
  185. Text:textHandcuffGlobal[E_TEXT_HANDCUFF_GLOBAL],
  186. PlayerText:textHandcuffPrivate[MAX_PLAYERS][E_TEXT_HANDCUFF_PRIVATE],
  187. Text:textWarningRecovery[2],
  188.  
  189. /// <summary>
  190. /// Variáveis de controle das algemas do jogador.</summary>
  191. playerHandcuff[MAX_PLAYERS][E_PLAYER_HANDCUFF],
  192.  
  193. /// <summary>
  194. /// Variáveis de controle das algemas do suspeito.</summary>
  195. cuffedPlayer[MAX_PLAYERS][E_CUFFED_PLAYER],
  196.  
  197. #if !RESET_TO_DISCONNECT
  198. /// <summary>
  199. /// Variável para armazenar nome do alvo algemado offline.</summary>
  200. playerTargetOffline[MAX_PLAYERS][MAX_HANDCUFFS][MAX_PLAYER_NAME],
  201. #endif
  202.  
  203. /// <summary>
  204. /// Variável para controle de estado do suspeito (morto/vivo).</summary>
  205. bool:playerDeath[MAX_PLAYERS],
  206.  
  207. /// <summary>
  208. /// Variável para controle de suspeitos que morrerem algemados.</summary>
  209. /// <remarks>
  210. /// MAX_HANDCUFFS define o máximo de slots possíveis para se usar; para
  211. /// ocorrer um estouro de slots seria necessário o jogador ter atingido
  212. /// o máximo de jogadores possíveis de se algemar definido por MAX_HANDCUFFS,
  213. /// e todos estes teriam que morrer em um tempo determinado menor que o
  214. /// respawn onde todos os mesmos se encontrem em um raio que 40 metros,
  215. /// e o jogador teria de algemar um novo suspeito e o mesmo morrer no
  216. /// instante que algemado, isso tudo dentro do tempo dado determinado.
  217. /// Possibilidades:
  218. /// MAX_HANDCUFFS + 1 = algemados && mortos && a 40m de distância
  219. /// do responsável pelas imobilizações.
  220. /// </remarks>
  221. targetToRecoverHandcuff[MAX_PLAYERS][MAX_HANDCUFFS],
  222.  
  223. /// <summary>
  224. /// Variável de controle do alvo atual localizado na frente do jogador para recuperar as algemas.</summary>
  225. targetToRecoverCurrent[MAX_PLAYERS],
  226.  
  227. /// <summary>
  228. /// Variável de controle do id dos jogadores listados no Handcuff Panel.</summary>
  229. handcuffPanelId[MAX_PLAYERS][MAX_PLAYERS],/// <summary>
  230. /// Variável de controle do nome dos jogadores listados no Handcuff Panel.</summary>
  231. handcuffPanelName[MAX_PLAYERS][MAX_PLAYERS][MAX_PLAYER_NAME],
  232.  
  233. /// <summary>
  234. /// Attachment das algemas para todas skins.</summary>
  235. attachHandcuff[MAX_SKINS][E_ATTACH_HANDCUFF] = {
  236. {0.000000,0.028000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000},
  237. {-0.014999,0.086000,-0.010999,12.599996,-19.000000,105.900047,1.360999,1.366997,1.832999},
  238. {0.009999,0.042000,0.003000,0.799998,-7.000002,105.900047,1.046998,1.413997,1.815999},
  239. {0.009999,0.042000,0.003000,0.799998,-7.000002,105.900047,1.046998,1.413997,1.815999},
  240. {0.014000,0.105000,0.024000,15.700033,-1.799994,105.500068,1.367998,1.462997,1.871998},
  241. {0.043000,0.052000,-0.004999,-5.299966,-12.599994,101.400169,0.939997,1.462997,1.632997},
  242. {0.026000,0.036000,-0.001000,10.800045,3.899997,105.800300,0.889997,1.462997,1.658998},
  243. {0.026000,0.047000,-0.008000,10.800045,3.899997,105.800300,0.889997,1.462997,1.658998},
  244. {0.026000,0.041000,0.014000,10.800045,3.899997,105.800300,0.889997,1.462997,1.658998},
  245. {0.044999,0.041000,0.014000,10.800045,3.899997,105.800300,0.889997,1.462997,1.658998},
  246. {0.033999,0.042000,0.018999,9.900040,-25.500000,105.800300,1.137996,1.462997,1.703998},
  247. {0.014999,0.049000,-0.003000,13.800049,-7.000001,112.500358,1.077996,1.462997,1.376997},
  248. {0.014999,0.042000,0.000000,5.600040,-7.000001,112.500358,0.918996,1.462997,1.102997},
  249. {0.014999,0.048000,0.000000,18.400028,-7.000001,102.400390,0.942997,1.462997,1.389997},
  250. {0.014999,0.083000,0.003999,10.100030,-7.000001,102.400390,1.219996,1.462997,1.389997},
  251. {0.007999,0.036000,0.011999,12.500087,1.500015,108.400367,1.001996,1.462997,1.639996},
  252. {0.019999,0.080000,0.005999,12.500087,4.700020,102.100402,1.295996,1.462997,1.865996},
  253. {0.031999,0.045000,0.002999,4.100083,-7.299978,102.100402,0.962997,1.462997,1.792995},
  254. {0.031999,0.045000,0.002999,4.100083,-7.299978,102.100402,0.962997,1.462997,1.792995},
  255. {0.007999,0.076000,0.002999,8.600082,-7.299978,102.100372,1.325997,1.462997,1.659996},
  256. {0.024999,0.046000,-0.007000,8.600082,-7.299978,102.100372,0.984996,1.462997,1.604996},
  257. {0.024999,0.046000,-0.007000,8.600082,-7.299978,102.100372,0.984996,1.462997,1.604996},
  258. {0.036999,0.046000,-0.007000,8.600082,-7.299978,102.100372,0.984996,1.462997,1.604996},
  259. {0.007999,0.117000,0.006000,10.700078,0.900015,102.100372,1.800996,1.462997,1.533998},
  260. {0.005999,0.047000,-0.007999,1.000082,7.400019,102.100372,1.043996,1.462997,1.533998},
  261. {0.004999,0.047000,-0.006999,1.000082,7.400019,102.100372,1.043996,1.462997,1.657999},
  262. {0.023999,0.074000,0.008999,11.100081,7.400019,98.300369,1.250996,1.462997,1.657999},
  263. {0.011999,0.043000,-0.000999,7.900086,-2.699957,105.200386,0.841996,1.462997,1.643997},
  264. {0.008999,0.047000,-0.008999,7.900086,-2.699957,105.200386,0.894996,1.462997,1.409996},
  265. {0.022999,0.052000,-0.001999,7.800083,-2.699957,98.900421,0.894996,1.462997,1.529996},
  266. {0.011999,0.040000,-0.002999,7.800083,5.100040,98.900421,0.939995,1.462997,1.604997},
  267. {0.005999,0.037000,0.003000,9.500092,4.300041,100.800415,1.303994,1.462997,1.570997},
  268. {-0.006000,0.054000,-0.013999,3.300095,3.500038,100.800415,0.978994,1.462997,1.194997},
  269. {0.025000,0.048000,-0.006999,4.900100,-2.399965,103.900466,0.875994,1.462997,1.416997},
  270. {0.004999,0.074000,0.004000,4.900100,5.500036,100.400382,1.177993,1.462997,1.416997},
  271. {-0.014000,0.055000,-0.005999,1.300099,4.200041,100.400382,0.967993,1.462997,1.584998},
  272. {-0.014000,0.055000,-0.005999,1.300099,4.200041,97.500305,0.967993,1.462997,1.584998},
  273. {-0.014000,0.055000,-0.005999,1.300099,4.200041,97.500305,0.967993,1.462997,1.584998},
  274. {0.001999,0.065000,0.008999,11.300105,4.200041,97.500305,1.104993,1.462997,1.422998},
  275. {0.017999,0.042000,0.021999,11.900110,-11.099953,105.900276,1.104993,1.462997,1.422998},
  276. {0.017999,0.042000,0.002000,20.300098,-11.099953,105.900276,0.879993,1.462997,1.232998},
  277. {0.001999,0.049000,-0.000999,12.700086,-11.099953,105.900276,0.915992,1.462997,1.232998},
  278. {0.006999,0.045000,0.006000,3.300084,10.900049,100.500289,0.848993,1.462997,1.481998},
  279. {0.006999,0.049000,-0.005999,2.400082,4.300047,100.500289,0.848993,1.462997,1.324998},
  280. {-0.007000,0.060000,0.004999,2.400082,4.300047,97.900260,0.947993,1.462997,1.212998},
  281. {0.013999,0.043000,0.002000,4.600088,4.300047,104.000236,0.947993,1.462997,1.321998},
  282. {0.018999,0.047000,-0.002999,1.600091,0.900045,98.700248,0.898993,1.462997,1.337998},
  283. {0.018999,0.041000,-0.002999,8.000088,0.900045,98.700248,0.925992,1.462997,1.384999},
  284. {0.018999,0.041000,-0.002999,8.000088,0.900045,98.700248,0.925992,1.462997,1.384999},
  285. {0.005999,0.022000,0.008000,2.200085,20.700099,98.700248,0.668994,1.462997,1.195999},
  286. {0.032000,0.032000,0.013999,12.200083,1.300106,98.700248,0.940994,1.462997,1.640998},
  287. {0.013000,0.079000,0.006999,12.200083,-1.099895,102.900245,1.259995,1.462997,1.550998},
  288. {0.013000,0.079000,0.006999,12.200083,-1.099895,102.900245,1.259995,1.462997,1.550998},
  289. {-0.008999,0.063000,0.002999,13.000080,3.500106,100.900253,1.133995,1.462997,1.315997},
  290. {0.001999,0.058000,0.018999,-2.699920,-5.499893,100.900253,1.133995,1.462997,1.535998},
  291. {0.009999,0.041000,-0.006000,11.400078,6.900105,100.900253,0.807994,1.462997,1.264997},
  292. {0.016999,0.041000,0.000999,11.400078,6.900105,100.900253,0.881994,1.462997,1.264997},
  293. {0.017999,0.022000,-0.004000,11.000072,1.500108,100.900253,0.368994,1.462997,1.282997},
  294. {-0.007000,0.059000,-0.000000,11.000072,1.500108,96.600273,0.984994,1.462997,1.225996},
  295. {0.014999,0.048000,-0.005000,2.300077,1.500108,96.600273,0.957993,1.458997,1.442996},
  296. {0.014999,0.041000,-0.009000,9.800080,1.500108,96.600273,0.887994,1.458997,1.528998},
  297. {0.030000,0.048000,-0.001000,9.600079,4.000106,103.300270,0.869994,1.458997,1.580998},
  298. {0.013000,0.093999,0.002999,9.600079,4.000106,103.300270,1.425994,1.458997,1.750998},
  299. {0.004000,0.073999,0.002999,9.600079,4.000106,103.300270,1.067994,1.458997,1.510998},
  300. {0.004000,0.056999,0.002999,9.600079,4.000106,103.300270,0.977994,1.458997,1.364998},
  301. {0.004000,0.052999,0.002999,9.600079,4.000106,103.300270,0.882994,1.458997,1.364998},
  302. {0.004000,0.034999,-0.003000,6.000085,11.000102,103.300270,0.824995,1.458997,1.666998},
  303. {0.004000,0.034999,-0.003000,6.000085,11.000102,103.300270,0.824995,1.458997,1.666998},
  304. {0.030000,0.051999,-0.002000,6.000085,11.000102,103.300270,0.840995,1.458997,1.776998},
  305. {-0.000999,0.050999,0.000999,10.300077,3.900110,103.300270,0.840995,1.458997,1.124996},
  306. {0.024000,0.039999,-0.002000,4.100079,3.900110,103.300270,0.880995,1.458997,2.112996},
  307. {0.024000,0.049999,-0.002000,4.100079,3.900110,103.300270,0.880995,1.458997,1.863996},
  308. {-0.000999,0.062999,0.000999,4.100079,3.900110,103.300270,1.134994,1.458997,1.460996},
  309. {-0.000999,0.062999,0.000999,4.100079,3.900110,103.300270,1.134994,1.458997,1.460996},
  310. {0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000},
  311. {-0.000999,0.053999,-0.007000,8.200078,3.900110,103.300270,0.940994,1.458997,1.208996},
  312. {0.017000,0.043999,0.000999,8.200078,3.900110,103.300270,0.828994,1.458997,1.208996},
  313. {0.017000,0.029999,0.003999,4.300076,3.900110,103.300270,0.725994,1.458997,1.836995},
  314. {0.032000,0.049999,0.001999,4.300076,3.900110,103.300270,0.906994,1.458997,1.836995},
  315. {0.032000,0.047999,0.006999,3.600075,3.900110,103.300270,0.848994,1.458997,1.836995},
  316. {-0.015999,0.052999,0.002999,3.600075,3.900110,99.100280,0.892994,1.458997,1.302994},
  317. {-0.015999,0.052999,0.002999,3.600075,3.900110,99.100280,0.892994,1.458997,1.302994},
  318. {0.037000,0.050999,-0.012000,22.900085,6.400109,99.100280,0.953994,1.458997,1.618994},
  319. {0.037000,0.045999,-0.018000,1.600077,4.800109,99.100280,0.953994,1.458997,1.618994},
  320. {0.037000,0.045999,-0.018000,1.600077,4.800109,99.100280,0.953994,1.458997,1.618994},
  321. {0.041999,0.029999,-0.006000,9.200077,2.700113,111.500312,0.577995,1.458997,1.316994},
  322. {0.004000,0.044999,-0.004000,2.200080,2.700113,104.600303,0.950994,1.458997,1.456994},
  323. {-0.014999,0.021999,-0.003000,0.700078,2.700113,104.600303,0.614994,1.458997,0.833993},
  324. {-0.012999,0.061999,0.020999,4.900081,2.700113,104.600303,1.087994,1.458997,1.356994},
  325. {0.016000,0.041999,-0.000000,4.900081,1.400117,104.600303,1.163994,1.458997,1.851994},
  326. {-0.007999,0.067999,0.004999,13.500082,-0.399884,104.600303,1.157993,1.458997,1.210994},
  327. {0.006000,0.041999,0.004999,13.500082,-0.399884,104.600303,0.853993,1.458997,1.210994},
  328. {0.006000,0.068999,0.004999,13.500082,-0.399884,104.600303,1.147994,1.458997,1.207994},
  329. {0.006000,0.053999,0.004999,13.500082,-0.399884,104.600303,0.886994,1.458997,1.207994},
  330. {0.006000,0.050999,-0.005000,-1.099917,-0.399884,104.600303,0.912994,1.458997,1.207994},
  331. {-0.003999,0.061999,-0.001000,6.500079,-0.399884,100.000244,0.999994,1.458997,1.207994},
  332. {0.034000,0.074999,0.011999,11.600084,-0.399884,100.000244,1.257994,1.458997,1.463994},
  333. {0.041000,0.049999,0.001999,9.700089,-0.399884,100.000244,1.115994,1.458997,1.463994},
  334. {0.005000,0.043999,-0.014000,3.400087,-0.399884,100.000244,0.935994,1.458997,1.449994},
  335. {0.014999,0.076999,0.010999,8.900087,-0.399884,100.000244,1.246994,1.458997,1.449994},
  336. {0.007000,0.043000,-0.005000,8.900087,-0.399884,100.000244,0.940995,1.458997,1.449994},
  337. {0.027000,0.033000,-0.000000,8.900087,-0.399884,104.400253,0.830995,1.458997,1.932995},
  338. {0.027000,0.043000,-0.009000,8.900087,-0.399884,104.400253,0.982994,1.458997,1.620995},
  339. {0.037000,0.156000,0.018999,13.600082,-2.999883,97.300231,2.229995,1.458997,1.689993},
  340. {0.037000,0.043000,-0.007000,13.600082,-2.999883,97.300231,0.866995,1.458997,1.494994},
  341. {0.001999,0.156000,0.012999,8.600086,-2.999883,106.200225,2.147995,1.458997,1.612992},
  342. {0.011999,0.038000,-0.009000,8.600086,-2.999883,106.200225,0.847995,1.458997,1.474992},
  343. {0.011999,0.050000,-0.005000,8.600086,-2.999883,106.200225,0.965995,1.458997,1.474992},
  344. {0.011999,0.090000,0.001999,8.600086,-2.999883,106.200225,1.424995,1.458997,1.474992},
  345. {0.011999,0.042000,-0.010000,8.600086,-2.999883,106.200225,0.890994,1.458997,1.500992},
  346. {0.011999,0.042000,-0.010000,8.600086,-2.999883,106.200225,0.890994,1.458997,1.500992},
  347. {0.005999,0.055999,0.002999,7.000087,-2.999883,106.200225,1.079994,1.579996,1.917991},
  348. {0.019999,0.063000,0.006999,7.000087,-2.999883,106.200225,1.079994,1.579996,1.917991},
  349. {0.007999,0.088000,0.002999,12.600087,-7.499875,106.200225,1.241994,1.579996,1.712991},
  350. {0.007999,0.039000,-0.005000,12.600087,-7.499875,106.200225,0.987994,1.579996,1.603991},
  351. {0.036999,0.039000,-0.005000,12.600087,-7.499875,106.200225,0.981994,1.579996,1.706992},
  352. {-0.002000,0.039000,-0.005000,11.100088,-7.499875,106.200225,0.981994,1.579996,1.579992},
  353. {0.023999,0.014000,-0.005000,11.100088,-7.499875,106.200225,0.424995,1.579996,1.501992},
  354. {0.023999,0.014000,-0.005000,11.100088,-7.499875,106.200225,0.424995,1.579996,1.501992},
  355. {0.006999,0.042000,-0.016000,11.100088,-7.499875,106.200225,0.741994,1.579996,1.501992},
  356. {0.016999,0.090000,0.010999,11.100088,0.700125,104.300231,1.481995,1.579996,1.501992},
  357. {-0.015000,0.078999,0.001999,11.100088,0.700125,104.300231,1.291995,1.579996,1.501992},
  358. {-0.004000,0.087000,0.006999,6.000093,0.700125,99.400192,1.291995,1.579996,1.557992},
  359. {0.034000,0.042000,-0.009000,6.900094,0.700125,99.400192,0.903993,1.579996,1.733992},
  360. {0.012000,0.046999,0.004999,2.700091,2.400134,99.400192,0.797993,1.579996,1.297991},
  361. {0.017000,0.047999,0.005999,2.700091,2.400134,99.400192,0.901993,1.579996,1.716992},
  362. {0.017000,0.047999,0.007999,10.400096,2.400134,99.400192,0.901993,1.579996,1.438992},
  363. {0.017999,0.060999,-0.008000,-5.399903,2.400134,99.400192,1.244992,1.579996,1.438992},
  364. {0.000000,0.068999,0.001999,10.400096,2.400134,99.400192,1.121993,1.579996,1.536992},
  365. {-0.007000,0.068999,0.010999,10.400096,2.400134,109.800201,0.904993,1.579996,1.197992},
  366. {-0.007000,0.041999,0.008999,3.900115,2.400134,103.000251,1.078993,1.579996,1.395994},
  367. {0.000000,0.055999,-0.001000,8.100112,2.400134,103.000251,0.982993,1.579996,0.859995},
  368. {0.003999,0.055999,-0.016000,3.700113,2.400134,96.500381,0.924993,1.579996,1.037994},
  369. {0.003999,0.074999,0.008999,3.700113,2.400134,96.500381,1.151994,1.579996,1.278993},
  370. {-0.007000,0.035999,-0.002000,5.700114,2.400134,100.100326,0.700994,1.579996,1.136993},
  371. {0.005999,0.045999,-0.008000,5.700114,2.400134,100.100326,0.700994,1.579996,1.230994},
  372. {0.034999,0.045999,-0.008000,5.700114,2.400134,100.100326,0.783994,1.579996,1.413993},
  373. {-0.001000,0.031999,-0.003000,-2.399884,0.100136,100.100326,0.539994,1.579996,1.060993},
  374. {0.004999,0.069999,0.002999,5.900113,-3.299866,104.900253,1.154994,1.579996,1.109994},
  375. {0.004999,0.069999,0.002999,5.900113,-3.299866,104.900253,1.154994,1.579996,1.109994},
  376. {0.004999,0.069999,0.002999,5.900113,-3.299866,104.900253,1.154994,1.579996,1.109994},
  377. {0.014999,0.039999,0.003999,5.900113,-3.299866,104.900253,0.835994,1.579996,1.109994},
  378. {0.021999,0.040999,0.002999,2.000117,16.300134,97.600318,0.835994,1.579996,1.487993},
  379. {0.017999,0.040999,0.002999,2.000117,16.300134,97.600318,0.835994,1.579996,1.786993},
  380. {0.016999,0.038999,-0.009000,3.700117,-0.099870,97.600318,0.891995,1.579996,1.568994},
  381. {0.004999,0.068999,0.003999,10.000118,-0.099870,109.300300,1.115995,1.579996,1.293994},
  382. {0.004999,0.077999,0.003999,10.000118,-0.099870,100.900260,1.249997,1.579996,1.483994},
  383. {0.030999,0.042999,-0.001000,1.500119,-0.099870,102.200256,0.941996,1.547997,1.713993},
  384. {0.023999,0.042999,0.003999,16.600111,-0.099870,102.200256,0.872996,1.547997,1.122990},
  385. {-0.005000,0.039999,0.011999,10.900110,8.800132,109.600257,0.872996,1.547997,1.411990},
  386. {0.020999,0.043999,0.003999,10.900110,8.800132,105.400238,0.872996,1.547997,1.171989},
  387. {-0.000000,0.062999,0.008999,8.800113,8.800132,99.900207,1.218996,1.547997,1.340990},
  388. {0.002999,0.052999,0.004999,1.600115,8.800132,99.900207,0.966997,1.547997,1.169989},
  389. {0.002999,0.045999,-0.001000,-2.899890,8.300136,99.900207,0.966997,1.547997,1.470989},
  390. {0.012999,0.047999,0.006999,3.600113,8.300136,99.900207,0.924997,1.547997,1.371989},
  391. {0.012999,0.040999,-0.006000,3.600113,8.300136,99.900207,1.001996,1.547997,1.571989},
  392. {0.011999,0.082999,0.010999,17.800117,-14.499862,104.100166,1.368997,1.547997,1.439989},
  393. {-0.001000,0.060999,-0.003000,12.500124,-11.899868,104.100166,0.938997,1.547997,1.108989},
  394. {0.010999,0.075999,0.003999,6.300136,5.500131,100.400108,1.263997,1.547997,1.625988},
  395. {-0.011000,0.050999,0.001999,1.900139,5.500131,100.400108,0.888997,1.547997,1.164989},
  396. {-0.011000,0.027999,0.008999,-0.999870,5.500131,100.400108,0.676998,1.547997,1.252989},
  397. {-0.000000,0.046999,-0.006000,6.600131,-5.899869,100.400108,0.967997,1.547997,1.692989},
  398. {0.011999,0.070999,0.014999,6.600131,-5.899869,100.400108,0.811997,1.547997,1.503990},
  399. {0.011999,0.047999,-0.007000,6.600131,-5.899869,100.400108,0.872996,1.547997,1.928990},
  400. {0.011999,0.050999,0.001999,6.600131,-5.899869,100.400108,0.872996,1.547997,1.928990},
  401. {-0.013000,0.029999,0.005999,6.600131,-5.899869,100.400108,0.696996,1.547997,1.557990},
  402. {-0.012000,0.029999,0.005999,6.600131,-5.899869,100.400108,0.696996,1.547997,1.557990},
  403. {0.002999,0.038999,0.003999,7.700127,-2.099872,100.400108,0.823997,1.584997,1.751989},
  404. {0.002999,0.045999,0.002999,-0.199867,-0.099875,100.400108,0.953997,1.584997,1.648990},
  405. {0.004999,0.043999,0.002999,8.100131,-0.099875,100.400108,0.883996,1.584997,1.104989},
  406. {-0.010000,0.037999,-0.006000,8.100131,-0.099875,113.800140,0.880996,1.940997,1.355989},
  407. {0.011999,0.044999,0.004999,8.100131,-0.099875,105.000167,0.880996,1.940997,1.451989},
  408. {0.005999,0.048999,0.004999,4.700133,-0.099875,105.000167,0.910996,1.940997,1.132988},
  409. {0.011999,0.043999,-0.004000,4.700133,-0.099875,105.000167,0.910996,1.940997,1.452988},
  410. {0.011999,0.043999,-0.004000,4.700133,-0.099875,105.000167,0.910996,1.940997,1.452988},
  411. {0.011999,0.043999,-0.004000,4.700133,-0.099875,105.000167,0.910996,1.940997,1.452988},
  412. {0.008999,0.041999,-0.008000,3.000131,10.000123,105.000167,0.910996,1.940997,1.520989},
  413. {0.008999,0.041999,-0.004000,3.000131,10.000123,105.000167,0.910996,1.940997,1.520989},
  414. {-0.008000,0.069999,0.006999,3.000131,10.000123,105.000167,1.157995,1.940997,1.139989},
  415. {-0.009000,0.045999,-0.008000,3.000131,10.000123,105.000167,1.094995,1.940997,1.433989},
  416. {-0.009000,0.044999,-0.009000,3.000131,10.000123,105.000167,1.094995,1.940997,1.433989},
  417. {0.006999,0.068999,0.007999,11.600146,-8.199888,105.000167,1.450996,1.940997,1.433989},
  418. {0.033999,0.048999,-0.006000,11.000148,1.200112,105.000167,0.823996,1.940997,1.755989},
  419. {0.025999,0.048999,-0.006000,11.000148,1.200112,105.000167,0.863996,1.940997,1.885989},
  420. {-0.002000,0.092999,0.000999,11.600142,-12.099889,105.000167,1.569996,1.940997,1.575989},
  421. {0.020999,0.047999,0.008999,11.600142,-0.599889,105.000167,0.838996,1.940997,1.575989},
  422. {0.028999,0.044999,-0.005000,6.700139,-0.899889,105.000167,0.868996,1.940997,1.575989},
  423. {0.043999,0.037999,0.012999,1.400139,-0.899889,105.000167,0.919995,1.940997,1.715989},
  424. {0.002999,0.086999,0.004999,10.000142,-0.899889,105.000167,1.364996,1.940997,1.715989},
  425. {0.012999,0.044999,0.002999,10.200143,-0.899889,105.000167,0.875996,1.940997,1.298989},
  426. {-0.004000,0.057999,0.001999,10.200143,-0.899889,105.000167,1.022996,1.940997,1.055988},
  427. {-0.004000,0.063999,0.004999,10.200143,-0.899889,105.000167,1.022996,1.940997,1.055988},
  428. {-0.004000,0.063999,0.004999,7.500146,-0.899889,105.000167,1.022996,1.940997,1.055988},
  429. {-0.004000,0.061999,0.004999,7.500146,-0.899889,105.000167,1.022996,1.940997,1.055988},
  430. {-0.006000,0.061999,0.004999,9.100159,-0.899889,105.000167,1.022996,1.940997,1.055988},
  431. {-0.006000,0.061999,0.004999,9.100159,-0.899889,105.000167,1.067996,1.940997,1.200987},
  432. {-0.006000,0.061999,0.004999,9.100159,-0.899889,105.000167,1.067996,1.940997,1.200987},
  433. {-0.005000,0.043999,0.004999,9.100159,-0.899889,105.000167,1.043997,1.940997,1.325988},
  434. {-0.015000,0.053999,0.002999,7.700170,-0.899889,102.300231,0.999997,1.940997,1.009988},
  435. {0.003999,0.053999,0.018999,13.500167,-0.899889,102.300231,0.999997,1.940997,1.202987},
  436. {0.004999,0.075999,0.005999,7.100166,5.400113,102.300231,1.162997,1.940997,1.202987},
  437. {-0.006000,0.056999,-0.004000,7.100166,-5.599886,102.300231,0.951997,1.940997,1.202987},
  438. {-0.000000,0.069999,0.007999,3.400164,2.600114,102.300231,1.173997,1.940997,1.356988},
  439. {0.012999,0.039999,-0.007000,3.400164,2.600114,102.300231,0.971998,1.940997,1.600987},
  440. {0.012999,0.039999,-0.007000,3.400164,2.600114,102.300231,0.971998,1.940997,1.600987},
  441. {0.012999,0.070999,0.003999,12.700165,2.600114,102.300231,1.234998,1.940997,1.600987},
  442. {0.012999,0.070999,0.006999,9.400169,1.200114,102.300231,1.234998,1.940997,1.347987},
  443. {-0.002000,0.037999,0.000999,9.400169,1.200114,102.300231,0.888998,1.940997,1.347987},
  444. {0.023999,-0.009000,0.000999,9.400169,1.200114,102.300231,0.602998,1.940997,1.347987},
  445. {-0.016000,0.043999,-0.017000,6.600165,1.200114,102.300231,0.865998,1.940997,1.014986},
  446. {-0.008999,0.030999,0.010999,1.500166,1.200114,102.300231,0.767998,1.940997,1.085987},
  447. {-0.008999,0.045999,-0.000000,12.500167,1.200114,102.300231,0.876998,1.940997,1.188987},
  448. {0.009999,0.038999,-0.001000,12.500167,1.200114,102.300231,0.876998,1.940997,0.970987},
  449. {-0.007000,0.034999,0.004999,8.100160,1.200114,102.300231,0.876998,1.940997,1.490986},
  450. {0.000000,0.038999,-0.000000,8.100160,-7.199883,102.300231,0.876998,1.940997,1.061986},
  451. {0.000000,0.043999,0.000999,8.100160,-7.199883,102.300231,0.810998,1.940997,1.061986},
  452. {0.008999,0.040999,0.000999,12.400161,-7.199883,102.300231,0.810998,1.940997,1.061986},
  453. {0.007999,0.087999,0.006999,9.100162,-0.699883,102.300231,1.336998,1.940997,1.680986},
  454. {-0.028000,0.043999,0.002999,9.100162,-0.699883,102.300231,1.186998,1.940997,1.550985},
  455. {0.020999,0.043999,0.002999,9.100162,-0.699883,102.300231,0.901998,1.940997,1.180986},
  456. {0.020999,0.052999,-0.002000,3.100164,-0.699883,102.300231,0.813998,1.940997,1.478985},
  457. {0.006999,0.077999,0.017999,3.100164,-0.699883,102.300231,1.374998,1.940997,1.316985},
  458. {0.006999,0.077999,0.017999,3.100164,-0.699883,102.300231,1.374998,1.940997,1.316985},
  459. {0.006999,0.044999,-0.007000,-0.199833,-0.699883,97.600227,0.877998,1.940997,1.396985},
  460. {0.005999,0.044999,-0.004000,11.300162,-0.699883,106.200180,0.877998,1.940997,1.199985},
  461. {0.005999,0.044999,-0.004000,11.300162,-0.699883,106.200180,0.877998,1.940997,1.199985},
  462. {0.005999,0.044999,-0.004000,11.300162,-0.699883,106.200180,0.877998,1.940997,1.199985},
  463. {0.017999,0.019999,-0.004000,11.300162,-0.699883,106.200180,0.560998,1.940997,1.297984},
  464. {-0.020000,0.045999,-0.004000,9.300167,-0.699883,106.200180,0.936998,1.940997,1.535983},
  465. {0.005999,0.063999,0.006999,9.300167,-0.699883,99.400238,1.034997,1.940997,1.277983},
  466. {0.014999,0.025999,0.000999,9.300167,-0.699883,99.400238,0.759998,1.940997,1.599983},
  467. {-0.002000,0.066999,0.011999,12.900163,-0.699883,99.400238,1.063998,1.940997,1.483982},
  468. {0.002999,0.041999,0.009999,7.400167,-0.699883,101.300277,1.168998,1.940997,1.483982},
  469. {0.002999,0.046999,0.000999,7.400167,-0.699883,101.300277,0.927998,1.940997,1.222983},
  470. {0.002999,0.059999,0.000999,7.400167,-0.699883,101.300277,1.012997,1.940997,1.222983},
  471. {0.000999,0.053999,0.000999,7.400167,-0.699883,101.300277,0.910998,1.940997,1.222983},
  472. {-0.003000,0.061999,-0.001000,7.400167,-0.699883,101.300277,1.017998,1.940997,1.222983},
  473. {-0.003000,0.052999,0.000999,1.200168,-0.699883,101.300277,0.945997,1.940997,1.092982},
  474. {-0.003000,0.055999,0.000999,6.100170,-0.699883,101.300277,0.945997,1.940997,1.092982},
  475. {-0.001000,0.038999,0.011999,6.100170,-0.699883,101.300277,0.945997,1.940997,1.092982},
  476. {0.003999,0.044999,-0.001000,5.800170,-0.699883,101.300277,0.958997,1.940997,1.416981},
  477. {0.003999,0.046999,-0.004000,5.800170,-0.699883,101.300277,0.958997,1.940997,1.638981},
  478. {0.003999,0.049999,-0.004000,5.800170,-0.699883,101.300277,0.876997,1.940997,1.816981},
  479. {-0.024000,0.041999,0.002999,11.500181,-0.699883,104.700279,0.876997,1.940997,1.166980},
  480. {-0.005000,0.031999,-0.004000,11.500181,-0.699883,104.700279,0.777998,1.940997,1.166980},
  481. {0.010999,0.066999,0.011999,11.500181,-0.699883,104.700279,1.211998,1.940997,1.335980},
  482. {-0.014000,0.018999,-0.010000,-1.299805,-0.699883,104.700279,0.680999,1.940997,1.136980},
  483. {0.007999,0.040999,-0.011000,4.400195,-0.699883,104.700279,0.994999,1.940997,1.479980},
  484. {0.007999,0.040999,-0.011000,4.400195,-0.699883,104.700279,0.994999,1.940997,1.479980},
  485. {0.035000,0.037999,0.015999,4.400195,-0.699883,104.700279,0.994999,1.940997,1.479980},
  486. {-0.015999,0.095999,0.004999,4.400195,-0.699883,104.700279,1.552999,1.940997,1.799980},
  487. {-0.015999,0.065999,0.001999,4.400195,-0.699883,104.700279,1.144999,1.940997,1.332981},
  488. {-0.012999,0.078999,0.014999,4.400195,-0.699883,104.700279,1.237999,1.940997,1.332981},
  489. {0.006000,0.044999,0.000999,4.400195,-0.699883,104.700279,1.006999,1.940997,1.332981},
  490. {0.006000,0.044999,-0.011000,4.400195,-0.699883,104.700279,1.006999,1.940997,1.383981},
  491. {0.006000,0.044999,-0.004000,-0.399802,-0.699883,104.700279,0.992999,1.940997,1.624981},
  492. {-0.001999,0.054999,-0.004000,10.600196,-0.699883,104.700279,0.925999,1.940997,1.138981},
  493. {-0.001999,0.043999,-0.004000,10.600196,-0.699883,104.700279,0.925999,1.940997,1.138981},
  494. {-0.001999,0.085999,0.008999,10.600196,-0.699883,104.700279,1.367999,1.940997,1.760981},
  495. {-0.001999,0.085999,0.008999,10.600196,-0.699883,104.700279,1.367999,1.940997,1.760981},
  496. {0.005000,0.042999,-0.000000,6.000197,-0.699883,104.700279,0.925999,1.940997,1.563981},
  497. {-0.006999,0.031999,0.006999,6.000197,-0.699883,104.700279,0.777999,1.940997,1.200981},
  498. {0.001000,0.042999,0.008999,2.900198,-0.699883,104.700279,0.777999,1.940997,1.086981},
  499. {0.001000,0.039999,0.001999,7.600195,-0.699883,104.700279,0.877999,1.940997,0.997981},
  500. {0.016000,0.050999,0.000999,6.100193,-0.699883,104.700279,0.929999,1.940997,1.743982},
  501. {0.002000,0.057999,-0.005000,6.100193,-0.699883,102.100257,0.904999,1.940997,1.470981},
  502. {0.002000,0.041999,0.006999,6.100193,-0.699883,102.100257,0.904999,1.940997,1.470981},
  503. {-0.017999,0.013999,0.006999,6.100193,-0.699883,102.100257,0.638999,1.940997,1.420981},
  504. {-0.009999,0.046999,-0.009000,-1.999806,-0.699883,102.100257,0.896998,1.940997,1.685980},
  505. {0.004000,0.047999,0.010999,10.400196,-0.699883,102.100257,0.841998,1.940997,1.875981},
  506. {0.004000,0.047999,-0.013000,5.700193,-0.699883,102.100257,0.841998,1.940997,1.577981},
  507. {0.004000,0.047999,-0.006000,5.700193,-0.699883,102.100257,0.924998,1.940997,1.577981},
  508. {0.008999,0.080999,0.008999,5.700193,-0.699883,102.100257,1.348998,1.940997,1.577981},
  509. {0.008999,0.044999,-0.009000,-1.499808,-0.699883,102.100257,0.753997,1.940997,1.707981},
  510. {0.008999,0.044999,-0.009000,-1.499808,-0.699883,102.100257,0.753997,1.940997,1.707981},
  511. {0.008999,0.044999,-0.009000,-1.499808,-0.699883,102.100257,0.753997,1.940997,1.707981},
  512. {0.008999,0.044999,-0.009000,-1.499808,-0.699883,102.100257,0.753997,1.940997,1.707981},
  513. {-0.013999,0.038999,-0.015000,6.300191,-0.699883,102.100257,0.858997,1.940997,1.285981},
  514. {-0.013999,0.038999,-0.015000,6.300191,-0.699883,102.100257,0.858997,1.940997,1.285981},
  515. {-0.013999,0.038999,-0.015000,6.300191,-0.699883,102.100257,0.858997,1.940997,1.285981},
  516. {-0.000999,0.047999,-0.002000,4.200191,-0.699883,102.100257,0.858997,1.940997,1.359981},
  517. {-0.000999,0.047999,-0.002000,4.200191,-0.699883,102.100257,0.858997,1.940997,1.359981},
  518. {-0.000999,0.045999,-0.002000,4.200191,-0.699883,102.100257,0.858997,1.940997,1.359981},
  519. {-0.000999,0.045999,-0.002000,4.200191,-0.699883,102.100257,0.858997,1.940997,1.359981},
  520. {-0.017999,0.032999,-0.006000,9.900188,-0.699883,102.100257,0.858997,1.940997,1.359981},
  521. {-0.019999,0.000999,-0.008000,9.900188,-0.699883,102.100257,0.647997,1.940997,1.359981},
  522. {-0.012999,0.039999,-0.003000,7.100187,-0.699883,99.500244,0.828997,1.940997,1.589981},
  523. {0.003000,0.031999,0.014999,7.100187,-0.699883,101.700233,1.082997,1.940997,1.589981},
  524. {0.003000,0.045999,-0.003000,7.100187,-0.699883,101.700233,0.873997,1.940997,1.685981},
  525. {0.003000,0.045999,-0.000000,3.400186,-0.699883,101.800201,0.873997,1.940997,1.863981},
  526. {0.003000,0.045999,-0.000000,3.400186,-0.699883,101.800201,0.873997,1.940997,1.863981},
  527. {-0.014999,0.027999,-0.005000,3.400186,-0.699883,101.800201,0.764998,1.940997,1.582981},
  528. {0.003000,0.072999,0.008999,3.400186,-0.699883,101.800201,1.168997,1.940997,1.582981},
  529. {0.004000,0.025999,-0.016000,3.400186,-0.699883,101.800201,0.743997,1.940997,1.582981},
  530. {0.004000,0.033999,-0.010000,3.400186,-0.699883,101.800201,0.814997,1.940997,1.582981},
  531. {-0.003999,0.031999,-0.008000,-0.599818,-0.699883,101.800201,0.777997,1.940997,1.771981},
  532. {-0.003999,0.025999,-0.002000,-0.599818,-0.699883,101.800201,0.707998,1.940997,1.771981},
  533. {-0.003999,0.049999,-0.007000,-0.599818,-0.699883,101.800201,0.853998,1.940997,1.771981},
  534. {-0.020999,0.003999,-0.003000,7.500179,-0.699883,106.000114,0.589998,1.940997,1.082981},
  535. {-0.009999,0.049999,-0.004000,7.500179,-0.699883,100.800125,0.739998,1.940997,1.788981},
  536. {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
  537. {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
  538. {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
  539. {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
  540. {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
  541. {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
  542. {0.001000,0.054999,-0.000000,7.500179,-0.699883,100.800125,0.900998,1.940997,1.249981},
  543. {0.001000,0.054999,-0.000000,7.500179,-0.699883,100.800125,0.900998,1.940997,1.249981},
  544. {0.001000,0.048999,-0.000000,7.500179,-0.699883,100.800125,0.900998,1.940997,1.249981},
  545. {0.001000,0.048999,-0.000000,7.500179,-0.699883,100.800125,0.900998,1.940997,1.249981},
  546. {0.002000,0.045999,-0.001000,7.500179,-0.699883,100.800125,0.849998,1.940997,1.502981},
  547. {0.002000,0.045999,-0.001000,7.500179,-0.699883,100.800125,0.849998,1.940997,1.502981}
  548. };
  549. /*
  550. *****************************************************************************
  551. */
  552. public OnFilterScriptInit()
  553. {
  554. /// <summary>
  555. /// Nesta callback:
  556. /// - cria todas as TextDraws Globias do servidor;
  557. /// - imprime aviso de carregamento no console.
  558. /// </summary>
  559.  
  560. /// <summary>
  561. /// Cria as TextDraws Globais das algemas.
  562. /// </summary>
  563. CreateGlobalTDHandcuff();
  564. /// <summary>
  565. /// Cria as TextDraws Globais do aviso do método de recuperação
  566. /// das algemas.
  567. /// </summary>
  568. CreateGlobalTDWarningRecovery();
  569.  
  570. /// <summary>
  571. /// Imprime no console confirmação de carregamento do sistema.
  572. /// </summary>
  573. print("\n----------------------------------------");
  574. print(" [B13] Handcuff system loaded");
  575. print("----------------------------------------\n");
  576.  
  577. return 1;
  578. }
  579.  
  580. public OnPlayerConnect(playerid)
  581. {
  582. /// <summary>
  583. /// Nesta callback:
  584. /// - cria todas as TextDraws Privadas do servidor;
  585. /// - reseta as variáveis do jogador de que envolvem as algemas.
  586. /// if(!RESET_TO_DISCONNECT)
  587. /// - identifica se o jogador desconectou algemado, se sim,
  588. /// algema o mesmo novamente.
  589. /// </summary>
  590.  
  591. /// <summary>
  592. /// Cria as TextDraws Privadas das algemas.
  593. /// </summary>
  594. CreatePrivateTDHandcuff(playerid);
  595.  
  596. /// <summary>
  597. /// Reseta todas as variáveis de controle dos métodos que envolvem
  598. /// as algemas.
  599. /// </summary>
  600. ResetPlayerHandcuff(playerid, true);
  601.  
  602. #if !RESET_TO_DISCONNECT
  603. /// <summary>
  604. /// Identifica se o nome do jogador consta na variável de controle dos
  605. /// suspeitos offline de algum outro jogador, caso conste o mesmo é
  606. /// algemado e alerta o responsável pela imobilização.
  607. /// </summary>
  608. new ownerHandcuff, handcuffSlot = -1, i, players, a;
  609.  
  610. for(i = 0, players = GetPlayerPoolSize(); i <= players; i++)
  611. {
  612. if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
  613. {
  614. for(a = 0; a < playerHandcuff[i][E_HANDCUFF_AMOUNT]; a++)
  615. {
  616. if(playerHandcuff[i][E_HANDCUFFED_PLAYERS][a] == TARGET_STATE_OFFLINE)
  617. {
  618. if(!strcmp(playerTargetOffline[i][a], GetNameOfPlayer(playerid)) && !isnull(playerTargetOffline[i][a]))
  619. {
  620. handcuffSlot = a;
  621. ownerHandcuff = i;
  622. break;
  623. }
  624. }
  625. }
  626. }
  627. }
  628.  
  629. if(handcuffSlot != -1)
  630. {
  631. playerHandcuff[ownerHandcuff][E_HANDCUFFED_PLAYERS][handcuffSlot] = playerid;
  632.  
  633. playerTargetOffline[ownerHandcuff][handcuffSlot] = "";
  634.  
  635. cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = true;
  636. cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = ownerHandcuff;
  637.  
  638. SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O jogador %s que você algemou conectou novamente!", GetNameOfPlayer(playerid));
  639. }
  640. #endif
  641.  
  642. return 1;
  643. }
  644.  
  645. public OnPlayerDisconnect(playerid, reason)
  646. {
  647. /// <summary>
  648. /// Nesta callback:
  649. /// - identifica se o jogador em questão algemou algum suspeito, se sim
  650. /// todos que foram algemados pelo mesmo são desalgemados e alertados;
  651. /// - reseta variável de estado do jogador(vivo/morto);
  652. /// - finaliza o método de recuperação das algemas do suspeito morto.
  653. /// if(RESET_TO_DISCONNECT)
  654. /// - desalgema o player caso esteja e alerta o responsável por sua
  655. /// imobilização.
  656. /// if(!RESET_TO_DISCONNECT)
  657. /// - se estiver algemado reseta as variáveis de controle das
  658. /// algemas desse jogador e guarda seu nome para algemar quando
  659. /// conectar novamente.
  660. /// </summary>
  661.  
  662. /// <summary>
  663. /// Identifica se o jogador realizou alguma imbolização, e se for válido
  664. /// desalgema todos os suspeitos imobilizados, alertando-os que o responsável
  665. /// desconcetou. Remove todas as algemas do jogador.
  666. /// </summary>
  667. OwnerHandcuffsDisconnected(playerid);
  668.  
  669. /// <summary>
  670. /// Reseta a variável de controle do estado do jogador(vivo/morto);
  671. /// </summary>
  672. if(playerDeath[playerid]) playerDeath[playerid] = false;
  673.  
  674. /// <summary>
  675. /// Finaliza por completo o método de recuperação das algemas, assim
  676. /// impossibilitando do responsável pela imobilização obter suas
  677. /// algemas de volta.
  678. /// </summary>
  679. if(GetPVarInt(playerid, "waitingSpawn"))
  680. {
  681. new ownerHandcuff = GetPVarInt(playerid, "ownerMyHandcuff"),
  682. myIndex = GetPVarInt(playerid, "myIndexRecover");
  683.  
  684. HideWarningRecovery(ownerHandcuff);
  685.  
  686. if(cuffedPlayer[playerid][E_OWNER_LABEL_INFO] != INVALID_PLAYER_3DTEXT_ID)
  687. DeletePlayer3DTextLabel(ownerHandcuff, cuffedPlayer[playerid][E_OWNER_LABEL_INFO]);
  688.  
  689. cuffedPlayer[playerid][E_OWNER_LABEL_INFO] = INVALID_PLAYER_3DTEXT_ID;
  690.  
  691. targetToRecoverHandcuff[ownerHandcuff][myIndex] = INVALID_PLAYER_ID;
  692. targetToRecoverCurrent[ownerHandcuff] = INVALID_PLAYER_ID;
  693.  
  694. DeletePVar(playerid, "waitingSpawn");
  695. DeletePVar(playerid, "ownerMyHandcuff");
  696. DeletePVar(playerid, "myIndex");
  697. }
  698.  
  699. #if RESET_TO_DISCONNECT
  700. /// <summary>
  701. /// Caso algemado, desalgema o jogador por desconectar e alerta
  702. /// o responsável pela imobilização. As algemas retornam para o
  703. /// responsável.
  704. /// </summary>
  705. UnshacklePlayer(playerid, REASON_DISCONNECT);
  706. #else
  707. /// <summary>
  708. /// Caso algemado, guarda o nome do jogador para ser algemado
  709. /// quando conectar novamente e alerta o responsável pela
  710. /// imobilização. A algema não retorna para o responsável.
  711. /// A mesma continua em uso, mas pode assim descartá-la jogando
  712. /// fora suas chaves.
  713. /// </summary>
  714. if(cuffedPlayer[playerid][E_PLAYER_HANDCUFFED])
  715. {
  716. new ownerHandcuff = cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID];
  717.  
  718. if(ownerHandcuff != INVALID_PLAYER_ID)
  719. {
  720. new handcuffSlot = GetHandcuffSlotOfTarget(ownerHandcuff, playerid);
  721.  
  722. cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = false;
  723. cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
  724.  
  725. if(!~handcuffSlot) return 1;
  726.  
  727. playerHandcuff[ownerHandcuff][E_HANDCUFFED_PLAYERS][handcuffSlot] = TARGET_STATE_OFFLINE;
  728.  
  729. GetPlayerName(playerid, playerTargetOffline[ownerHandcuff][handcuffSlot], MAX_PLAYER_NAME);
  730.  
  731. if(playerHandcuff[ownerHandcuff][E_CURRENT_TARGET] == playerid)
  732. {
  733. if(playerHandcuff[ownerHandcuff][E_HANDCUFFING_TARGET])
  734. {
  735. HideTDTargetClose(ownerHandcuff);
  736.  
  737. SetPVarInt(ownerHandcuff, "finalizeTextActionAnimation_0", true);
  738.  
  739. UnfreezePlayer(ownerHandcuff);
  740.  
  741. RemovePlayerAttachedObject(ownerHandcuff, INDEX_ATTACH_HANDCUFF);
  742.  
  743. SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O jogador %s desconectou enquanto você o algemava, vá em /chaves > 'sobre' para entender melhor.", playerTargetOffline[ownerHandcuff][handcuffSlot]);
  744.  
  745. return 1;
  746. }
  747. }
  748.  
  749. SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O jogador %s que você algemou desconectou, vá em /chaves > 'sobre' para entender melhor.", playerTargetOffline[ownerHandcuff][handcuffSlot]);
  750. }
  751. }
  752. #endif
  753.  
  754. return 1;
  755. }
  756.  
  757. public OnPlayerSpawn(playerid)
  758. {
  759. /// <summary>
  760. /// Nesta callback:
  761. /// - carrega a livraria de todas animações utilizadas no jogador;
  762. /// - caso o jogador esteja algemado é chamado método para colocar
  763. /// suas algemas e alertá-lo;
  764. /// - caso não esteja algemado, remove se em uso os objetos das
  765. /// algemas;
  766. /// - finaliza o método de recuperação das algemas do suspeito
  767. /// morto;
  768. /// - reseta variável de estado do jogador(vivo/morto).
  769. /// </summary>
  770.  
  771. /// <summary>
  772. /// Carrega a livraria de cada animação utilizada. Isso evita problemas
  773. /// com a aplicação das mesmas pela primeira vez.
  774. /// </summary>
  775. LoadPlayerAnimations(playerid);
  776.  
  777. /// <summary>
  778. /// Caso o jogador esteja algemado(o que óbviamente indica que o mesmo
  779. /// desconectou algemado) algema o mesmo novamente e alerta por quem
  780. /// foi algemado e o horário da imobilização.
  781. /// Caso o jogador não esteja, apenas é aplicado uma verificação se
  782. /// o slot do attach da algema está em uso, se sim é removido.
  783. /// </summary>
  784. if(cuffedPlayer[playerid][E_PLAYER_HANDCUFFED])
  785. {
  786. SetTimerEx("SetTargetHandcuff", 1000, false, "i", playerid);
  787. }
  788. else
  789. {
  790. if(IsPlayerAttachedObjectSlotUsed(playerid, INDEX_ATTACH_HANDCUFF))
  791. RemovePlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF);
  792. }
  793.  
  794. /// <summary>
  795. /// Da fim ao método de recuperação das algemas ao responsável pelo
  796. /// fato do suspeito ter dado respawn.
  797. /// </summary>
  798. if(GetPVarInt(playerid, "waitingSpawn"))
  799. {
  800. new ownerHandcuff = GetPVarInt(playerid, "ownerMyHandcuff"),
  801. myIndex = GetPVarInt(playerid, "myIndexRecover");
  802.  
  803. HideWarningRecovery(ownerHandcuff);
  804.  
  805. if(cuffedPlayer[playerid][E_OWNER_LABEL_INFO] != INVALID_PLAYER_3DTEXT_ID)
  806. DeletePlayer3DTextLabel(ownerHandcuff, cuffedPlayer[playerid][E_OWNER_LABEL_INFO]);
  807.  
  808. cuffedPlayer[playerid][E_OWNER_LABEL_INFO] = INVALID_PLAYER_3DTEXT_ID;
  809.  
  810. targetToRecoverHandcuff[ownerHandcuff][myIndex] = INVALID_PLAYER_ID;
  811. targetToRecoverCurrent[ownerHandcuff] = INVALID_PLAYER_ID;
  812.  
  813. DeletePVar(playerid, "waitingSpawn");
  814. DeletePVar(playerid, "ownerMyHandcuff");
  815. DeletePVar(playerid, "myIndexRecover");
  816. }
  817.  
  818. /// <summary>
  819. /// Reseta a variável de controle do estado do jogador(vivo/morto);
  820. /// </summary>
  821. if(playerDeath[playerid]) playerDeath[playerid] = false;
  822.  
  823. return 1;
  824. }
  825.  
  826. public OnPlayerDeath(playerid)
  827. {
  828. /// <summary>
  829. /// Nesta callback:
  830. /// - caso player esteja algemado é chamado método para removar as
  831. /// algemas e alertar o dono das mesmas;
  832. /// - reseta variável de estado do jogador(vivo/morto).
  833. /// </summary>
  834.  
  835. /// <summary>
  836. /// Caso algemado, desalgema o jogador por morrer e alerta o responsável
  837. /// pela imobilização. É dado início ao método de recuperação das algemas
  838. /// caso o responsável esteja 40m próximo do suspeito algemado.
  839. /// </summary>
  840. UnshacklePlayer(playerid, REASON_DEATH);
  841.  
  842. /// <summary>
  843. /// Reseta a variável de controle do estado do jogador(vivo/morto);
  844. /// </summary>
  845. playerDeath[playerid] = true;
  846.  
  847. return 1;
  848. }
  849.  
  850. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  851. {
  852. /// <summary>
  853. /// Nesta callback:
  854. /// - caso jogador pressionar a telca KEY_NO e estiver com um
  855. /// suspeito morto como alvo atual ele recupera suas algemas
  856. /// e finaliza método de recuperação;
  857. /// - caso jogador pressionar a telca KEY_NO e estiver com um
  858. /// suspeito desalgemado como alvo atual é dado início ao
  859. /// méotodo de algemamento ao mesmo;
  860. /// - caso jogador pressionar a telca KEY_NO e estiver com um
  861. /// suspeito que algemou como alvo atual é dado início ao
  862. /// método de desalgemamento do mesmo.
  863. /// </summary>
  864.  
  865. /// <summary>
  866. /// Quando teclado KEY_NO:
  867. /// Se o jogador tiver como alvo um suspeito morto que ainda não
  868. /// deu respawn, as algemas são recuperadas e é finalizado o método
  869. /// de recuperação.
  870. /// Se o jogador tiver como alvo um suspeito que algemou é dado
  871. /// início ao método de desalgemamento do mesmo.
  872. /// Se o jogador tiver como alvo um suspeito que não esteja algemado
  873. /// é dado início ao método de algemamento do mesmo.
  874. /// </summary>
  875. if ((newkeys & KEY_NO) && !(oldkeys & KEY_NO))
  876. {
  877. if(targetToRecoverCurrent[playerid] != INVALID_PLAYER_ID)
  878. {
  879. HideWarningRecovery(playerid);
  880.  
  881. new targetRecover = targetToRecoverCurrent[playerid];
  882.  
  883. targetToRecoverHandcuff[playerid][GetPVarInt(targetRecover, "myIndexRecover")] = INVALID_PLAYER_ID;
  884. targetToRecoverCurrent[playerid] = INVALID_PLAYER_ID;
  885.  
  886. DeletePVar(targetRecover, "waitingSpawn");
  887. DeletePVar(targetRecover, "ownerMyHandcuff");
  888. DeletePVar(targetRecover, "myIndex");
  889.  
  890. ApplyAnimation(playerid, "BOMBER", "BOM_Plant_2Idle", 4.1, 0, 0, 0, 1, 700, 1);
  891.  
  892. SetTimerEx("FinalizeRecoverHandcuff", 700, false, "ii", playerid, targetRecover);
  893.  
  894. return 1;
  895. }
  896.  
  897. if(playerHandcuff[playerid][E_HAVE_HANDCUFF] && IsPlayerWithHandcuffsInHands(playerid) &&
  898. playerHandcuff[playerid][E_HANDCUFF_AMOUNT] > 0 && playerHandcuff[playerid][E_HANDCUFFS_USED] < playerHandcuff[playerid][E_HANDCUFF_AMOUNT])
  899. {
  900. if(!playerHandcuff[playerid][E_HANDCUFFING_TARGET] && !playerHandcuff[playerid][E_UNSHACKLING_TARGET])
  901. {
  902. new target = playerHandcuff[playerid][E_CURRENT_TARGET];
  903.  
  904. if(target != INVALID_PLAYER_ID)
  905. {
  906. if(cuffedPlayer[target][E_PLAYER_HANDCUFFED])
  907. {
  908. if(cuffedPlayer[target][E_OWNER_HANDCUFF_ID] == playerid) UnshackleTarget(playerid, target);
  909. else HideTDTargetClose(playerid);
  910.  
  911. return 1;
  912. }
  913.  
  914. ToHandcuffTarget(playerid, target);
  915. }
  916. }
  917. }
  918. }
  919.  
  920. return 1;
  921. }
  922.  
  923. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  924. {
  925. /// <summary>
  926. /// Nesta callback:
  927. /// - aplicações do menu 'Suspeitos Algemados' apresentado pelo
  928. /// método 'ListPlayerHandcuffKeys'.
  929. /// </summary>
  930. switch(dialogid)
  931. {
  932. /// <summary>
  933. /// Lista de suspeitos algemados e é apresentado opções para ver
  934. /// informações da imobilização e até ações sobre as chaves das
  935. /// algemas desse suspeito. Ha também a opção 'sobre' para
  936. /// entender melhor como funciona as imbolizações.
  937. /// </summary>
  938. case DIALOG_SUSPECTS_CUFFED:
  939. {
  940. if(!response)
  941. {
  942. DeletePVar(playerid, "DIALOG_TARGET_HANDCUFF_SLOT");
  943. return 1;
  944. }
  945.  
  946. new handcuffSlot = playerHandcuff[playerid][E_AUX_TARGET_HANDCUFF_SLOT][listitem],
  947. target,
  948. targetName[MAX_PLAYER_NAME],
  949. caption[60];
  950.  
  951. target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot];
  952.  
  953. if(listitem == GetPVarInt(playerid, "DIALOG_LISTITEM_ABOUT"))
  954. {
  955. #if RESET_TO_DISCONNECT
  956. new string[676];
  957.  
  958. strcat(string, "Aqui você poderá ter controle sobre os suspeitos que algemar.\n");
  959. strcat(string, "Você poderá saber qual o horário em que a imobilização ocorreu\n");
  960. strcat(string, "e também a quanto tempo o suspeito em questão está algemado.\n\n");
  961.  
  962. strcat(string, "Veja alguns atos que podem remover a algema do suspeito:\n\n");
  963. strcat(string, "{E84F33}Suspeito algemado desconecta{BCD2EE}: O mesmo será desalgemado e a\nalgema utilizada será devolvida.\n\n");
  964. strcat(string, "{E84F33}Suspeito algemado morre{BCD2EE}: O mesmo será desalgemado e as algemas\npoderão ser recuperadas caso esteja próximo do suspeito e tecle N\nem seu cadáver, caso contrário as mesmas serão perdidas.\n\n");
  965. strcat(string, "{E84F33}Você desconecta{BCD2EE}: Todos os suspeitos que você algemou serão\ndesalgemados e perderá todas suas algemas.");
  966. #else
  967. new string[1272];
  968.  
  969. strcat(string, "Aqui você poderá ter controle sobre os suspeitos que algemar.\n");
  970. strcat(string, "Você poderá saber qual o horário em que a imobilização ocorreu\n");
  971. strcat(string, "e também a quanto tempo o suspeito em questão está algemado.\n\n");
  972.  
  973. strcat(string, "Caso o suspeito desconecte quando algemado, você ainda ficará\n");
  974. strcat(string, "com as chaves das algemas dele, e assim que o mesmo conectar\n");
  975. strcat(string, "novamente, será algemado automaticamente.\n");
  976. strcat(string, "Contudo, você tem a opção de descartar as chaves, e quando o\n");
  977. strcat(string, "suspeito conectar novamente não estará mais algemado. Descartar\n");
  978. strcat(string, "as chaves resultará na perca das algemas utilizadas no mesmo.\n\n");
  979.  
  980. strcat(string, "Veja alguns atos que podem manter/remover as algemas do suspeito:\n\n");
  981. strcat(string, "{E84F33}Suspeito desconecta enquanto é algemado{BCD2EE}: Isso não irá interfeirir.\nUma vez que dado início a imobilização, perda de conexão não afetará\ntal ação.\n\n");
  982. strcat(string, "{E84F33}Suspeito algemado desconecta{BCD2EE}: O suspeito continuará algemado e\nao conectar será algemado automaticamente. Caso as chaves forem\ndescartadas, este será desalgemado.\n\n");
  983. strcat(string, "{E84F33}Suspeito algemado morre{BCD2EE}: O mesmo será desalgemado e as algemas\npoderão ser recuperadas caso esteja próximo do suspeito e tecle N\nem seu cadáver, caso contrário as mesmas serão perdidas.\n\n");
  984. strcat(string, "{E84F33}Você desconecta{BCD2EE}: Todos os suspeitos que você algemou serão\ndesalgemados e perderá todas suas algemas.");
  985. #endif
  986.  
  987. ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Sobre", string, "Voltar", "");
  988.  
  989. return 1;
  990. }
  991.  
  992. if(target == TARGET_STATE_OFFLINE)
  993. {
  994. #if !RESET_TO_DISCONNECT
  995. format(targetName, MAX_PLAYER_NAME, playerTargetOffline[playerid][handcuffSlot]);
  996. #endif
  997. }
  998. else
  999. {
  1000. format(targetName, MAX_PLAYER_NAME, GetNameOfPlayer(target));
  1001.  
  1002. if(!IsPlayerConnected(target))
  1003. return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
  1004. }
  1005.  
  1006. SetPVarInt(playerid, "DIALOG_TARGET_HANDCUFF_SLOT", handcuffSlot);
  1007.  
  1008. format(caption, 60, "Detalhes suspeito [{E84F33}%s{B9C9BF}]", targetName);
  1009.  
  1010. #if RESET_TO_DISCONNECT
  1011. new info[120];
  1012.  
  1013. format(info, 120, "Suspeito algemado a {E84F33}%s{BCD2EE}\nA imobilização ocorreu as {E84F33}%s", timec(playerHandcuff[playerid][E_TIMESTAMP_CUFFED][handcuffSlot]), playerHandcuff[playerid][E_TIME_CUFFED][handcuffSlot]);
  1014.  
  1015. ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, caption, info, "Voltar", "");
  1016. #else
  1017. ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+1, DIALOG_STYLE_LIST, caption, "Informações\nDescartar chaves", "Selecionar", "Voltar");
  1018. #endif
  1019. }
  1020.  
  1021. /// <summary>
  1022. /// Ver informações da imobilização do suspeito algemado ou descartar
  1023. /// as chavas das algemas do mesmo.
  1024. /// </summary>
  1025. case DIALOG_SUSPECTS_CUFFED+1:
  1026. {
  1027. if(!response)
  1028. {
  1029. DeletePVar(playerid, "DIALOG_TARGET_HANDCUFF_SLOT");
  1030.  
  1031. if(playerHandcuff[playerid][E_HANDCUFFS_USED] > 0) ListPlayerHandcuffKeys(playerid);
  1032.  
  1033. return 1;
  1034. }
  1035.  
  1036. new target,
  1037. targetName[MAX_PLAYER_NAME],
  1038. handcuffSlot = GetPVarInt(playerid, "DIALOG_TARGET_HANDCUFF_SLOT"),
  1039. caption[59],
  1040. info[120];
  1041.  
  1042. target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot];
  1043. if(target == TARGET_STATE_OFFLINE)
  1044. {
  1045. #if !RESET_TO_DISCONNECT
  1046. format(targetName, MAX_PLAYER_NAME, playerTargetOffline[playerid][handcuffSlot]);
  1047. #endif
  1048. }
  1049. else
  1050. {
  1051. if(!IsPlayerConnected(target))
  1052. return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
  1053.  
  1054. format(targetName, MAX_PLAYER_NAME, GetNameOfPlayer(target));
  1055. }
  1056.  
  1057. if(listitem == 0)//Informações da imobilização
  1058. {
  1059. format(caption, 55, "Informações [{E84F33}%s{B9C9BF}]", targetName);
  1060. format(info, 120, "Suspeito algemado a {E84F33}%s{BCD2EE}\nA imobilização ocorreu as {E84F33}%s", timec(playerHandcuff[playerid][E_TIMESTAMP_CUFFED][handcuffSlot]), playerHandcuff[playerid][E_TIME_CUFFED][handcuffSlot]);
  1061.  
  1062. ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+2, DIALOG_STYLE_MSGBOX, caption, info, "Voltar", "");
  1063. }
  1064. else//Descartar chaves
  1065. {
  1066. format(caption, 59, "Descartar chaves [{E84F33}%s{B9C9BF}]", targetName);
  1067.  
  1068. #if !RESET_TO_DISCONNECT
  1069. if(target != TARGET_STATE_OFFLINE)
  1070. return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+2, DIALOG_STYLE_MSGBOX, caption, "Você não pode descartar as chaves das algemas de um suspeito conectado!\n\nCaso deseje desalgemá-lo, aproxime-se do mesmo e tecle {E84F33}N{BCD2EE}.", "Voltar", "");
  1071. #else
  1072. if(!IsPlayerConnected(target))
  1073. return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
  1074. #endif
  1075.  
  1076. ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+3, DIALOG_STYLE_MSGBOX, caption, "Você tem certeza que deseja descartar as chaves das\nalgemas desse suspeito?\n\nQuando o mesmo conectar novamente será desalgemado.\n\n{E84F33}OBS{BCD2EE}: O par de algemas utilizado será perdido!", "Descartar", "Cancelar");
  1077. }
  1078. }
  1079.  
  1080. /// <summary>
  1081. /// Informações selecionadas são apresentadas, com botão para voltar
  1082. /// às outras opções.
  1083. /// </summary>
  1084. case DIALOG_SUSPECTS_CUFFED+2:
  1085. {
  1086. new target,
  1087. targetName[MAX_PLAYER_NAME],
  1088. handcuffSlot = GetPVarInt(playerid, "DIALOG_TARGET_HANDCUFF_SLOT"),
  1089. caption[60];
  1090.  
  1091. target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot];
  1092. if(target == TARGET_STATE_OFFLINE)
  1093. {
  1094. #if !RESET_TO_DISCONNECT
  1095. format(targetName, MAX_PLAYER_NAME, playerTargetOffline[playerid][handcuffSlot]);
  1096. #endif
  1097. }
  1098. else
  1099. {
  1100. if(!IsPlayerConnected(target))
  1101. return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
  1102.  
  1103. format(targetName, MAX_PLAYER_NAME, GetNameOfPlayer(target));
  1104. }
  1105.  
  1106. format(caption, 60, "Detalhes suspeito [{E84F33}%s{B9C9BF}]", targetName);
  1107.  
  1108. ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+1, DIALOG_STYLE_LIST, caption, "Informações\nDescartar chaves", "Selecionar", "Voltar");
  1109. }
  1110.  
  1111. /// <summary>
  1112. /// Confirmação para descartar as chaves das algemas de um suspeito
  1113. /// que estiver desconectado.
  1114. /// </summary>
  1115. case DIALOG_SUSPECTS_CUFFED+3:
  1116. {
  1117. new target,
  1118. targetName[MAX_PLAYER_NAME],
  1119. handcuffSlot = GetPVarInt(playerid, "DIALOG_TARGET_HANDCUFF_SLOT"),
  1120. caption[60];
  1121.  
  1122. target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot];
  1123. if(target == TARGET_STATE_OFFLINE)
  1124. {
  1125. #if !RESET_TO_DISCONNECT
  1126. format(targetName, MAX_PLAYER_NAME, playerTargetOffline[playerid][handcuffSlot]);
  1127. #endif
  1128. }
  1129. else
  1130. {
  1131. if(!IsPlayerConnected(target))
  1132. return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
  1133.  
  1134. format(targetName, MAX_PLAYER_NAME, GetNameOfPlayer(target));
  1135. }
  1136.  
  1137. if(!response)
  1138. {
  1139. format(caption, 60, "Detalhes suspeito [{E84F33}%s{B9C9BF}]", targetName);
  1140.  
  1141. return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+1, DIALOG_STYLE_LIST, caption, "Informações\nDescartar chaves", "Selecionar", "Voltar");
  1142. }
  1143.  
  1144. format(caption, 59, "Descartar chaves [{E84F33}%s{B9C9BF}]", targetName);
  1145.  
  1146. if(target != TARGET_STATE_OFFLINE)
  1147. return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+2, DIALOG_STYLE_MSGBOX, caption, "Você não pode descartar as chaves das algemas de um suspeito conectado!\n\nCaso deseje desalgemá-lo, aproxime-se do mesmo e tecle {E84F33}N{BCD2EE}.", "Voltar", "");
  1148.  
  1149. playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot] = INVALID_PLAYER_ID;
  1150. playerHandcuff[playerid][E_HANDCUFFS_USED]--;
  1151. playerHandcuff[playerid][E_HANDCUFF_AMOUNT]--;
  1152.  
  1153. #if !RESET_TO_DISCONNECT
  1154. playerTargetOffline[playerid][handcuffSlot] = "";
  1155. #endif
  1156.  
  1157. ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
  1158.  
  1159. ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, caption, "As chaves das algemas do suspeito foram descartadas!", "Confirmar", "");
  1160. }
  1161.  
  1162. /// <summary>
  1163. /// Voltar ao ínicio da lista.
  1164. /// </summary>
  1165. case DIALOG_SUSPECTS_CUFFED+4:
  1166. {
  1167. DeletePVar(playerid, "DIALOG_TARGET_HANDCUFF_SLOT");
  1168.  
  1169. if(playerHandcuff[playerid][E_HANDCUFFS_USED] > 0) ListPlayerHandcuffKeys(playerid);
  1170. }
  1171.  
  1172. /// <summary>
  1173. /// Ver jogadores algemados ou responsáveis pelas imobilizações.
  1174. /// </summary>
  1175. case DIALOG_PANEL_HANDCUFFS:
  1176. {
  1177. if(!response) return 1;
  1178.  
  1179. if(!listitem)//Jogadores algemados
  1180. {
  1181. new
  1182. #if !RESET_TO_DISCONNECT
  1183. string[32 + MAX_PLAYERS * 54],
  1184. #else
  1185. string[21 + MAX_PLAYERS * 32],
  1186. #endif
  1187. strAux[55],
  1188. index;
  1189.  
  1190.  
  1191. #if !RESET_TO_DISCONNECT
  1192. format(string, 32, "Jogador algemado\tID\tConectado");
  1193. #else
  1194. format(string, 21, "Jogador algemado\tID");
  1195. #endif
  1196.  
  1197. for(new i; i < MAX_PLAYERS; i++) handcuffPanelId[playerid][i] = INVALID_PLAYER_ID, handcuffPanelName[playerid][i] = "";
  1198.  
  1199. for(new i; i <= GetPlayerPoolSize(); i++)
  1200. {
  1201. if(cuffedPlayer[i][E_PLAYER_HANDCUFFED])
  1202. {
  1203. #if !RESET_TO_DISCONNECT
  1204. format(strAux, 54, "\n%s\t%d\t{158C00}SIM{A9C4E4}", GetNameOfPlayer(i), i);
  1205. #else
  1206. format(strAux, 32, "\n%s\t%d", GetNameOfPlayer(i), i);
  1207. #endif
  1208.  
  1209. strcat(string, strAux);
  1210. handcuffPanelId[playerid][index] = i;
  1211. index++;
  1212. }
  1213. }
  1214. #if !RESET_TO_DISCONNECT
  1215. for(new i, a; i <= GetPlayerPoolSize(); i++)
  1216. {
  1217. if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
  1218. {
  1219. for(a = 0; a < playerHandcuff[i][E_HANDCUFF_AMOUNT]; a++)
  1220. {
  1221. if(playerHandcuff[i][E_HANDCUFFED_PLAYERS][a] == TARGET_STATE_OFFLINE)
  1222. {
  1223. if(!isnull(playerTargetOffline[i][a]))
  1224. {
  1225. format(strAux, 53, "\n%s\t-\t{E84F33}NÃO{A9C4E4}", playerTargetOffline[i][a]);
  1226.  
  1227. strcat(string, strAux);
  1228.  
  1229. format(handcuffPanelName[playerid][index], MAX_PLAYER_NAME, playerTargetOffline[i][a]);
  1230. index++;
  1231. }
  1232. }
  1233. }
  1234. }
  1235. }
  1236. #endif
  1237.  
  1238. if(!index)
  1239. return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Não há nenhum jogador algemado!", "Voltar", "");
  1240.  
  1241. return
  1242. ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+1, DIALOG_STYLE_TABLIST_HEADERS, "Handcuff System - Painel", string, "Detalhes", "Voltar");
  1243. }
  1244. else//Responsáveis pelas imobilizações
  1245. {
  1246. new string[(34 + MAX_HANDCUFFS * 2) + MAX_PLAYERS * 38],
  1247. strAux[38],
  1248. index;
  1249.  
  1250. format(string, 31, "Jogador\tID\tAlgemas utilizadas");
  1251.  
  1252. for(new i; i <= GetPlayerPoolSize(); i++)
  1253. {
  1254. if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
  1255. {
  1256. format(strAux, 34 + MAX_HANDCUFFS * 2, "\n%s\t%d\t%d/%d", GetNameOfPlayer(i), i, playerHandcuff[i][E_HANDCUFFS_USED], playerHandcuff[i][E_HANDCUFF_AMOUNT]);
  1257.  
  1258. strcat(string, strAux);
  1259. handcuffPanelId[playerid][index] = i;
  1260. index++;
  1261. }
  1262. }
  1263.  
  1264. if(!index)
  1265. return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Nenhuma imobilização foi realizada ainda!", "Voltar", "");
  1266.  
  1267. ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+2, DIALOG_STYLE_TABLIST_HEADERS, "Handcuff System - Painel", string, "Detalhes", "Voltar");
  1268. }
  1269.  
  1270. }
  1271.  
  1272. /// <summary>
  1273. /// Informações do jogador algemado selecionado.
  1274. /// </summary>
  1275. case DIALOG_PANEL_HANDCUFFS+1:
  1276. {
  1277. if(!response)
  1278. return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS, DIALOG_STYLE_LIST, "Handcuff System - Painel", "Ver jogadores algemados\nVer responsáveis pelas imobilizações", "Selecionar", "Fechar");
  1279.  
  1280. new id = handcuffPanelId[playerid][listitem];
  1281.  
  1282. if(id == INVALID_PLAYER_ID)
  1283. {
  1284. #if !RESET_TO_DISCONNECT
  1285. if(!isnull(handcuffPanelName[playerid][listitem]))
  1286. {
  1287. new ownerHandcuff,
  1288. handcuffSlot;
  1289.  
  1290. for(new i, a; i <= GetPlayerPoolSize(); i++)
  1291. {
  1292. if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
  1293. {
  1294. for(a = 0; a < playerHandcuff[i][E_HANDCUFF_AMOUNT]; a++)
  1295. {
  1296. if(playerHandcuff[i][E_HANDCUFFED_PLAYERS][a] == TARGET_STATE_OFFLINE)
  1297. {
  1298. if(!strcmp(playerTargetOffline[i][a], handcuffPanelName[playerid][listitem]) && !isnull(playerTargetOffline[i][a]))
  1299. {
  1300. handcuffSlot = a;
  1301. ownerHandcuff = i;
  1302. break;
  1303. }
  1304. }
  1305. }
  1306. }
  1307. }
  1308.  
  1309. if(!~handcuffSlot)
  1310. return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Erro ao acessar informações sobre esse jogador.", "Voltar", "");
  1311.  
  1312. new info[184], caption[67];
  1313.  
  1314. format(info, 184, "Suspeito algemado por {E84F33}%s{BCD2EE}\nSuspeito algemado a {E84F33}%s{BCD2EE}\nA imobilização ocorreu as {E84F33}%s", GetNameOfPlayer(ownerHandcuff), timec(playerHandcuff[ownerHandcuff][E_TIMESTAMP_CUFFED][handcuffSlot]), playerHandcuff[ownerHandcuff][E_TIME_CUFFED][handcuffSlot]);
  1315. format(caption, 67, "Handcuff System - Painel [{E84F33}%s{BCD2EE}]", handcuffPanelName[playerid][listitem]);
  1316.  
  1317. return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, caption, info, "Voltar", "");
  1318. }
  1319. #endif
  1320.  
  1321. return
  1322. ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Erro ao acessar informações sobre esse jogador.", "Voltar", "");
  1323. }
  1324. #if RESET_TO_DISCONNECT
  1325. if(!IsPlayerConnected(id) || !cuffedPlayer[i][E_PLAYER_HANDCUFFED])
  1326. return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Esse jogador não está mais algemado.", "Voltar", "");
  1327. #endif
  1328.  
  1329. new ownerHandcuff,
  1330. handcuffSlot;
  1331.  
  1332. ownerHandcuff = cuffedPlayer[id][E_OWNER_HANDCUFF_ID];
  1333.  
  1334. handcuffSlot = GetHandcuffSlotOfTarget(ownerHandcuff, id);
  1335.  
  1336. if(!~handcuffSlot)
  1337. return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Erro ao acessar informações sobre esse jogador.", "Voltar", "");
  1338.  
  1339. new info[184], caption[67];
  1340.  
  1341. format(info, 184, "Suspeito algemado por {E84F33}%s{BCD2EE}\nSuspeito algemado a {E84F33}%s{BCD2EE}\nA imobilização ocorreu as {E84F33}%s", GetNameOfPlayer(ownerHandcuff), timec(playerHandcuff[ownerHandcuff][E_TIMESTAMP_CUFFED][handcuffSlot]), playerHandcuff[ownerHandcuff][E_TIME_CUFFED][handcuffSlot]);
  1342. format(caption, 67, "Handcuff System - Painel [{E84F33}%s{BCD2EE}]", GetNameOfPlayer(id));
  1343.  
  1344. ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, caption, info, "Voltar", "");
  1345. }
  1346.  
  1347. /// <summary>
  1348. /// Jogadores algemados pelo jogador responsável selecionado.
  1349. /// </summary>
  1350. case DIALOG_PANEL_HANDCUFFS+2:
  1351. {
  1352. if(!response)
  1353. return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS, DIALOG_STYLE_LIST, "Handcuff System - Painel", "Ver jogadores algemados\nVer responsáveis pelas imobilizações", "Selecionar", "Fechar");
  1354.  
  1355. new
  1356. #if !RESET_TO_DISCONNECT
  1357. string[32 + MAX_PLAYERS * 52],
  1358. #else
  1359. string[21 + MAX_PLAYERS * 31],
  1360. #endif
  1361. strAux[75],
  1362. bool:found;
  1363.  
  1364. #if !RESET_TO_DISCONNECT
  1365. format(string, 32, "Jogador algemado\tID\tConectado");
  1366. #else
  1367. format(string, 21, "Jogador algemado\tID");
  1368. #endif
  1369.  
  1370. listitem = handcuffPanelId[playerid][listitem];
  1371.  
  1372. for(new i, target; i < playerHandcuff[listitem][E_HANDCUFF_AMOUNT]; i++)
  1373. {
  1374. target = playerHandcuff[listitem][E_HANDCUFFED_PLAYERS][i];
  1375. if(target != INVALID_PLAYER_ID)
  1376. {
  1377. if(target == TARGET_STATE_OFFLINE)
  1378. {
  1379. format(strAux, 51, "\n%s\t-\t{E84F33}NÃO{A9C4E4}", playerTargetOffline[listitem][i]);
  1380. }
  1381. else
  1382. {
  1383. #if !RESET_TO_DISCONNECT
  1384. format(strAux, 52, "\n%s\t%d\t{158C00}SIM{A9C4E4}", GetNameOfPlayer(target), target);
  1385. #else
  1386. format(strAux, 31, "\n%s\t%d", GetNameOfPlayer(target), target);
  1387. #endif
  1388. }
  1389.  
  1390. strcat(string, strAux);
  1391. if(!found) found = true;
  1392. }
  1393. }
  1394.  
  1395. if(!found)
  1396. return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Erro ao acessar informações sobre as imobilizações desse jogador.", "Voltar", "");
  1397.  
  1398. format(strAux, 75, "Handcuff System - Painel [{E84F33}%s{BCD2EE} algemou]", GetNameOfPlayer(listitem));
  1399.  
  1400. ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_TABLIST_HEADERS, strAux, string, "Voltar", "");
  1401. }
  1402.  
  1403. /// <summary>
  1404. /// Voltar ao ínicio do painel.
  1405. /// </summary>
  1406. case DIALOG_PANEL_HANDCUFFS+3:
  1407. {
  1408. ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS, DIALOG_STYLE_LIST, "Handcuff System - Painel", "Ver jogadores algemados\nVer responsáveis pelas imobilizações", "Selecionar", "Fechar");
  1409. }
  1410. }
  1411.  
  1412. return 1;
  1413. }
  1414. /*
  1415. *****************************************************************************
  1416. */
  1417. /// <summary>
  1418. /// Timer para procurar suspeitos mortos e recuperar as algemas.
  1419. /// O jogador deve estar na parte de trás do corpo do suspeito
  1420. /// para recuperar.
  1421. /// Intervalo: 500ms
  1422. /// </summary>
  1423. /// <param name="playerid">ID do jogador que está a recuperar algum par de algemas.</param>
  1424. /// <returns>Não retorna valores.</returns>
  1425. call:FindTargetToRecoverHandcuff(playerid)
  1426. {
  1427. if(targetToRecoverCurrent[playerid] != INVALID_PLAYER_ID)
  1428. {
  1429. if(ValidateTargetInFront(playerid, targetToRecoverCurrent[playerid], true))
  1430. goto skip_to_end;
  1431. else
  1432. HideWarningRecovery(playerid), targetToRecoverCurrent[playerid] = INVALID_PLAYER_ID;
  1433. }
  1434.  
  1435. new i, bool:found;
  1436.  
  1437. for(i = 0; i < MAX_HANDCUFFS; i++)
  1438. {
  1439. if(targetToRecoverHandcuff[playerid][i] != INVALID_PLAYER_ID)
  1440. {
  1441. found = true;
  1442. break;
  1443. }
  1444. }
  1445.  
  1446. if(!found) return;
  1447.  
  1448. new a, players, Float:pos[3];
  1449.  
  1450. players = GetPlayerPoolSize();
  1451.  
  1452. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  1453.  
  1454. for(i = 0; i <= players; i++)
  1455. {
  1456. if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 5.0, pos[0], pos[1], pos[2]) && i != playerid)
  1457. {
  1458. if(playerHandcuff[playerid][E_CURRENT_TARGET] != INVALID_PLAYER_ID || !ValidateTargetInFront(playerid, i, true)) continue;
  1459.  
  1460. for(a = 0; a < MAX_HANDCUFFS; a++)
  1461. {
  1462. if(targetToRecoverHandcuff[playerid][a] == i)
  1463. {
  1464. targetToRecoverCurrent[playerid] = i;
  1465.  
  1466. ShowWarningRecovery(playerid);
  1467.  
  1468. break;
  1469. }
  1470. }
  1471. }
  1472. }
  1473.  
  1474. skip_to_end:
  1475.  
  1476. SetTimerEx("FindTargetToRecoverHandcuff", 500, false, "i", playerid);
  1477. }
  1478. /// <summary>
  1479. /// Timer procura suspeitos para algemar/desalgemar. O jogador
  1480. /// deve estar posicionado na parte de trás do corpo do suspeito
  1481. /// para ser um alvo válido.
  1482. /// Intervalo: 500ms
  1483. /// </summary>
  1484. /// <param name="playerid">ID do jogador que está a procurar por suspeitos.</param>
  1485. /// <returns>Não retorna valores.</returns>
  1486. call:FindPlayerToHandcuff(playerid)
  1487. {
  1488. if(playerHandcuff[playerid][E_HANDCUFFING_TARGET] || playerHandcuff[playerid][E_UNSHACKLING_TARGET]) goto skip_to_end;
  1489.  
  1490. if(!IsPlayerWithHandcuffsInHands(playerid))
  1491. {
  1492. HideTDTargetClose(playerid);
  1493. return;
  1494. }
  1495.  
  1496. if(playerHandcuff[playerid][E_CURRENT_TARGET] != INVALID_PLAYER_ID)
  1497. {
  1498. if(RevalidateCurrentTarget(playerid))
  1499. goto skip_to_end;
  1500. else
  1501. HideTDTargetClose(playerid);
  1502. }
  1503.  
  1504. new i, players, Float:pos[3];
  1505.  
  1506. players = GetPlayerPoolSize();
  1507.  
  1508. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  1509.  
  1510. for(i = 0; i <= players; i++)
  1511. {
  1512. if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 5.0, pos[0], pos[1], pos[2]) && i != playerid)
  1513. {
  1514. if(!ValidateTargetInFront(playerid, i)) continue;
  1515.  
  1516. if(targetToRecoverCurrent[playerid] != INVALID_PLAYER_ID || playerDeath[i]) continue;
  1517.  
  1518. NewTargetFound(playerid, i);
  1519.  
  1520. break;
  1521. }
  1522. }
  1523.  
  1524. skip_to_end:
  1525.  
  1526. SetTimerEx("FindPlayerToHandcuff", 500, false, "i", playerid);
  1527. }
  1528. /// <summary>
  1529. /// Callback que finaliza o método de algemamento de um suspeito.
  1530. /// É dado um intervalo combinado com o final da animação de
  1531. /// imobilização do jogador.
  1532. /// Intervalo: 2600ms.
  1533. /// </summary>
  1534. /// <param name="playerid">ID do jogador.</param>
  1535. /// <param name="target">ID do suspeito.</param>
  1536. /// <param name="auxHandcuffSlot">Variável auxiliar que carrega o valor do slot das algemas do suspeito.</param>
  1537. /// <returns>Não retorna valores.</returns>
  1538. call:FinalizeToHandcuffTarget(playerid, target, auxHandcuffSlot)
  1539. {
  1540. if(!IsPlayerConnected(target) || playerDeath[target]) return;
  1541.  
  1542. ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLE);
  1543.  
  1544. SetPVarInt(playerid, "finalizeTextActionAnimation_0", true);
  1545.  
  1546. UnfreezePlayer(playerid);
  1547.  
  1548. RemovePlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF);
  1549.  
  1550. UnfreezePlayer(target);
  1551.  
  1552. new skinid = GetPlayerSkin(target);
  1553.  
  1554. SetPlayerAttachedObject(target, INDEX_ATTACH_HANDCUFF, 19418, 5, attachHandcuff[skinid][E_ATTACH_OFFSETX], attachHandcuff[skinid][E_ATTACH_OFFSETY],
  1555. attachHandcuff[skinid][E_ATTACH_OFFSETZ], attachHandcuff[skinid][E_ATTACH_ROTX], attachHandcuff[skinid][E_ATTACH_ROTY],
  1556. attachHandcuff[skinid][E_ATTACH_ROTZ], attachHandcuff[skinid][E_ATTACH_SCALEX], attachHandcuff[skinid][E_ATTACH_SCALEY],
  1557. attachHandcuff[skinid][E_ATTACH_SCALEZ], 0, 0);
  1558.  
  1559. SendClientMessageEx(target, COLOR_YELLOW, "<!> {FFFFFF}Você foi algemado por %s!", GetNameOfPlayer(playerid));
  1560. }
  1561. /// <summary>
  1562. /// Callback que finaliza o método de desalgemamento de um suspeito.
  1563. /// É dado um intervalo combinado com o final da animação de
  1564. /// desimobilização do jogador.
  1565. /// Intervalo: 2200ms.
  1566. /// </summary>
  1567. /// <param name="playerid">ID do jogador.</param>
  1568. /// <param name="target">ID do suspeito.</param>
  1569. /// <returns>Não retorna valores.</returns>
  1570. call:FinalizeUnshackleTarget(playerid, target)
  1571. {
  1572. if(!IsPlayerConnected(target) || playerDeath[target]) return;
  1573.  
  1574. ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFF);
  1575.  
  1576. SetPVarInt(playerid, "finalizeTextActionAnimation_1", true);
  1577.  
  1578. UnfreezePlayer(playerid);
  1579.  
  1580. if(!IsPlayerConnected(target)) return;
  1581.  
  1582. cuffedPlayer[target][E_PLAYER_HANDCUFFED] = false;
  1583. cuffedPlayer[target][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
  1584.  
  1585. SetPlayerSpecialAction(target, SPECIAL_ACTION_NONE);
  1586.  
  1587. RemovePlayerAttachedObject(target, INDEX_ATTACH_HANDCUFF);
  1588.  
  1589. UnfreezePlayer(target);
  1590.  
  1591. SendClientMessageEx(target, COLOR_GREEN, "<!> {FFFFFF}Você foi desalgemado por %s.", GetNameOfPlayer(playerid));
  1592. }
  1593. /// <summary>
  1594. /// Callback que finaliza o método de recuperação das algemas.
  1595. /// É dado um intervalo combinado com o final da animação de
  1596. /// apanhar item.
  1597. /// Intervalo: 700ms.
  1598. /// </summary>
  1599. /// <param name="playerid">ID do jogador.</param>
  1600. /// <param name="targetRecover">ID do suspeito ao qual recuperará as algemas.</param>
  1601. /// <returns>Não retorna valores.</returns>
  1602. call:FinalizeRecoverHandcuff(playerid, targetRecover)
  1603. {
  1604. ApplyAnimation(playerid, "BOMBER", "BOM_Plant_2Idle", 4.1, 0, 1, 1, 0, 1, 1);
  1605.  
  1606. GivePlayerHandcuff(playerid, 1);
  1607.  
  1608. if(cuffedPlayer[targetRecover][E_OWNER_LABEL_INFO] != INVALID_PLAYER_3DTEXT_ID)
  1609. DeletePlayer3DTextLabel(playerid, cuffedPlayer[targetRecover][E_OWNER_LABEL_INFO]);
  1610.  
  1611. cuffedPlayer[playerid][E_OWNER_LABEL_INFO] = INVALID_PLAYER_3DTEXT_ID;
  1612. }
  1613. /// <summary>
  1614. /// Timer para a animação da TextDraw 'E_TEXT_ACTION', que
  1615. /// informa se está algemando ou desalgemando.
  1616. /// Intervalo: 800ms.
  1617. /// </summary>
  1618. /// <param name="playerid">ID do jogador.</param>
  1619. /// <param name="type_action">Tipo de ação (algemando/desalgemando).</param>
  1620. /// <param name="loop">Variável auxiliar para controle da animação.</param>
  1621. /// <returns>Não retorna valores.</returns>
  1622. call:TextActionAnimation(playerid, type_action, loop)
  1623. {
  1624. if(type_action == TYPE_HANDCUFFING)
  1625. {
  1626. if(!playerHandcuff[playerid][E_HANDCUFFING_TARGET] || GetPVarInt(playerid, "finalizeTextActionAnimation_0"))
  1627. {
  1628. if(playerHandcuff[playerid][E_CURRENT_TARGET] == INVALID_PLAYER_ID)
  1629. HideTDTargetClose(playerid);
  1630. else
  1631. ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLE);
  1632.  
  1633. playerHandcuff[playerid][E_HANDCUFFING_TARGET] = false;
  1634.  
  1635. DeletePVar(playerid, "finalizeTextActionAnimation_0");
  1636.  
  1637. return;
  1638. }
  1639.  
  1640. new text[18 + 4], i;
  1641.  
  1642. for(i = 0; i <= 4; i++)
  1643. {
  1644. text[i] = '\0';
  1645. if(loop >= i) text[i] = 0x2E;
  1646. }
  1647.  
  1648. format(text, sizeof(text), "algemando jogador%s", text);
  1649.  
  1650. PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], text);
  1651. PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
  1652.  
  1653. loop++;
  1654.  
  1655. if(playerHandcuff[playerid][E_HANDCUFFING_TARGET]) SetTimerEx("TextActionAnimation", 800, false, "iii", playerid, type_action, loop);
  1656. }
  1657. else
  1658. {
  1659. if(!playerHandcuff[playerid][E_UNSHACKLING_TARGET] || GetPVarInt(playerid, "finalizeTextActionAnimation_1"))
  1660. {
  1661. if(playerHandcuff[playerid][E_CURRENT_TARGET] == INVALID_PLAYER_ID)
  1662. HideTDTargetClose(playerid);
  1663. else
  1664. ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFF);
  1665.  
  1666. playerHandcuff[playerid][E_UNSHACKLING_TARGET] = false;
  1667.  
  1668. DeletePVar(playerid, "finalizeTextActionAnimation_1");
  1669.  
  1670. return;
  1671. }
  1672.  
  1673. new text[21 + 5], i;
  1674.  
  1675. for(i = 0; i <= 5; i++)
  1676. {
  1677. text[i] = '\0';
  1678. if(loop >= i) text[i] = 0x2E;
  1679. }
  1680.  
  1681. format(text, sizeof(text), "desalgemando jogador%s", text);
  1682.  
  1683. PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], text);
  1684. PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
  1685.  
  1686. loop++;
  1687.  
  1688. if(playerHandcuff[playerid][E_UNSHACKLING_TARGET]) SetTimerEx("TextActionAnimation", 800, false, "iii", playerid, type_action, loop);
  1689. }
  1690. }
  1691. /// <summary>
  1692. /// Timer para a animação da TextDraw 'E_AMOUNT', que informa
  1693. /// o valor de algemadas Utilizadas de algemas Totais (u/t).
  1694. /// Intervalo: 500ms.
  1695. /// </summary>
  1696. /// <param name="playerid">ID do jogador.</param>
  1697. /// <param name="auxControl">Variável auxiliar para controle da animação.</param>
  1698. /// <param name="auxCount">Variável de finalização da animação.</param>
  1699. /// <param name="auxUsed">Valor de algemas utilizadas pelo jogador.</param>
  1700. /// <param name="auxAmount">Valor de algemas totais do jogador.</param>
  1701. /// <returns>Não retorna valores.</returns>
  1702. call:TextAmountAnimation(playerid, bool:auxControl, auxCount, auxUsed, auxAmount)
  1703. {
  1704. if(!IsPlayerWithHandcuffsInHands(playerid))
  1705. {
  1706. DeletePVar(playerid, "enliveningAmount");
  1707. HideTDHandcuff(playerid);
  1708. return;
  1709. }
  1710.  
  1711. if(auxCount >= 8)
  1712. {
  1713. DeletePVar(playerid, "enliveningAmount");
  1714. ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
  1715. return;
  1716. }
  1717.  
  1718. new string[13];
  1719.  
  1720. format(string, 13, "%s%d/%d", (!auxControl) ? ("~r~") : ("~w~"), auxUsed, auxAmount);
  1721.  
  1722. PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_AMOUNT], string);
  1723.  
  1724. PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_AMOUNT]);
  1725.  
  1726. SetTimerEx("TextAmountAnimation", 500, false, "ibiii", playerid, !auxControl, auxCount+1, auxUsed, auxAmount);
  1727. }
  1728. /// <summary>
  1729. /// Callback para algemar jogador, attachando objeto das algemas
  1730. /// em suas mãos e setando SpecialAction. Um alerta é enviado ao
  1731. /// jogador para informar responsável e horário.
  1732. /// Intervalo: 1000ms.
  1733. /// </summary>
  1734. /// <remarks>
  1735. /// Callback importante para evitar bugs não aplicando as funções
  1736. /// diretamente quando o jogador é spawnado.
  1737. /// </remarks>
  1738. /// <param name="playerid">ID do jogador.</param>
  1739. /// <returns>Não retorna valores.</returns>
  1740. call:SetTargetHandcuff(playerid)
  1741. {
  1742. new skinid = GetPlayerSkin(playerid),
  1743. ownerHandcuff = cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID],
  1744. handcuffSlot = GetHandcuffSlotOfTarget(ownerHandcuff, playerid),
  1745. time[36],
  1746. pos;
  1747.  
  1748. SetPlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF, 19418, 5, attachHandcuff[skinid][E_ATTACH_OFFSETX], attachHandcuff[skinid][E_ATTACH_OFFSETY],
  1749. attachHandcuff[skinid][E_ATTACH_OFFSETZ], attachHandcuff[skinid][E_ATTACH_ROTX], attachHandcuff[skinid][E_ATTACH_ROTY],
  1750. attachHandcuff[skinid][E_ATTACH_ROTZ], attachHandcuff[skinid][E_ATTACH_SCALEX], attachHandcuff[skinid][E_ATTACH_SCALEY],
  1751. attachHandcuff[skinid][E_ATTACH_SCALEZ], 0, 0);
  1752.  
  1753. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
  1754.  
  1755. format(time, 36, playerHandcuff[ownerHandcuff][E_TIME_CUFFED][handcuffSlot]);
  1756.  
  1757. pos = strfind(time, "BCD2EE", true);
  1758.  
  1759. if(pos != -1)
  1760. {
  1761. strdel(time, pos, pos+6);
  1762. strins(time, "FFFFFF", pos);
  1763.  
  1764. SendClientMessageEx(playerid, COLOR_YELLOW, "<!> {FFFFFF}Você foi algemado por %s, as {E84F33}%s{FFFFFF}.", GetNameOfPlayer(ownerHandcuff), time);
  1765. }
  1766. else SendClientMessageEx(playerid, COLOR_YELLOW, "<!> {FFFFFF}Você foi algemado por %s.", GetNameOfPlayer(ownerHandcuff));
  1767. }
  1768. /*
  1769. *****************************************************************************
  1770. */
  1771. /// <summary>
  1772. /// Cria todas as TextDraws Globais das algemas.
  1773. /// </summary>
  1774. /// <returns>Não retorna valores.</returns>
  1775. CreateGlobalTDHandcuff()
  1776. {
  1777. textHandcuffGlobal[E_BACKGROUND][0] = TextDrawCreate(582.176574, 300.833374, "LD_SPAC:white");
  1778. TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][0], 0.000000, 0.000000);
  1779. TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][0], 90.000000, 31.666669);
  1780. TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][0], 1);
  1781. TextDrawColor(textHandcuffGlobal[E_BACKGROUND][0], -1523963137);
  1782. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][0], 0);
  1783. TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][0], 0);
  1784. TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][0], 255);
  1785. TextDrawFont(textHandcuffGlobal[E_BACKGROUND][0], 4);
  1786. TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][0], 1);
  1787. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][0], 0);
  1788.  
  1789. textHandcuffGlobal[E_PREVIEW] = TextDrawCreate(589.235229, 288.583282, "");
  1790. TextDrawLetterSize(textHandcuffGlobal[E_PREVIEW], 0.000000, 0.000000);
  1791. TextDrawTextSize(textHandcuffGlobal[E_PREVIEW], 48.117622, 56.166671);
  1792. TextDrawAlignment(textHandcuffGlobal[E_PREVIEW], 1);
  1793. TextDrawColor(textHandcuffGlobal[E_PREVIEW], -1);
  1794. TextDrawSetShadow(textHandcuffGlobal[E_PREVIEW], 0);
  1795. TextDrawSetOutline(textHandcuffGlobal[E_PREVIEW], 0);
  1796. TextDrawBackgroundColor(textHandcuffGlobal[E_PREVIEW], 0);
  1797. TextDrawFont(textHandcuffGlobal[E_PREVIEW], 5);
  1798. TextDrawSetProportional(textHandcuffGlobal[E_PREVIEW], 1);
  1799. TextDrawSetShadow(textHandcuffGlobal[E_PREVIEW], 0);
  1800. TextDrawSetPreviewModel(textHandcuffGlobal[E_PREVIEW], 19418);
  1801. TextDrawSetPreviewRot(textHandcuffGlobal[E_PREVIEW], 0.000000, 0.000000, 0.000000, 0.088365);
  1802.  
  1803. textHandcuffGlobal[E_DIVIDER] = TextDrawCreate(576.529602, 336.416442, "LD_SPAC:white");
  1804. TextDrawLetterSize(textHandcuffGlobal[E_DIVIDER], 0.000000, 0.000000);
  1805. TextDrawTextSize(textHandcuffGlobal[E_DIVIDER], 90.000000, 0.703336);
  1806. TextDrawAlignment(textHandcuffGlobal[E_DIVIDER], 1);
  1807. TextDrawColor(textHandcuffGlobal[E_DIVIDER], -1);
  1808. TextDrawSetShadow(textHandcuffGlobal[E_DIVIDER], 0);
  1809. TextDrawSetOutline(textHandcuffGlobal[E_DIVIDER], 0);
  1810. TextDrawBackgroundColor(textHandcuffGlobal[E_DIVIDER], 255);
  1811. TextDrawFont(textHandcuffGlobal[E_DIVIDER], 4);
  1812. TextDrawSetProportional(textHandcuffGlobal[E_DIVIDER], 1);
  1813. TextDrawSetShadow(textHandcuffGlobal[E_DIVIDER], 0);
  1814.  
  1815. textHandcuffGlobal[E_BACKGROUND][1] = TextDrawCreate(631.176940, 342.833190, "box");
  1816. TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][1], 0.000000, 1.011762);
  1817. TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][1], 720.823730, 0.000000);
  1818. TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][1], 1);
  1819. TextDrawColor(textHandcuffGlobal[E_BACKGROUND][1], -1);
  1820. TextDrawUseBox(textHandcuffGlobal[E_BACKGROUND][1], 1);
  1821. TextDrawBoxColor(textHandcuffGlobal[E_BACKGROUND][1], 100);
  1822. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][1], 0);
  1823. TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][1], 0);
  1824. TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][1], 255);
  1825. TextDrawFont(textHandcuffGlobal[E_BACKGROUND][1], 1);
  1826. TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][1], 1);
  1827. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][1], 0);
  1828.  
  1829. textHandcuffGlobal[E_BACKGROUND][2] = TextDrawCreate(629.234619, 341.666656, "hud:radar_gangY");
  1830. TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][2], 0.000000, 0.000000);
  1831. TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][2], 9.999987, 11.249995);
  1832. TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][2], 1);
  1833. TextDrawColor(textHandcuffGlobal[E_BACKGROUND][2], -1);
  1834. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][2], 0);
  1835. TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][2], 0);
  1836. TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][2], 255);
  1837. TextDrawFont(textHandcuffGlobal[E_BACKGROUND][2], 4);
  1838. TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][2], 1);
  1839. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][2], 0);
  1840.  
  1841. textHandcuffGlobal[E_BACKGROUND][3] = TextDrawCreate(551.647766, 358.583312, "box");//algemar
  1842. TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][3], 0.000000, 0.917644);
  1843. TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][3], 669.529541, 0.000000);
  1844. TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][3], 1);
  1845. TextDrawColor(textHandcuffGlobal[E_BACKGROUND][3], -1);
  1846. TextDrawUseBox(textHandcuffGlobal[E_BACKGROUND][3], 1);
  1847. TextDrawBoxColor(textHandcuffGlobal[E_BACKGROUND][3], 100);
  1848. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][3], 0);
  1849. TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][3], 0);
  1850. TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][3], 255);
  1851. TextDrawFont(textHandcuffGlobal[E_BACKGROUND][3], 1);
  1852. TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][3], 1);
  1853. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][3], 0);
  1854.  
  1855. textHandcuffGlobal[E_BACKGROUND][4] = TextDrawCreate(537.059753, 358.583312, "box");//desalgemar
  1856. TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][4], 0.000000, 0.917644);
  1857. TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][4], 654.941528, 0.000000);
  1858. TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][4], 1);
  1859. TextDrawColor(textHandcuffGlobal[E_BACKGROUND][4], -1);
  1860. TextDrawUseBox(textHandcuffGlobal[E_BACKGROUND][4], 1);
  1861. TextDrawBoxColor(textHandcuffGlobal[E_BACKGROUND][4], 100);
  1862. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][4], 0);
  1863. TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][4], 0);
  1864. TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][4], 255);
  1865. TextDrawFont(textHandcuffGlobal[E_BACKGROUND][4], 1);
  1866. TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][4], 1);
  1867. TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][4], 0);
  1868. }
  1869. /// <summary>
  1870. /// Cria todas as TextDraws Privadas das algemas.
  1871. /// </summary>
  1872. /// <returns>Não retorna valores.</returns>
  1873. CreatePrivateTDHandcuff(playerid)
  1874. {
  1875. textHandcuffPrivate[playerid][E_AMOUNT] = CreatePlayerTextDraw(playerid, 583.176452, 320.666564, "0/5");
  1876. PlayerTextDrawLetterSize(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 0.184468, 1.203333);
  1877. PlayerTextDrawAlignment(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 1);
  1878. PlayerTextDrawColor(playerid, textHandcuffPrivate[playerid][E_AMOUNT], -1);
  1879. PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 1);
  1880. PlayerTextDrawSetOutline(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 0);
  1881. PlayerTextDrawBackgroundColor(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 255);
  1882. PlayerTextDrawFont(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 2);
  1883. PlayerTextDrawSetProportional(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 1);
  1884. PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 1);
  1885.  
  1886. textHandcuffPrivate[playerid][E_TARGET_CLOSE] = CreatePlayerTextDraw(playerid, 628.823120, 341.083251, "name(id)");
  1887. PlayerTextDrawLetterSize(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 0.192469, 1.249999);
  1888. PlayerTextDrawAlignment(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 3);
  1889. PlayerTextDrawColor(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], -1);
  1890. PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 1);
  1891. PlayerTextDrawSetOutline(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 0);
  1892. PlayerTextDrawBackgroundColor(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 255);
  1893. PlayerTextDrawFont(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 2);
  1894. PlayerTextDrawSetProportional(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 1);
  1895. PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 1);
  1896.  
  1897. textHandcuffPrivate[playerid][E_TEXT_ACTION] = CreatePlayerTextDraw(playerid, 637.764526, 357.416656, "tecle_~y~n~w~_para_desalgemar");
  1898. PlayerTextDrawLetterSize(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 0.176941, 1.016664);
  1899. PlayerTextDrawAlignment(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 3);
  1900. PlayerTextDrawColor(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], -1);
  1901. PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 0);
  1902. PlayerTextDrawSetOutline(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 0);
  1903. PlayerTextDrawBackgroundColor(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 255);
  1904. PlayerTextDrawFont(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 2);
  1905. PlayerTextDrawSetProportional(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 1);
  1906. PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 0);
  1907. }
  1908. /// <summary>
  1909. /// Cria todas as TextDraws Globais do método de recuperação
  1910. /// das algemas.
  1911. /// </summary>
  1912. /// <returns>Não retorna valores.</returns>
  1913. CreateGlobalTDWarningRecovery()
  1914. {
  1915. textWarningRecovery[0] = TextDrawCreate(485.765655, 281.583282, "box");
  1916. TextDrawLetterSize(textWarningRecovery[0], 0.000000, 0.917644);
  1917. TextDrawTextSize(textWarningRecovery[0], 643.177001, 0.000000);
  1918. TextDrawAlignment(textWarningRecovery[0], 1);
  1919. TextDrawColor(textWarningRecovery[0], -1);
  1920. TextDrawUseBox(textWarningRecovery[0], 1);
  1921. TextDrawBoxColor(textWarningRecovery[0], 100);
  1922. TextDrawSetShadow(textWarningRecovery[0], 0);
  1923. TextDrawSetOutline(textWarningRecovery[0], 0);
  1924. TextDrawBackgroundColor(textWarningRecovery[0], 255);
  1925. TextDrawFont(textWarningRecovery[0], 1);
  1926. TextDrawSetProportional(textWarningRecovery[0], 1);
  1927. TextDrawSetShadow(textWarningRecovery[0], 0);
  1928.  
  1929. textWarningRecovery[1] = TextDrawCreate(637.293945, 280.416717, "tecle ~y~N~w~ para recuperar suas algemas");
  1930. TextDrawLetterSize(textWarningRecovery[1], 0.176941, 1.016664);
  1931. TextDrawAlignment(textWarningRecovery[1], 3);
  1932. TextDrawColor(textWarningRecovery[1], -1);
  1933. TextDrawSetShadow(textWarningRecovery[1], 0);
  1934. TextDrawSetOutline(textWarningRecovery[1], 0);
  1935. TextDrawBackgroundColor(textWarningRecovery[1], 255);
  1936. TextDrawFont(textWarningRecovery[1], 2);
  1937. TextDrawSetProportional(textWarningRecovery[1], 1);
  1938. TextDrawSetShadow(textWarningRecovery[1], 0);
  1939. }
  1940. //----------------------
  1941. /// <summary>
  1942. /// Mostra as TextDraws das algemas a um jogador específico.
  1943. /// </summary>
  1944. /// <param name="playerid">ID do jogador.</param>
  1945. /// <returns>Não retorna valores.</returns>
  1946. stock ShowTDHandcuff(playerid)
  1947. {
  1948. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][0]);
  1949. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_PREVIEW]);
  1950.  
  1951. ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
  1952. }
  1953. /// <summary>
  1954. /// Esconde as TextDraws das algemas a um jogador específico.
  1955. /// </summary>
  1956. /// <remarks>
  1957. /// Também esconde as TextDraws do alvo.
  1958. /// </remarks>
  1959. /// <param name="playerid">ID do jogador.</param>
  1960. /// <returns>Não retorna valores.</returns>
  1961. HideTDHandcuff(playerid)
  1962. {
  1963. HideTDTargetClose(playerid);
  1964.  
  1965. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_PREVIEW]);
  1966. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_DIVIDER]);
  1967.  
  1968. PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_AMOUNT]);
  1969. PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE]);
  1970. PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
  1971.  
  1972. for(new i = 0; i < 5; i++) TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][i]);
  1973. }
  1974. /// <summary>
  1975. /// Mostra as TextDraws do alvo a um jogador específico.
  1976. /// </summary>
  1977. /// <param name="playerid">ID do jogador.</param>
  1978. /// <returns>Não retorna valores.</returns>
  1979. ShowTDTargetClose(playerid)
  1980. {
  1981. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_DIVIDER]);
  1982.  
  1983. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][1]);
  1984. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][2]);
  1985.  
  1986. new target;
  1987.  
  1988. if(IsAValidCurrentTarget(playerid, target))
  1989. {
  1990. if(playerHandcuff[playerid][E_CURRENT_TARGET] == INVALID_PLAYER_ID)
  1991. {
  1992. HideTDTargetClose(playerid);
  1993. return;
  1994. }
  1995.  
  1996. new target_info[MAX_PLAYER_NAME + 6];
  1997. format(target_info, sizeof(target_info), "%s(%d)", GetNameOfPlayer(target), target);
  1998.  
  1999. PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], target_info);
  2000. PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE]);
  2001.  
  2002. if(cuffedPlayer[target][E_PLAYER_HANDCUFFED])
  2003. {
  2004. if(cuffedPlayer[target][E_OWNER_HANDCUFF_ID] == playerid) ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLE);
  2005. else HideTDTargetClose(playerid);
  2006. }
  2007. else ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFF);
  2008. }
  2009. }
  2010. /// <summary>
  2011. /// Esconde as TextDraws do alvo a um jogador específico.
  2012. /// Reseta a variável de controle do alvo atual.
  2013. /// </summary>
  2014. /// <param name="playerid">ID do jogador.</param>
  2015. /// <returns>Não retorna valores.</returns>
  2016. HideTDTargetClose(playerid)
  2017. {
  2018. playerHandcuff[playerid][E_CURRENT_TARGET] = INVALID_PLAYER_ID;
  2019.  
  2020. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_DIVIDER]);
  2021.  
  2022. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][1]);
  2023. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][2]);
  2024. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
  2025. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
  2026.  
  2027. PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE]);
  2028. PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
  2029. }
  2030. /// <summary>
  2031. /// Revalida se o alvo atual de um jogador específico
  2032. /// está nas condições necessárias. Isso envolve:
  2033. /// conectado, posicionado certo e vivo.
  2034. /// </summary>
  2035. /// <param name="playerid">ID do jogador.</param>
  2036. /// <returns>True se for um alvo validado, False se não.</returns>
  2037. RevalidateCurrentTarget(playerid)
  2038. {
  2039. new target, bool:isValid;
  2040.  
  2041. isValid = bool:IsAValidCurrentTarget(playerid, target);
  2042.  
  2043. if(isValid)
  2044. {
  2045. if(cuffedPlayer[target][E_PLAYER_HANDCUFFED])
  2046. {
  2047. if(cuffedPlayer[target][E_OWNER_HANDCUFF_ID] == playerid) ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLE);
  2048. else isValid = false;
  2049. }
  2050. else ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFF);
  2051. }
  2052.  
  2053. return isValid;
  2054. }
  2055. //---------------------------
  2056. /// <summary>
  2057. /// Mostra as TextDraws de aviso de recuperação das algemas a
  2058. /// um jogador específico.
  2059. /// </summary>
  2060. /// <param name="playerid">ID do jogador.</param>
  2061. /// <returns>Não retorna valores.</returns>
  2062. ShowWarningRecovery(playerid)
  2063. {
  2064. TextDrawShowForPlayer(playerid, textWarningRecovery[0]);
  2065. TextDrawShowForPlayer(playerid, textWarningRecovery[1]);
  2066. }
  2067. /// <summary>
  2068. /// Esconde as TextDraws de aviso de recuperação das algemas
  2069. /// de um jogador específico.
  2070. /// </summary>
  2071. /// <param name="playerid">ID do jogador.</param>
  2072. /// <returns>Não retorna valores.</returns>
  2073. HideWarningRecovery(playerid)
  2074. {
  2075. TextDrawHideForPlayer(playerid, textWarningRecovery[0]);
  2076. TextDrawHideForPlayer(playerid, textWarningRecovery[1]);
  2077. }
  2078. //----------------------------------------------
  2079. /// <summary>
  2080. /// Reseta todas as variáveis de controle das algemas.
  2081. /// </summary>
  2082. /// <param name="playerid">ID do jogador.</param>
  2083. /// <param name="allVariables">True para resetar as variáveis de controle do jogador algemado.</param>
  2084. /// <returns>Não retorna valores.</returns>
  2085. ResetPlayerHandcuff(playerid, bool:allVariables)
  2086. {
  2087. for(new i = 0; i < MAX_HANDCUFFS; i++)
  2088. {
  2089. playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i] = INVALID_PLAYER_ID,
  2090. targetToRecoverHandcuff[playerid][i] = INVALID_PLAYER_ID;
  2091.  
  2092. #if !RESET_TO_DISCONNECT
  2093. playerTargetOffline[playerid][i] = "";
  2094. #endif
  2095. }
  2096.  
  2097. playerHandcuff[playerid][E_HAVE_HANDCUFF] = false;
  2098. playerHandcuff[playerid][E_HANDCUFF_IN_HANDS] = false;
  2099.  
  2100. playerHandcuff[playerid][E_HANDCUFFING_TARGET] = false;
  2101. playerHandcuff[playerid][E_UNSHACKLING_TARGET] = false;
  2102.  
  2103. playerHandcuff[playerid][E_HANDCUFF_AMOUNT] = 0;
  2104. playerHandcuff[playerid][E_HANDCUFFS_USED] = 0;
  2105.  
  2106. playerHandcuff[playerid][E_CURRENT_TARGET] = INVALID_PLAYER_ID;
  2107.  
  2108. targetToRecoverCurrent[playerid] = INVALID_PLAYER_ID;
  2109.  
  2110. if(allVariables)
  2111. {
  2112. cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = false;
  2113. cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
  2114. cuffedPlayer[playerid][E_OWNER_LABEL_INFO] = INVALID_PLAYER_3DTEXT_ID;
  2115. }
  2116. }
  2117. //--------------------
  2118. /// <summary>
  2119. /// Pega as algemas guardadas para um jogador específico.
  2120. /// </summary>
  2121. /// <param name="playerid">ID do jogador.</param>
  2122. /// <returns>Não retorna valores.</returns>
  2123. stock PickHandcuff(playerid)
  2124. {
  2125. playerHandcuff[playerid][E_HANDCUFF_IN_HANDS] = true;
  2126.  
  2127. ShowTDHandcuff(playerid);
  2128.  
  2129. FindPlayerToHandcuff(playerid);
  2130. }
  2131. /// <summary>
  2132. /// Guarda as algemas em uso para um jogador específico.
  2133. /// </summary>
  2134. /// <param name="playerid">ID do jogador.</param>
  2135. /// <returns>Não retorna valores.</returns>
  2136. stock SaveHandcuff(playerid)
  2137. {
  2138. playerHandcuff[playerid][E_HANDCUFF_IN_HANDS] = false;
  2139.  
  2140. HideTDHandcuff(playerid);
  2141. }
  2142. //---------------------------------------
  2143. GetHandcuffSlotOfTarget(playerid, target)
  2144. {
  2145. for(new i; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
  2146. {
  2147. if(playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i] == target)
  2148. {
  2149. return i;
  2150. }
  2151. }
  2152. return -1;
  2153. }
  2154. //----------------------------------
  2155. /// <summary>
  2156. /// Identifica de um jogador específico desconectou enquanto
  2157. /// possuia um ou mais suspeitos algemados. Se for válido,
  2158. /// todos os suspeitos serão desalgemados e alertados.
  2159. /// </summary>
  2160. /// <param name="playerid">ID do jogador.</param>
  2161. /// <returns>True se bem sucedido, False se: não possuir algemas; não ter algemado nenhum suspeito.</returns>
  2162. OwnerHandcuffsDisconnected(playerid)
  2163. {
  2164. if(!(playerHandcuff[playerid][E_HAVE_HANDCUFF] && playerHandcuff[playerid][E_HANDCUFFS_USED] > 0)) return false;
  2165.  
  2166. for(new i; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
  2167. {
  2168. if(IsPlayerConnected(playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i]))
  2169. {
  2170. new target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i];
  2171.  
  2172. if(!cuffedPlayer[target][E_PLAYER_HANDCUFFED]) continue;
  2173.  
  2174. cuffedPlayer[target][E_PLAYER_HANDCUFFED] = false;
  2175. cuffedPlayer[target][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
  2176.  
  2177. SetPlayerSpecialAction(target, SPECIAL_ACTION_NONE);
  2178.  
  2179. UnfreezePlayer(target);
  2180.  
  2181. RemovePlayerAttachedObject(target, INDEX_ATTACH_HANDCUFF);
  2182.  
  2183. SendClientMessageEx(target, COLOR_GREEN, "<!> {FFFFFF}Você foi desalgemado, pois %s foi desconectado e não possui mais a posse das chaves das algemas.", GetNameOfPlayer(playerid));
  2184. }
  2185. }
  2186. ResetPlayerHandcuff(playerid, false);
  2187.  
  2188. return true;
  2189. }
  2190. //-------------------------------
  2191. /// <summary>
  2192. /// Desalgema um alvo específico algemado pelo jogador.
  2193. /// </summary>
  2194. /// <param name="playerid">ID do jogador.</param>
  2195. /// <param name="target">ID do alvo.</param>
  2196. /// <returns>True se bem sucedido, False se: não estiver algemas em mãos; não ter algemado nenhum suspeito.</returns>
  2197. UnshackleTarget(playerid, target)
  2198. {
  2199. if(!IsPlayerWithHandcuffsInHands(playerid) || playerHandcuff[playerid][E_HANDCUFFS_USED] < 1) return false;
  2200.  
  2201. new handcuffSlot = GetHandcuffSlotOfTarget(playerid, target);
  2202.  
  2203. if(!~handcuffSlot) return false;
  2204.  
  2205. playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot] = INVALID_PLAYER_ID;
  2206. playerHandcuff[playerid][E_HANDCUFFS_USED]--;
  2207.  
  2208. ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
  2209.  
  2210. FreezePlayer(target);
  2211.  
  2212. ApplyAnimation(playerid, #GANGS, #prtial_hndshk_biz_01, 4.1, 0, 1, 1, 0, 0, 1);
  2213.  
  2214. playerHandcuff[playerid][E_UNSHACKLING_TARGET] = true;
  2215.  
  2216. ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLING);
  2217.  
  2218. SetTimerEx("FinalizeUnshackleTarget", 2200, false, "ii", playerid, target);
  2219.  
  2220. return true;
  2221. }
  2222. /// <summary>
  2223. /// Algema um alvo específico.
  2224. /// </summary>
  2225. /// <param name="playerid">ID do jogador.</param>
  2226. /// <param name="target">ID do alvo.</param>
  2227. /// <returns>True se bem sucedido, False se: não estiver algemas em mãos; se não nenhuma algema; se o número de algemas usadas for maior ou igual ao número de algemas; se estiver algemado.</returns>
  2228. ToHandcuffTarget(playerid, target)
  2229. {
  2230. if(!IsPlayerWithHandcuffsInHands(playerid) || playerHandcuff[playerid][E_HANDCUFF_AMOUNT] < 1 || playerHandcuff[playerid][E_HANDCUFFS_USED] >= playerHandcuff[playerid][E_HANDCUFF_AMOUNT] || cuffedPlayer[playerid][E_PLAYER_HANDCUFFED]) return false;
  2231.  
  2232. new handcuffSlot = -1, time[3], date[2];
  2233.  
  2234. for(new i = 0; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
  2235. {
  2236. if(playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i] == INVALID_PLAYER_ID)
  2237. {
  2238. handcuffSlot = i;
  2239. break;
  2240. }
  2241. }
  2242.  
  2243. if(!~handcuffSlot) return false;
  2244.  
  2245. playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot] = target;
  2246. playerHandcuff[playerid][E_HANDCUFFS_USED]++;
  2247.  
  2248. playerHandcuff[playerid][E_TIMESTAMP_CUFFED][handcuffSlot] = gettime();
  2249.  
  2250. gettime(time[0], time[1], time[2]);
  2251. getdate(date[0], date[1], time[2]);
  2252.  
  2253. format(playerHandcuff[playerid][E_TIME_CUFFED][handcuffSlot], 36, "%02d:%02d {BCD2EE}de{E84F33} %02d/%02d/%d", time[0],time[1], time[2],date[1],date[0]);
  2254.  
  2255. cuffedPlayer[target][E_PLAYER_HANDCUFFED] = true;
  2256. cuffedPlayer[target][E_OWNER_HANDCUFF_ID] = playerid;
  2257.  
  2258. ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
  2259.  
  2260. SetPlayerSpecialAction(target, SPECIAL_ACTION_CUFFED);
  2261.  
  2262. FreezePlayer(target);
  2263.  
  2264. SetPlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF, 19418, 5, 0.135999, 0.055000, -0.027999, -103.799942, 15.300004, 80.400009, 1.000000, 1.000000, 1.000000);
  2265.  
  2266. ApplyAnimation(playerid, #INT_HOUSE, #wash_up, 4.1, 0, 1, 1, 0, 0, 1);
  2267.  
  2268. playerHandcuff[playerid][E_HANDCUFFING_TARGET] = true;
  2269.  
  2270. ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFFING);
  2271.  
  2272. SetTimerEx("FinalizeToHandcuffTarget", 2600, false, "iii", playerid, target, handcuffSlot);
  2273.  
  2274. return true;
  2275. }
  2276. /// <summary>
  2277. /// Valida se um jogador específico está posicionado corretamente
  2278. /// atrás de um alvo específico.
  2279. /// </summary>
  2280. /// <param name="playerid">ID do jogador.</param>
  2281. /// <param name="target">ID do alvo.</param>
  2282. /// <param name="recoverValidate">True se a validação for para o método de recuperação das algemas, False se não.</param>
  2283. /// <returns>True for válido, False se não.</returns>
  2284. ValidateTargetInFront(playerid, target, bool:recoverValidate = false)
  2285. {
  2286. new Float:pos[3], Float:angle[2], Float:resultPos[2];
  2287.  
  2288. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  2289. GetPlayerFacingAngle(playerid, angle[0]);
  2290.  
  2291. if(IsPlayerInRangeOfPoint(target, 1.0, pos[0], pos[1], pos[2]))
  2292. {
  2293. if(cuffedPlayer[target][E_PLAYER_HANDCUFFED] && cuffedPlayer[target][E_OWNER_HANDCUFF_ID] != playerid) return false;
  2294.  
  2295. resultPos[0] = pos[0] + (GetDistanceBetweenPlayers(playerid, target) * floatsin(-angle[0], degrees));
  2296. resultPos[1] = pos[1] + (GetDistanceBetweenPlayers(playerid, target) * floatcos(-angle[0], degrees));
  2297.  
  2298. if(IsPlayerInRangeOfPoint(target, 0.6, resultPos[0], resultPos[1], pos[2]))
  2299. {
  2300. if(recoverValidate) return true;
  2301.  
  2302. GetPlayerFacingAngle(target, angle[1]);
  2303.  
  2304. return (angle[1]-25 < angle[0] < angle[1]+30);
  2305. }
  2306. }
  2307. return false;
  2308. }
  2309. //------------------------------
  2310. /// <summary>
  2311. /// Seta o novo alvo na variável de controle de um jogador
  2312. /// específico. Mostra as TextDraws do alvo.
  2313. /// </summary>
  2314. /// <param name="playerid">ID do jogador.</param>
  2315. /// <param name="target">ID do alvo.</param>
  2316. /// <returns>Não retorna valores.</returns>
  2317. NewTargetFound(playerid, target)
  2318. {
  2319. playerHandcuff[playerid][E_CURRENT_TARGET] = target;
  2320.  
  2321. ShowTDTargetClose(playerid);
  2322. }
  2323. /// <summary>
  2324. /// Valida se o alvo atual é um alvo válido. Isso envolve:
  2325. /// conectado, posicionado corretamente e vivo.
  2326. /// </summary>
  2327. /// <param name="playerid">ID do jogador.</param>
  2328. /// <param name="varAux">Variável de referência que adere ao ID do alvo.</param>
  2329. /// <returns>Não retorna valores.</returns>
  2330. IsAValidCurrentTarget(playerid, &varAux)
  2331. {
  2332. new target = playerHandcuff[playerid][E_CURRENT_TARGET];
  2333.  
  2334. varAux = target;
  2335.  
  2336. return !(target == INVALID_PLAYER_ID || !IsPlayerConnected(target) || !ValidateTargetInFront(playerid, target) || playerDeath[target]);
  2337. }
  2338. //----------------------------------------------------
  2339. /// <summary>
  2340. /// Altera informações na TextDraw de algemas de um jogador
  2341. /// específico.
  2342. /// </summary>
  2343. /// <param name="playerid">ID do jogador.</param>
  2344. /// <param name="informationType">Tipo da informação: TYPE_HANDCUFF|TYPE_UNSHACKLE|TYPE_HANDCUFFING|TYPE_UNSHACKLING|TYPE_AMOUNT.</param>
  2345. /// <returns>Não retorna valores específicos.</returns>
  2346. ChangeInformationTDHandcuff(playerid, informationType)
  2347. {
  2348. if(!IsPlayerWithHandcuffsInHands(playerid))
  2349. {
  2350. HideTDHandcuff(playerid);
  2351. return;
  2352. }
  2353.  
  2354. switch(informationType)
  2355. {
  2356. case TYPE_HANDCUFF:
  2357. {
  2358. PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], "tecle_~y~n~w~_para_algemar");
  2359.  
  2360. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
  2361. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
  2362. }
  2363. case TYPE_UNSHACKLE:
  2364. {
  2365. PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], "tecle_~y~n~w~_para_desalgemar");
  2366.  
  2367. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
  2368. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
  2369. }
  2370. case TYPE_HANDCUFFING:
  2371. {
  2372. PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], "algemando jogador");
  2373.  
  2374. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
  2375. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
  2376.  
  2377. SetTimerEx("TextActionAnimation", 500, false, "iii", playerid, TYPE_HANDCUFFING, 0);
  2378. }
  2379. case TYPE_UNSHACKLING:
  2380. {
  2381. PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], "desalgemando jogador");
  2382.  
  2383. TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
  2384. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
  2385.  
  2386. SetTimerEx("TextActionAnimation", 500, false, "iii", playerid, TYPE_UNSHACKLING, 0);
  2387. }
  2388. case TYPE_AMOUNT:
  2389. {
  2390. if(GetPVarInt(playerid, "enliveningAmount")) return;
  2391.  
  2392. if(playerHandcuff[playerid][E_HANDCUFF_AMOUNT] < 1)
  2393. {
  2394. SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não possui mais algemas!");
  2395. HideTDTargetClose(playerid);
  2396. return;
  2397. }
  2398.  
  2399. new amountText[6];
  2400.  
  2401. format(amountText, sizeof(amountText), "%d/%d", playerHandcuff[playerid][E_HANDCUFFS_USED], playerHandcuff[playerid][E_HANDCUFF_AMOUNT]);
  2402.  
  2403. PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_AMOUNT], amountText);
  2404. PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_AMOUNT]);
  2405. }
  2406. }
  2407. if(informationType != TYPE_AMOUNT)
  2408. {
  2409. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_DIVIDER]);
  2410.  
  2411. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][1]);
  2412. TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][2]);
  2413.  
  2414. PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
  2415. }
  2416. }
  2417. /*
  2418. *****************************************************************************
  2419. */
  2420. /// <summary>
  2421. /// Obtém a distância entre 2 jogadores.
  2422. /// </summary>
  2423. /// <param name="playerid">ID do jogador 1.</param>
  2424. /// <param name="playerid">ID do jogador 2.</param>
  2425. /// <returns>A distância entre ambos em número flutuante.</returns>
  2426. GetDistanceBetweenPlayers(playerid,playerid2)//author: Unknown
  2427. {
  2428. new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  2429. new Float:tmpdis;
  2430. GetPlayerPos(playerid,x1,y1,z1);
  2431. GetPlayerPos(playerid2,x2,y2,z2);
  2432. tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  2433. return floatround(tmpdis);
  2434. }
  2435. /// <summary>
  2436. /// Converte a diferença entre 2 Unix timestamps em unidade
  2437. /// de tempo.
  2438. /// </summary>
  2439. /// <param name="timestamp">Timestamp 1 a se comparar.</param>
  2440. /// <param name="compare">Timestamp 2 a se comparar. Null ou -1 para obter o timestamp atual.</param>
  2441. /// <returns>A diferença de ambos timestamp em unidade de tempo.</returns>
  2442. stock timec(timestamp, compare = -1)//author: Blacklite | modification: Bruno13
  2443. {
  2444. if (compare == -1) {
  2445. compare = gettime();
  2446. }
  2447. new
  2448. n,
  2449. Float:d = (timestamp > compare) ? timestamp - compare : compare - timestamp,
  2450. returnstr[12];
  2451.  
  2452. if(d < 60)
  2453. {
  2454. format(returnstr, sizeof(returnstr), "%d segundo%s", floatround(d, floatround_floor), (d == 1) ? ("") : ("s"));
  2455. return returnstr;
  2456. }
  2457. else if(d < 3600) // 3600 = 1 hour
  2458. {
  2459. n = floatround(floatdiv(d, 60.0), floatround_floor);
  2460. format(returnstr, sizeof(returnstr), "minuto");
  2461. }
  2462. else if(d < 86400)// 86400 = 1 day
  2463. {
  2464. n = floatround(floatdiv(d, 3600.0), floatround_floor);
  2465. format(returnstr, sizeof(returnstr), "hora");
  2466. }
  2467. else if(d < 2592000) // 2592000 = 1 month
  2468. {
  2469. n = floatround(floatdiv(d, 86400.0), floatround_floor);
  2470. format(returnstr, sizeof(returnstr), "dia");
  2471. }
  2472. else if(d < 31536000) // 31536000 = 1 year
  2473. {
  2474. n = floatround(floatdiv(d, 2592000.0), floatround_floor);
  2475. format(returnstr, sizeof(returnstr), "mês");
  2476. }
  2477. else
  2478. {
  2479. n = floatround(floatdiv(d, 31536000.0), floatround_floor);
  2480. format(returnstr, sizeof(returnstr), "ano");
  2481. }
  2482.  
  2483. if(n == 1)
  2484. {
  2485. format(returnstr, sizeof(returnstr), "1 %s", returnstr);
  2486. }
  2487. else
  2488. {
  2489. if(2592000 < d < 31536000) format(returnstr, sizeof(returnstr), "%d meses", n);
  2490. else format(returnstr, sizeof(returnstr), "%d %ss", n, returnstr);
  2491. }
  2492. return returnstr;
  2493. }
  2494. /// <summary>
  2495. /// Congela jogador específico sem congelar a tela, apenas
  2496. /// a skin.
  2497. /// </summary>
  2498. /// <param name="playerid">ID do jogador.</param>
  2499. /// <returns>Não retorna valores.</returns>
  2500. FreezePlayer(playerid)//author: Bruno13
  2501. {
  2502. ApplyAnimation(playerid, "BD_FIRE", "BD_Fire1", 4.1, 1, 1, 1, 0, 0, 1);
  2503. }
  2504. /// <summary>
  2505. /// Descongela jogador específico.
  2506. /// </summary>
  2507. /// <param name="playerid">ID do jogador.</param>
  2508. /// <returns>Não retorna valores.</returns>
  2509. UnfreezePlayer(playerid)//author: Bruno13
  2510. {
  2511. ApplyAnimation(playerid, "BD_FIRE", "BD_Fire1", 4.1, 0, 1, 1, 1, 1, 1);
  2512. }
  2513. /// <summary>
  2514. /// Carrega a livraria de cada animação utilizada. Evita
  2515. /// problemas com a aplicação das mesmas pela primeira vez.
  2516. /// </summary>
  2517. /// <param name="playerid">ID do jogador.</param>
  2518. /// <returns>Não retorna valores.</returns>
  2519. LoadPlayerAnimations(playerid)//author: Bruno13
  2520. {
  2521. ApplyAnimation(playerid, "GANGS", "null", 0.0, 0, 0, 0, 0, 0);
  2522. ApplyAnimation(playerid, "INT_HOUSE", "null", 0.0, 0, 0, 0, 0, 0);
  2523. ApplyAnimation(playerid, "BD_FIRE", "null", 0.0, 0, 0, 0, 0, 0);
  2524. ApplyAnimation(playerid, "BOMBER", "null", 0.0, 0, 0, 0, 0, 0);
  2525. }
  2526. /// <summary>
  2527. /// Obtém e retorna o nome de um jogador específico.
  2528. /// </summary>
  2529. /// <param name="playerid">ID do jogador.</param>
  2530. /// <returns>Nome do jogador. 0 se não estiver conectado.</returns>
  2531. GetNameOfPlayer(playerid)//author: Bruno13
  2532. {
  2533. new name[MAX_PLAYER_NAME];
  2534. return (GetPlayerName(playerid, name, MAX_PLAYER_NAME)), name;
  2535. }
  2536. /*
  2537. *****************************************************************************
  2538. */
  2539. /// <summary>
  2540. /// Da uma quantidade específica de algemas a um jogador
  2541. /// específico.
  2542. /// </summary>
  2543. /// <param name="playerid">ID do jogador.</param>
  2544. /// <param name="amount">Quantidade de algemas.</param>
  2545. /// <returns>True se bem sucedido, False se já atingiu o máximo de algemas possíveis.</returns>
  2546. stock GivePlayerHandcuff(playerid, amount)
  2547. {
  2548. if(playerHandcuff[playerid][E_HAVE_HANDCUFF] && playerHandcuff[playerid][E_HANDCUFFS_USED] >= playerHandcuff[playerid][E_HANDCUFF_AMOUNT]) return false;
  2549.  
  2550. playerHandcuff[playerid][E_HAVE_HANDCUFF] = true;
  2551.  
  2552. playerHandcuff[playerid][E_HANDCUFF_AMOUNT] += amount;
  2553. if(playerHandcuff[playerid][E_HANDCUFF_AMOUNT] > MAX_HANDCUFFS) playerHandcuff[playerid][E_HANDCUFF_AMOUNT] = MAX_HANDCUFFS;
  2554.  
  2555. ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
  2556.  
  2557. return true;
  2558. }
  2559. /// <summary>
  2560. /// Remove todas as algemas de um jogador específico. Pode-se
  2561. /// desalgemar todos suspeitos que o jogador imobilizou.
  2562. /// </summary>
  2563. /// <param name="playerid">ID do jogador.</param>
  2564. /// <param name="unshackleTargets">True para desalgemar todos os suspeitos.</param>
  2565. /// <returns>True se bem sucedido, False se o jogador: não possuir algemas; estiver algemando/desalgemando algum suspeito.</returns>
  2566. stock RemovePlayerHandcuff(playerid, bool:unshackleTargets)
  2567. {
  2568. if(!playerHandcuff[playerid][E_HAVE_HANDCUFF] || playerHandcuff[playerid][E_HANDCUFFING_TARGET] || playerHandcuff[playerid][E_UNSHACKLING_TARGET]) return false;
  2569.  
  2570. if(unshackleTargets)
  2571. {
  2572. new i, target;
  2573.  
  2574. for(i = 0; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
  2575. {
  2576. target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i];
  2577.  
  2578. if(IsPlayerConnected(target) && cuffedPlayer[target][E_PLAYER_HANDCUFFED])
  2579. {
  2580. cuffedPlayer[target][E_PLAYER_HANDCUFFED] = false;
  2581. cuffedPlayer[target][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
  2582.  
  2583. SetPlayerSpecialAction(target, SPECIAL_ACTION_NONE);
  2584.  
  2585. UnfreezePlayer(target);
  2586.  
  2587. RemovePlayerAttachedObject(target, INDEX_ATTACH_HANDCUFF);
  2588.  
  2589. SendClientMessageEx(target, COLOR_GREEN, "<!> {FFFFFF}Você foi desalgemado, pois %s não possui mais a posse das chaves das algemas.", GetNameOfPlayer(playerid));
  2590. break;
  2591. }
  2592. }
  2593. }
  2594.  
  2595. ResetPlayerHandcuff(playerid, false);
  2596.  
  2597. return true;
  2598. }
  2599. /// <summary>
  2600. /// Obtem o número de algemas de um jogador específico possui.
  2601. /// </summary>
  2602. /// <param name="playerid">ID do jogador.</param>
  2603. /// <returns>Valor da quantidade de algemas.</returns>
  2604. stock GetPlayerHandcuffAmmo(playerid) return playerHandcuff[playerid][E_HANDCUFF_AMOUNT];
  2605. /// <summary>
  2606. /// Obtem o número de algemas usadas por um jogador específico.
  2607. /// </summary>
  2608. /// <param name="playerid">ID do jogador.</param>
  2609. /// <returns>Valor da quantidade de algemas usadas.</returns>
  2610. stock GetPlayerHandcuffUsed(playerid) return playerHandcuff[playerid][E_HANDCUFF_USED];
  2611. //-----------------------------
  2612. /// <summary>
  2613. /// Pega/guarda as algemas de um jogador específico.
  2614. /// </summary>
  2615. /// <param name="playerid">ID do jogador.</param>
  2616. /// <returns>True se bem sucedido, False se: não possuir algemas; estiver sem algemas; estiver algemando/desalgemando.</returns>
  2617. stock PlayerHandcuffs(playerid)
  2618. {
  2619. if(!playerHandcuff[playerid][E_HAVE_HANDCUFF] || playerHandcuff[playerid][E_HANDCUFF_AMOUNT] < 1)
  2620. return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não possui algemas!");
  2621.  
  2622. if(playerHandcuff[playerid][E_HANDCUFFING_TARGET] || playerHandcuff[playerid][E_UNSHACKLING_TARGET])
  2623. return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não pode guardar suas algemas enquanto as utiliza!");
  2624.  
  2625. if(IsPlayerWithHandcuffsInHands(playerid))
  2626. SaveHandcuff(playerid);
  2627. else
  2628. PickHandcuff(playerid);
  2629.  
  2630. return true;
  2631. }
  2632. /// <summary>
  2633. /// Valida se um jogador específico está com as algemas em
  2634. /// mãos.
  2635. /// </summary>
  2636. /// <param name="playerid">ID do jogador.</param>
  2637. /// <returns>True se estiver, False se não.</returns>
  2638. stock IsPlayerWithHandcuffsInHands(playerid) return playerHandcuff[playerid][E_HANDCUFF_IN_HANDS];
  2639. //----------------------------------------------------
  2640. /// <summary>
  2641. /// Desalgema um jogador específico mediante a razão.
  2642. /// </summary>
  2643. /// <param name="playerid">ID do jogador.</param>
  2644. /// <param name="reason">Razão do desalgemamento.
  2645. /// Razões: REASON_DISCONNECT/REASON_DEATH.</param>
  2646. /// <returns>True se bem sucedido, False se não estiver algemado.</returns>
  2647. stock UnshacklePlayer(playerid, reason, auxAdmin = -1)
  2648. {
  2649. if(!cuffedPlayer[playerid][E_PLAYER_HANDCUFFED]) return false;
  2650.  
  2651. new ownerHandcuff;
  2652.  
  2653. ownerHandcuff = cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID];
  2654.  
  2655. if(reason == REASON_DEATH && playerHandcuff[ownerHandcuff][E_UNSHACKLING_TARGET])
  2656. {
  2657. if(playerHandcuff[ownerHandcuff][E_CURRENT_TARGET] == playerid)
  2658. {
  2659. HideTDTargetClose(ownerHandcuff);
  2660.  
  2661. SetPVarInt(ownerHandcuff, "finalizeTextActionAnimation_1", true);
  2662.  
  2663. UnfreezePlayer(ownerHandcuff);
  2664.  
  2665. cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = false;
  2666. cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
  2667.  
  2668. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  2669.  
  2670. UnfreezePlayer(playerid);
  2671.  
  2672. RemovePlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF);
  2673.  
  2674. SendClientMessageEx(playerid, COLOR_GREEN, "<!> {FFFFFF}Você foi desalgemado por %s.", GetNameOfPlayer(ownerHandcuff));
  2675.  
  2676. return true;
  2677. }
  2678. }
  2679.  
  2680. new handcuffSlot = GetHandcuffSlotOfTarget(ownerHandcuff, playerid);
  2681.  
  2682. if(!~handcuffSlot)
  2683. playerHandcuff[ownerHandcuff][E_HANDCUFFED_PLAYERS][handcuffSlot] = INVALID_PLAYER_ID;
  2684.  
  2685. cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = false;
  2686. cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
  2687.  
  2688. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  2689.  
  2690. RemovePlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF);
  2691. //---------------------------------------------
  2692. SetPVarInt(ownerHandcuff, "enliveningAmount", true);
  2693. TextAmountAnimation(ownerHandcuff, false, 0, playerHandcuff[ownerHandcuff][E_HANDCUFFS_USED], playerHandcuff[ownerHandcuff][E_HANDCUFF_AMOUNT]);
  2694.  
  2695. playerHandcuff[ownerHandcuff][E_HANDCUFFS_USED]--;
  2696.  
  2697. if(reason == REASON_ADMIN)
  2698. {
  2699. SendClientMessageEx(playerid, COLOR_YELLOW, "<!> {FFFFFF}Você foi desalgemado pelo administrador %s!", GetNameOfPlayer(auxAdmin));
  2700. SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O administrador %s desalgemou %s. As algemas retornaram para você.", GetNameOfPlayer(auxAdmin), GetNameOfPlayer(playerid));
  2701. return true;
  2702. }
  2703.  
  2704. if(reason == REASON_DEATH)
  2705. {
  2706. if(playerHandcuff[ownerHandcuff][E_CURRENT_TARGET] == playerid && playerHandcuff[ownerHandcuff][E_HANDCUFFING_TARGET])
  2707. {
  2708. HideTDTargetClose(ownerHandcuff);
  2709.  
  2710. SetPVarInt(ownerHandcuff, "finalizeTextActionAnimation_0", true);
  2711.  
  2712. UnfreezePlayer(ownerHandcuff);
  2713.  
  2714. RemovePlayerAttachedObject(ownerHandcuff, INDEX_ATTACH_HANDCUFF);
  2715.  
  2716. SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O jogador %s morreu enquanto você o algemava, as algemas retornaram para você!", GetNameOfPlayer(playerid));
  2717. }
  2718. else
  2719. {
  2720. playerHandcuff[ownerHandcuff][E_HANDCUFF_AMOUNT]--;
  2721.  
  2722. new Float:pos[3];
  2723.  
  2724. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  2725.  
  2726. if(IsPlayerInRangeOfPoint(ownerHandcuff, 40.0, pos[0], pos[1], pos[2]))
  2727. {
  2728. cuffedPlayer[playerid][E_OWNER_LABEL_INFO] = CreatePlayer3DTextLabel(ownerHandcuff, "Tecle N para pegar suas algemas de volta", 0xFFFFFFFF, pos[0], pos[1], pos[2], 40.0, .testLOS = 1);
  2729.  
  2730. new indexFree = -1;
  2731.  
  2732. for(new i; i < MAX_HANDCUFFS; i++)
  2733. {
  2734. if(targetToRecoverHandcuff[ownerHandcuff][i] == INVALID_PLAYER_ID)
  2735. {
  2736. indexFree = i;
  2737. break;
  2738. }
  2739. }
  2740.  
  2741. if(!~indexFree)
  2742. goto removeHandcuff;
  2743.  
  2744. targetToRecoverHandcuff[ownerHandcuff][indexFree] = playerid;
  2745.  
  2746. SetPVarInt(playerid, "ownerMyHandcuff", ownerHandcuff);
  2747. SetPVarInt(playerid, "waitingSpawn", true);
  2748.  
  2749. FindTargetToRecoverHandcuff(ownerHandcuff);
  2750.  
  2751. SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}%s morreu, você ainda está perto do suspetio, tecle N próximo ao mesmo para recuperar suas algemas!", GetNameOfPlayer(playerid));
  2752.  
  2753. return true;
  2754. }
  2755. removeHandcuff:
  2756.  
  2757. SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}%s morreu, as algemas utilizadas foram perdidas!", GetNameOfPlayer(playerid));
  2758. }
  2759. }
  2760. else
  2761. {
  2762. SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}%s desconectou, as algemas utilizadas foram devolvidas!", GetNameOfPlayer(playerid));
  2763. }
  2764.  
  2765. return true;
  2766. }
  2767. /// <summary>
  2768. /// Desalgema um jogador específico offline.
  2769. /// </summary>
  2770. /// <param name="playerid">ID do jogador responsável pelo desalgemamento(administrador).</param>
  2771. /// <param name="playerName">Nome do jogador.</param>
  2772. /// <returns>True se bem sucedido, False se o jogador não estiver algemado.</returns>
  2773. stock UnshacklePlayerOffline(playerid, playerName[])
  2774. {
  2775. new ownerHandcuff,
  2776. handcuffSlot = -1,
  2777. players,
  2778. i,
  2779. a;
  2780.  
  2781. for(i = 0, players = GetPlayerPoolSize(); i <= players; i++)
  2782. {
  2783. if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
  2784. {
  2785. for(a = 0; a < playerHandcuff[i][E_HANDCUFF_AMOUNT]; a++)
  2786. {
  2787. if(playerHandcuff[i][E_HANDCUFFED_PLAYERS][a] == TARGET_STATE_OFFLINE)
  2788. {
  2789. if(!strcmp(playerTargetOffline[i][a], playerName) && !isnull(playerTargetOffline[i][a]))
  2790. {
  2791. handcuffSlot = a;
  2792. ownerHandcuff = i;
  2793. break;
  2794. }
  2795. }
  2796. }
  2797. }
  2798. }
  2799.  
  2800. if(!~handcuffSlot) return false;
  2801.  
  2802. SetPVarInt(ownerHandcuff, "enliveningAmount", true);
  2803. TextAmountAnimation(ownerHandcuff, false, 0, playerHandcuff[ownerHandcuff][E_HANDCUFFS_USED], playerHandcuff[ownerHandcuff][E_HANDCUFF_AMOUNT]);
  2804.  
  2805. playerHandcuff[ownerHandcuff][E_HANDCUFFED_PLAYERS][handcuffSlot] = INVALID_PLAYER_ID;
  2806. playerHandcuff[ownerHandcuff][E_HANDCUFFS_USED]--;
  2807.  
  2808. playerTargetOffline[ownerHandcuff][handcuffSlot] = "";
  2809.  
  2810. SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O administrador %s desalgemou %s. As algemas retornaram para você.", GetNameOfPlayer(playerid), playerName);
  2811.  
  2812. return true;
  2813. }
  2814. //------------------------------------
  2815. /// <summary>
  2816. /// Lista em uma caixa de diálogo o nome e o ID de todos os
  2817. /// suspeitos que um jogador específico algemou. Também é
  2818. /// acompanhado um item com a opção 'sobre'.
  2819. /// </summary>
  2820. /// <remarks>
  2821. /// Envia mensagens de erro se ocorrer.
  2822. /// </remarks>
  2823. /// <param name="playerid">ID do jogador.</param>
  2824. /// <returns>Não retorna valores específicos.</returns>
  2825. stock ListPlayerHandcuffKeys(playerid)
  2826. {
  2827. if(!playerHandcuff[playerid][E_HAVE_HANDCUFF])
  2828. return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não possui algemas!");
  2829.  
  2830. if(playerHandcuff[playerid][E_HANDCUFFS_USED] < 1)
  2831. return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não algemou nenhum suspeito!");
  2832.  
  2833. new
  2834. #if !RESET_TO_DISCONNECT
  2835. string[26 + 55 * MAX_HANDCUFFS + 34],
  2836. #else
  2837. string[18 + 31 * MAX_HANDCUFFS + 34],
  2838. #endif
  2839. strAux[55],
  2840. a,
  2841. target;
  2842.  
  2843. #if !RESET_TO_DISCONNECT
  2844. format(string, 26, "Jogador (nome/id)\tOnline");
  2845. #else
  2846. format(string, 18, "Jogador (nome/id)");
  2847. #endif
  2848.  
  2849. for(new i; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
  2850. {
  2851. target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i];
  2852.  
  2853. if(target != INVALID_PLAYER_ID)
  2854. {
  2855. #if !RESET_TO_DISCONNECT
  2856. if(target == TARGET_STATE_OFFLINE)
  2857. {
  2858. format(strAux, 54, "\n%s[-]\t{E84F33}Não{A9C4E4}", playerTargetOffline[playerid][i]);
  2859. }
  2860. else
  2861. {
  2862. format(strAux, 55, "\n%s[%d]\t{158C00}Sim{A9C4E4}", GetNameOfPlayer(target), target);
  2863. }
  2864. #else
  2865. format(strAux, 31, "\n%s[%d]", GetNameOfPlayer(target), target);
  2866. #endif
  2867.  
  2868. strcat(string, strAux);
  2869.  
  2870. playerHandcuff[playerid][E_AUX_TARGET_HANDCUFF_SLOT][a] = i;
  2871. a++;
  2872. }
  2873. }
  2874.  
  2875. if(!a) return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Ops...não há nenhum suspeito para listar!");
  2876.  
  2877. strcat(string, "\n{B9C9BF}{{A9C4E4}sobre{B9C9BF}}");
  2878.  
  2879. SetPVarInt(playerid, "DIALOG_LISTITEM_ABOUT", a);
  2880.  
  2881. ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED, DIALOG_STYLE_TABLIST_HEADERS, "Suspeitos algemados", string, "Detalhes", "Fechar");
  2882.  
  2883. return true;
  2884. }
  2885. //----------------------------------------
  2886. stock ShowPlayerPanelOfHandcuffs(playerid)
  2887. {
  2888. ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS, DIALOG_STYLE_LIST, "Handcuff System - Painel", "Ver jogadores algemados\nVer responsáveis pelas imobilizações", "Selecionar", "Fechar");
  2889.  
  2890. return true;
  2891. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement