Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Handcuffs System(Sistema de algemas)
- O Sistema de Algemas conta com uma maneira realista de algemar
- pessoas dentro do modo de jogo SA-MP, acompanhado de um controle
- de tais ações de maneira fácil e completa.
- Copyright (C) 2016 Bruno Travi(Bruno13)
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- Esqueleto do código:
- |
- *
- * INCLUDES
- *
- |
- *
- * DEFINITIONS
- *
- |
- *
- * ENUMERATORS
- *
- |
- *
- * VARIABLES
- *
- |
- *
- * NATIVE CALLBACKS
- *
- |
- *
- * MY CALLBACKS
- *
- |
- *
- * FUNCTIONS
- *
- |
- *
- * COMPLEMENTS
- *
- |
- *
- * INCLUDE FUNCTIONS
- *
- |
- INCLUDE FUNCTIONS:
- native GivePlayerHandcuff(playerid, amount);
- native RemovePlayerHandcuff(playerid, bool:unshackleTargets);
- native GetPlayerHandcuffAmmo(playerid);
- native GetPlayerHandcuffUsed(playerid);
- native PlayerHandcuffs(playerid);
- native IsPlayerWithHandcuffsInHands(playerid);
- native UnshacklePlayer(playerid, reason, auxAdmin = -1);
- native UnshacklePlayerOffline(playerid, playerName[]);
- native ListPlayerHandcuffKeys(playerid);
- native ShowPlayerPanelOfHandcuffs(playerid);
- */
- /*
- *****************************************************************************
- */
- //CODE DEFINITIONS:
- #define RESET_TO_DISCONNECT false
- #define MAX_HANDCUFFS 5
- #if defined MAX_PLAYERS
- #undef MAX_PLAYERS
- #endif
- #define MAX_PLAYERS 20
- //-------------------------------
- //MACROS:
- static stock stringf[256];
- #define call:%0(%1) forward %0(%1); public %0(%1)
- #define SendClientMessageEx(%0,%1,%2,%3) format(stringf, sizeof(stringf),%2,%3) && SendClientMessage(%0, %1, stringf)
- #if !defined isnull
- #define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
- #endif
- //DEFINITIONS:
- #define MAX_SKINS 312
- #define TYPE_HANDCUFF 0
- #define TYPE_UNSHACKLE 1
- #define TYPE_HANDCUFFING 2
- #define TYPE_UNSHACKLING 3
- #define TYPE_AMOUNT 4
- #define INDEX_ATTACH_HANDCUFF 9
- #define REASON_DEATH 0
- #define REASON_DISCONNECT 1
- #define REASON_ADMIN 2
- #define DIALOG_SUSPECTS_CUFFED 7059
- #define DIALOG_PANEL_HANDCUFFS 7084
- #define TARGET_STATE_OFFLINE -1
- #define INVALID_PLAYER_3DTEXT_ID PlayerText3D:(0xFFFF)
- /*
- *****************************************************************************
- */
- const
- COLOR_RED = 0xE84F33AA,
- COLOR_GREEN = 0x9ACD32AA,
- COLOR_YELLOW = 0xFCD440AA,
- size_E_TIME_CUFFED = MAX_HANDCUFFS * 36;
- enum E_TEXT_HANDCUFF_GLOBAL
- {
- Text:E_BACKGROUND[5],
- Text:E_PREVIEW,
- Text:E_DIVIDER
- }
- enum E_TEXT_HANDCUFF_PRIVATE
- {
- PlayerText:E_AMOUNT,
- PlayerText:E_TARGET_CLOSE,
- PlayerText:E_TEXT_ACTION
- }
- enum E_PLAYER_HANDCUFF
- {
- bool:E_HAVE_HANDCUFF,
- bool:E_HANDCUFF_IN_HANDS,
- bool:E_HANDCUFFING_TARGET,
- bool:E_UNSHACKLING_TARGET,
- E_HANDCUFF_AMOUNT,
- E_HANDCUFFS_USED,
- E_HANDCUFFED_PLAYERS[MAX_HANDCUFFS],
- E_CURRENT_TARGET,
- E_AUX_TARGET_HANDCUFF_SLOT[MAX_HANDCUFFS],
- E_TIMESTAMP_CUFFED[MAX_HANDCUFFS],
- E_TIME_CUFFED[size_E_TIME_CUFFED]
- }
- #define E_TIME_CUFFED][%1][%2] E_TIME_CUFFED][((%1)*36)+(%2)]
- enum E_CUFFED_PLAYER
- {
- bool:E_PLAYER_HANDCUFFED,
- E_OWNER_HANDCUFF_ID,
- PlayerText3D:E_OWNER_LABEL_INFO
- }
- enum E_ATTACH_HANDCUFF
- {
- Float:E_ATTACH_OFFSETX,
- Float:E_ATTACH_OFFSETY,
- Float:E_ATTACH_OFFSETZ,
- Float:E_ATTACH_ROTX,
- Float:E_ATTACH_ROTY,
- Float:E_ATTACH_ROTZ,
- Float:E_ATTACH_SCALEX,
- Float:E_ATTACH_SCALEY,
- Float:E_ATTACH_SCALEZ
- }
- /*
- *****************************************************************************
- */
- static
- /// <summary>
- /// Variáveis de controle das TextDraws Globais/Privadas.</summary>
- Text:textHandcuffGlobal[E_TEXT_HANDCUFF_GLOBAL],
- PlayerText:textHandcuffPrivate[MAX_PLAYERS][E_TEXT_HANDCUFF_PRIVATE],
- Text:textWarningRecovery[2],
- /// <summary>
- /// Variáveis de controle das algemas do jogador.</summary>
- playerHandcuff[MAX_PLAYERS][E_PLAYER_HANDCUFF],
- /// <summary>
- /// Variáveis de controle das algemas do suspeito.</summary>
- cuffedPlayer[MAX_PLAYERS][E_CUFFED_PLAYER],
- #if !RESET_TO_DISCONNECT
- /// <summary>
- /// Variável para armazenar nome do alvo algemado offline.</summary>
- playerTargetOffline[MAX_PLAYERS][MAX_HANDCUFFS][MAX_PLAYER_NAME],
- #endif
- /// <summary>
- /// Variável para controle de estado do suspeito (morto/vivo).</summary>
- bool:playerDeath[MAX_PLAYERS],
- /// <summary>
- /// Variável para controle de suspeitos que morrerem algemados.</summary>
- /// <remarks>
- /// MAX_HANDCUFFS define o máximo de slots possíveis para se usar; para
- /// ocorrer um estouro de slots seria necessário o jogador ter atingido
- /// o máximo de jogadores possíveis de se algemar definido por MAX_HANDCUFFS,
- /// e todos estes teriam que morrer em um tempo determinado menor que o
- /// respawn onde todos os mesmos se encontrem em um raio que 40 metros,
- /// e o jogador teria de algemar um novo suspeito e o mesmo morrer no
- /// instante que algemado, isso tudo dentro do tempo dado determinado.
- /// Possibilidades:
- /// MAX_HANDCUFFS + 1 = algemados && mortos && a 40m de distância
- /// do responsável pelas imobilizações.
- /// </remarks>
- targetToRecoverHandcuff[MAX_PLAYERS][MAX_HANDCUFFS],
- /// <summary>
- /// Variável de controle do alvo atual localizado na frente do jogador para recuperar as algemas.</summary>
- targetToRecoverCurrent[MAX_PLAYERS],
- /// <summary>
- /// Variável de controle do id dos jogadores listados no Handcuff Panel.</summary>
- handcuffPanelId[MAX_PLAYERS][MAX_PLAYERS],/// <summary>
- /// Variável de controle do nome dos jogadores listados no Handcuff Panel.</summary>
- handcuffPanelName[MAX_PLAYERS][MAX_PLAYERS][MAX_PLAYER_NAME],
- /// <summary>
- /// Attachment das algemas para todas skins.</summary>
- attachHandcuff[MAX_SKINS][E_ATTACH_HANDCUFF] = {
- {0.000000,0.028000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000},
- {-0.014999,0.086000,-0.010999,12.599996,-19.000000,105.900047,1.360999,1.366997,1.832999},
- {0.009999,0.042000,0.003000,0.799998,-7.000002,105.900047,1.046998,1.413997,1.815999},
- {0.009999,0.042000,0.003000,0.799998,-7.000002,105.900047,1.046998,1.413997,1.815999},
- {0.014000,0.105000,0.024000,15.700033,-1.799994,105.500068,1.367998,1.462997,1.871998},
- {0.043000,0.052000,-0.004999,-5.299966,-12.599994,101.400169,0.939997,1.462997,1.632997},
- {0.026000,0.036000,-0.001000,10.800045,3.899997,105.800300,0.889997,1.462997,1.658998},
- {0.026000,0.047000,-0.008000,10.800045,3.899997,105.800300,0.889997,1.462997,1.658998},
- {0.026000,0.041000,0.014000,10.800045,3.899997,105.800300,0.889997,1.462997,1.658998},
- {0.044999,0.041000,0.014000,10.800045,3.899997,105.800300,0.889997,1.462997,1.658998},
- {0.033999,0.042000,0.018999,9.900040,-25.500000,105.800300,1.137996,1.462997,1.703998},
- {0.014999,0.049000,-0.003000,13.800049,-7.000001,112.500358,1.077996,1.462997,1.376997},
- {0.014999,0.042000,0.000000,5.600040,-7.000001,112.500358,0.918996,1.462997,1.102997},
- {0.014999,0.048000,0.000000,18.400028,-7.000001,102.400390,0.942997,1.462997,1.389997},
- {0.014999,0.083000,0.003999,10.100030,-7.000001,102.400390,1.219996,1.462997,1.389997},
- {0.007999,0.036000,0.011999,12.500087,1.500015,108.400367,1.001996,1.462997,1.639996},
- {0.019999,0.080000,0.005999,12.500087,4.700020,102.100402,1.295996,1.462997,1.865996},
- {0.031999,0.045000,0.002999,4.100083,-7.299978,102.100402,0.962997,1.462997,1.792995},
- {0.031999,0.045000,0.002999,4.100083,-7.299978,102.100402,0.962997,1.462997,1.792995},
- {0.007999,0.076000,0.002999,8.600082,-7.299978,102.100372,1.325997,1.462997,1.659996},
- {0.024999,0.046000,-0.007000,8.600082,-7.299978,102.100372,0.984996,1.462997,1.604996},
- {0.024999,0.046000,-0.007000,8.600082,-7.299978,102.100372,0.984996,1.462997,1.604996},
- {0.036999,0.046000,-0.007000,8.600082,-7.299978,102.100372,0.984996,1.462997,1.604996},
- {0.007999,0.117000,0.006000,10.700078,0.900015,102.100372,1.800996,1.462997,1.533998},
- {0.005999,0.047000,-0.007999,1.000082,7.400019,102.100372,1.043996,1.462997,1.533998},
- {0.004999,0.047000,-0.006999,1.000082,7.400019,102.100372,1.043996,1.462997,1.657999},
- {0.023999,0.074000,0.008999,11.100081,7.400019,98.300369,1.250996,1.462997,1.657999},
- {0.011999,0.043000,-0.000999,7.900086,-2.699957,105.200386,0.841996,1.462997,1.643997},
- {0.008999,0.047000,-0.008999,7.900086,-2.699957,105.200386,0.894996,1.462997,1.409996},
- {0.022999,0.052000,-0.001999,7.800083,-2.699957,98.900421,0.894996,1.462997,1.529996},
- {0.011999,0.040000,-0.002999,7.800083,5.100040,98.900421,0.939995,1.462997,1.604997},
- {0.005999,0.037000,0.003000,9.500092,4.300041,100.800415,1.303994,1.462997,1.570997},
- {-0.006000,0.054000,-0.013999,3.300095,3.500038,100.800415,0.978994,1.462997,1.194997},
- {0.025000,0.048000,-0.006999,4.900100,-2.399965,103.900466,0.875994,1.462997,1.416997},
- {0.004999,0.074000,0.004000,4.900100,5.500036,100.400382,1.177993,1.462997,1.416997},
- {-0.014000,0.055000,-0.005999,1.300099,4.200041,100.400382,0.967993,1.462997,1.584998},
- {-0.014000,0.055000,-0.005999,1.300099,4.200041,97.500305,0.967993,1.462997,1.584998},
- {-0.014000,0.055000,-0.005999,1.300099,4.200041,97.500305,0.967993,1.462997,1.584998},
- {0.001999,0.065000,0.008999,11.300105,4.200041,97.500305,1.104993,1.462997,1.422998},
- {0.017999,0.042000,0.021999,11.900110,-11.099953,105.900276,1.104993,1.462997,1.422998},
- {0.017999,0.042000,0.002000,20.300098,-11.099953,105.900276,0.879993,1.462997,1.232998},
- {0.001999,0.049000,-0.000999,12.700086,-11.099953,105.900276,0.915992,1.462997,1.232998},
- {0.006999,0.045000,0.006000,3.300084,10.900049,100.500289,0.848993,1.462997,1.481998},
- {0.006999,0.049000,-0.005999,2.400082,4.300047,100.500289,0.848993,1.462997,1.324998},
- {-0.007000,0.060000,0.004999,2.400082,4.300047,97.900260,0.947993,1.462997,1.212998},
- {0.013999,0.043000,0.002000,4.600088,4.300047,104.000236,0.947993,1.462997,1.321998},
- {0.018999,0.047000,-0.002999,1.600091,0.900045,98.700248,0.898993,1.462997,1.337998},
- {0.018999,0.041000,-0.002999,8.000088,0.900045,98.700248,0.925992,1.462997,1.384999},
- {0.018999,0.041000,-0.002999,8.000088,0.900045,98.700248,0.925992,1.462997,1.384999},
- {0.005999,0.022000,0.008000,2.200085,20.700099,98.700248,0.668994,1.462997,1.195999},
- {0.032000,0.032000,0.013999,12.200083,1.300106,98.700248,0.940994,1.462997,1.640998},
- {0.013000,0.079000,0.006999,12.200083,-1.099895,102.900245,1.259995,1.462997,1.550998},
- {0.013000,0.079000,0.006999,12.200083,-1.099895,102.900245,1.259995,1.462997,1.550998},
- {-0.008999,0.063000,0.002999,13.000080,3.500106,100.900253,1.133995,1.462997,1.315997},
- {0.001999,0.058000,0.018999,-2.699920,-5.499893,100.900253,1.133995,1.462997,1.535998},
- {0.009999,0.041000,-0.006000,11.400078,6.900105,100.900253,0.807994,1.462997,1.264997},
- {0.016999,0.041000,0.000999,11.400078,6.900105,100.900253,0.881994,1.462997,1.264997},
- {0.017999,0.022000,-0.004000,11.000072,1.500108,100.900253,0.368994,1.462997,1.282997},
- {-0.007000,0.059000,-0.000000,11.000072,1.500108,96.600273,0.984994,1.462997,1.225996},
- {0.014999,0.048000,-0.005000,2.300077,1.500108,96.600273,0.957993,1.458997,1.442996},
- {0.014999,0.041000,-0.009000,9.800080,1.500108,96.600273,0.887994,1.458997,1.528998},
- {0.030000,0.048000,-0.001000,9.600079,4.000106,103.300270,0.869994,1.458997,1.580998},
- {0.013000,0.093999,0.002999,9.600079,4.000106,103.300270,1.425994,1.458997,1.750998},
- {0.004000,0.073999,0.002999,9.600079,4.000106,103.300270,1.067994,1.458997,1.510998},
- {0.004000,0.056999,0.002999,9.600079,4.000106,103.300270,0.977994,1.458997,1.364998},
- {0.004000,0.052999,0.002999,9.600079,4.000106,103.300270,0.882994,1.458997,1.364998},
- {0.004000,0.034999,-0.003000,6.000085,11.000102,103.300270,0.824995,1.458997,1.666998},
- {0.004000,0.034999,-0.003000,6.000085,11.000102,103.300270,0.824995,1.458997,1.666998},
- {0.030000,0.051999,-0.002000,6.000085,11.000102,103.300270,0.840995,1.458997,1.776998},
- {-0.000999,0.050999,0.000999,10.300077,3.900110,103.300270,0.840995,1.458997,1.124996},
- {0.024000,0.039999,-0.002000,4.100079,3.900110,103.300270,0.880995,1.458997,2.112996},
- {0.024000,0.049999,-0.002000,4.100079,3.900110,103.300270,0.880995,1.458997,1.863996},
- {-0.000999,0.062999,0.000999,4.100079,3.900110,103.300270,1.134994,1.458997,1.460996},
- {-0.000999,0.062999,0.000999,4.100079,3.900110,103.300270,1.134994,1.458997,1.460996},
- {0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000},
- {-0.000999,0.053999,-0.007000,8.200078,3.900110,103.300270,0.940994,1.458997,1.208996},
- {0.017000,0.043999,0.000999,8.200078,3.900110,103.300270,0.828994,1.458997,1.208996},
- {0.017000,0.029999,0.003999,4.300076,3.900110,103.300270,0.725994,1.458997,1.836995},
- {0.032000,0.049999,0.001999,4.300076,3.900110,103.300270,0.906994,1.458997,1.836995},
- {0.032000,0.047999,0.006999,3.600075,3.900110,103.300270,0.848994,1.458997,1.836995},
- {-0.015999,0.052999,0.002999,3.600075,3.900110,99.100280,0.892994,1.458997,1.302994},
- {-0.015999,0.052999,0.002999,3.600075,3.900110,99.100280,0.892994,1.458997,1.302994},
- {0.037000,0.050999,-0.012000,22.900085,6.400109,99.100280,0.953994,1.458997,1.618994},
- {0.037000,0.045999,-0.018000,1.600077,4.800109,99.100280,0.953994,1.458997,1.618994},
- {0.037000,0.045999,-0.018000,1.600077,4.800109,99.100280,0.953994,1.458997,1.618994},
- {0.041999,0.029999,-0.006000,9.200077,2.700113,111.500312,0.577995,1.458997,1.316994},
- {0.004000,0.044999,-0.004000,2.200080,2.700113,104.600303,0.950994,1.458997,1.456994},
- {-0.014999,0.021999,-0.003000,0.700078,2.700113,104.600303,0.614994,1.458997,0.833993},
- {-0.012999,0.061999,0.020999,4.900081,2.700113,104.600303,1.087994,1.458997,1.356994},
- {0.016000,0.041999,-0.000000,4.900081,1.400117,104.600303,1.163994,1.458997,1.851994},
- {-0.007999,0.067999,0.004999,13.500082,-0.399884,104.600303,1.157993,1.458997,1.210994},
- {0.006000,0.041999,0.004999,13.500082,-0.399884,104.600303,0.853993,1.458997,1.210994},
- {0.006000,0.068999,0.004999,13.500082,-0.399884,104.600303,1.147994,1.458997,1.207994},
- {0.006000,0.053999,0.004999,13.500082,-0.399884,104.600303,0.886994,1.458997,1.207994},
- {0.006000,0.050999,-0.005000,-1.099917,-0.399884,104.600303,0.912994,1.458997,1.207994},
- {-0.003999,0.061999,-0.001000,6.500079,-0.399884,100.000244,0.999994,1.458997,1.207994},
- {0.034000,0.074999,0.011999,11.600084,-0.399884,100.000244,1.257994,1.458997,1.463994},
- {0.041000,0.049999,0.001999,9.700089,-0.399884,100.000244,1.115994,1.458997,1.463994},
- {0.005000,0.043999,-0.014000,3.400087,-0.399884,100.000244,0.935994,1.458997,1.449994},
- {0.014999,0.076999,0.010999,8.900087,-0.399884,100.000244,1.246994,1.458997,1.449994},
- {0.007000,0.043000,-0.005000,8.900087,-0.399884,100.000244,0.940995,1.458997,1.449994},
- {0.027000,0.033000,-0.000000,8.900087,-0.399884,104.400253,0.830995,1.458997,1.932995},
- {0.027000,0.043000,-0.009000,8.900087,-0.399884,104.400253,0.982994,1.458997,1.620995},
- {0.037000,0.156000,0.018999,13.600082,-2.999883,97.300231,2.229995,1.458997,1.689993},
- {0.037000,0.043000,-0.007000,13.600082,-2.999883,97.300231,0.866995,1.458997,1.494994},
- {0.001999,0.156000,0.012999,8.600086,-2.999883,106.200225,2.147995,1.458997,1.612992},
- {0.011999,0.038000,-0.009000,8.600086,-2.999883,106.200225,0.847995,1.458997,1.474992},
- {0.011999,0.050000,-0.005000,8.600086,-2.999883,106.200225,0.965995,1.458997,1.474992},
- {0.011999,0.090000,0.001999,8.600086,-2.999883,106.200225,1.424995,1.458997,1.474992},
- {0.011999,0.042000,-0.010000,8.600086,-2.999883,106.200225,0.890994,1.458997,1.500992},
- {0.011999,0.042000,-0.010000,8.600086,-2.999883,106.200225,0.890994,1.458997,1.500992},
- {0.005999,0.055999,0.002999,7.000087,-2.999883,106.200225,1.079994,1.579996,1.917991},
- {0.019999,0.063000,0.006999,7.000087,-2.999883,106.200225,1.079994,1.579996,1.917991},
- {0.007999,0.088000,0.002999,12.600087,-7.499875,106.200225,1.241994,1.579996,1.712991},
- {0.007999,0.039000,-0.005000,12.600087,-7.499875,106.200225,0.987994,1.579996,1.603991},
- {0.036999,0.039000,-0.005000,12.600087,-7.499875,106.200225,0.981994,1.579996,1.706992},
- {-0.002000,0.039000,-0.005000,11.100088,-7.499875,106.200225,0.981994,1.579996,1.579992},
- {0.023999,0.014000,-0.005000,11.100088,-7.499875,106.200225,0.424995,1.579996,1.501992},
- {0.023999,0.014000,-0.005000,11.100088,-7.499875,106.200225,0.424995,1.579996,1.501992},
- {0.006999,0.042000,-0.016000,11.100088,-7.499875,106.200225,0.741994,1.579996,1.501992},
- {0.016999,0.090000,0.010999,11.100088,0.700125,104.300231,1.481995,1.579996,1.501992},
- {-0.015000,0.078999,0.001999,11.100088,0.700125,104.300231,1.291995,1.579996,1.501992},
- {-0.004000,0.087000,0.006999,6.000093,0.700125,99.400192,1.291995,1.579996,1.557992},
- {0.034000,0.042000,-0.009000,6.900094,0.700125,99.400192,0.903993,1.579996,1.733992},
- {0.012000,0.046999,0.004999,2.700091,2.400134,99.400192,0.797993,1.579996,1.297991},
- {0.017000,0.047999,0.005999,2.700091,2.400134,99.400192,0.901993,1.579996,1.716992},
- {0.017000,0.047999,0.007999,10.400096,2.400134,99.400192,0.901993,1.579996,1.438992},
- {0.017999,0.060999,-0.008000,-5.399903,2.400134,99.400192,1.244992,1.579996,1.438992},
- {0.000000,0.068999,0.001999,10.400096,2.400134,99.400192,1.121993,1.579996,1.536992},
- {-0.007000,0.068999,0.010999,10.400096,2.400134,109.800201,0.904993,1.579996,1.197992},
- {-0.007000,0.041999,0.008999,3.900115,2.400134,103.000251,1.078993,1.579996,1.395994},
- {0.000000,0.055999,-0.001000,8.100112,2.400134,103.000251,0.982993,1.579996,0.859995},
- {0.003999,0.055999,-0.016000,3.700113,2.400134,96.500381,0.924993,1.579996,1.037994},
- {0.003999,0.074999,0.008999,3.700113,2.400134,96.500381,1.151994,1.579996,1.278993},
- {-0.007000,0.035999,-0.002000,5.700114,2.400134,100.100326,0.700994,1.579996,1.136993},
- {0.005999,0.045999,-0.008000,5.700114,2.400134,100.100326,0.700994,1.579996,1.230994},
- {0.034999,0.045999,-0.008000,5.700114,2.400134,100.100326,0.783994,1.579996,1.413993},
- {-0.001000,0.031999,-0.003000,-2.399884,0.100136,100.100326,0.539994,1.579996,1.060993},
- {0.004999,0.069999,0.002999,5.900113,-3.299866,104.900253,1.154994,1.579996,1.109994},
- {0.004999,0.069999,0.002999,5.900113,-3.299866,104.900253,1.154994,1.579996,1.109994},
- {0.004999,0.069999,0.002999,5.900113,-3.299866,104.900253,1.154994,1.579996,1.109994},
- {0.014999,0.039999,0.003999,5.900113,-3.299866,104.900253,0.835994,1.579996,1.109994},
- {0.021999,0.040999,0.002999,2.000117,16.300134,97.600318,0.835994,1.579996,1.487993},
- {0.017999,0.040999,0.002999,2.000117,16.300134,97.600318,0.835994,1.579996,1.786993},
- {0.016999,0.038999,-0.009000,3.700117,-0.099870,97.600318,0.891995,1.579996,1.568994},
- {0.004999,0.068999,0.003999,10.000118,-0.099870,109.300300,1.115995,1.579996,1.293994},
- {0.004999,0.077999,0.003999,10.000118,-0.099870,100.900260,1.249997,1.579996,1.483994},
- {0.030999,0.042999,-0.001000,1.500119,-0.099870,102.200256,0.941996,1.547997,1.713993},
- {0.023999,0.042999,0.003999,16.600111,-0.099870,102.200256,0.872996,1.547997,1.122990},
- {-0.005000,0.039999,0.011999,10.900110,8.800132,109.600257,0.872996,1.547997,1.411990},
- {0.020999,0.043999,0.003999,10.900110,8.800132,105.400238,0.872996,1.547997,1.171989},
- {-0.000000,0.062999,0.008999,8.800113,8.800132,99.900207,1.218996,1.547997,1.340990},
- {0.002999,0.052999,0.004999,1.600115,8.800132,99.900207,0.966997,1.547997,1.169989},
- {0.002999,0.045999,-0.001000,-2.899890,8.300136,99.900207,0.966997,1.547997,1.470989},
- {0.012999,0.047999,0.006999,3.600113,8.300136,99.900207,0.924997,1.547997,1.371989},
- {0.012999,0.040999,-0.006000,3.600113,8.300136,99.900207,1.001996,1.547997,1.571989},
- {0.011999,0.082999,0.010999,17.800117,-14.499862,104.100166,1.368997,1.547997,1.439989},
- {-0.001000,0.060999,-0.003000,12.500124,-11.899868,104.100166,0.938997,1.547997,1.108989},
- {0.010999,0.075999,0.003999,6.300136,5.500131,100.400108,1.263997,1.547997,1.625988},
- {-0.011000,0.050999,0.001999,1.900139,5.500131,100.400108,0.888997,1.547997,1.164989},
- {-0.011000,0.027999,0.008999,-0.999870,5.500131,100.400108,0.676998,1.547997,1.252989},
- {-0.000000,0.046999,-0.006000,6.600131,-5.899869,100.400108,0.967997,1.547997,1.692989},
- {0.011999,0.070999,0.014999,6.600131,-5.899869,100.400108,0.811997,1.547997,1.503990},
- {0.011999,0.047999,-0.007000,6.600131,-5.899869,100.400108,0.872996,1.547997,1.928990},
- {0.011999,0.050999,0.001999,6.600131,-5.899869,100.400108,0.872996,1.547997,1.928990},
- {-0.013000,0.029999,0.005999,6.600131,-5.899869,100.400108,0.696996,1.547997,1.557990},
- {-0.012000,0.029999,0.005999,6.600131,-5.899869,100.400108,0.696996,1.547997,1.557990},
- {0.002999,0.038999,0.003999,7.700127,-2.099872,100.400108,0.823997,1.584997,1.751989},
- {0.002999,0.045999,0.002999,-0.199867,-0.099875,100.400108,0.953997,1.584997,1.648990},
- {0.004999,0.043999,0.002999,8.100131,-0.099875,100.400108,0.883996,1.584997,1.104989},
- {-0.010000,0.037999,-0.006000,8.100131,-0.099875,113.800140,0.880996,1.940997,1.355989},
- {0.011999,0.044999,0.004999,8.100131,-0.099875,105.000167,0.880996,1.940997,1.451989},
- {0.005999,0.048999,0.004999,4.700133,-0.099875,105.000167,0.910996,1.940997,1.132988},
- {0.011999,0.043999,-0.004000,4.700133,-0.099875,105.000167,0.910996,1.940997,1.452988},
- {0.011999,0.043999,-0.004000,4.700133,-0.099875,105.000167,0.910996,1.940997,1.452988},
- {0.011999,0.043999,-0.004000,4.700133,-0.099875,105.000167,0.910996,1.940997,1.452988},
- {0.008999,0.041999,-0.008000,3.000131,10.000123,105.000167,0.910996,1.940997,1.520989},
- {0.008999,0.041999,-0.004000,3.000131,10.000123,105.000167,0.910996,1.940997,1.520989},
- {-0.008000,0.069999,0.006999,3.000131,10.000123,105.000167,1.157995,1.940997,1.139989},
- {-0.009000,0.045999,-0.008000,3.000131,10.000123,105.000167,1.094995,1.940997,1.433989},
- {-0.009000,0.044999,-0.009000,3.000131,10.000123,105.000167,1.094995,1.940997,1.433989},
- {0.006999,0.068999,0.007999,11.600146,-8.199888,105.000167,1.450996,1.940997,1.433989},
- {0.033999,0.048999,-0.006000,11.000148,1.200112,105.000167,0.823996,1.940997,1.755989},
- {0.025999,0.048999,-0.006000,11.000148,1.200112,105.000167,0.863996,1.940997,1.885989},
- {-0.002000,0.092999,0.000999,11.600142,-12.099889,105.000167,1.569996,1.940997,1.575989},
- {0.020999,0.047999,0.008999,11.600142,-0.599889,105.000167,0.838996,1.940997,1.575989},
- {0.028999,0.044999,-0.005000,6.700139,-0.899889,105.000167,0.868996,1.940997,1.575989},
- {0.043999,0.037999,0.012999,1.400139,-0.899889,105.000167,0.919995,1.940997,1.715989},
- {0.002999,0.086999,0.004999,10.000142,-0.899889,105.000167,1.364996,1.940997,1.715989},
- {0.012999,0.044999,0.002999,10.200143,-0.899889,105.000167,0.875996,1.940997,1.298989},
- {-0.004000,0.057999,0.001999,10.200143,-0.899889,105.000167,1.022996,1.940997,1.055988},
- {-0.004000,0.063999,0.004999,10.200143,-0.899889,105.000167,1.022996,1.940997,1.055988},
- {-0.004000,0.063999,0.004999,7.500146,-0.899889,105.000167,1.022996,1.940997,1.055988},
- {-0.004000,0.061999,0.004999,7.500146,-0.899889,105.000167,1.022996,1.940997,1.055988},
- {-0.006000,0.061999,0.004999,9.100159,-0.899889,105.000167,1.022996,1.940997,1.055988},
- {-0.006000,0.061999,0.004999,9.100159,-0.899889,105.000167,1.067996,1.940997,1.200987},
- {-0.006000,0.061999,0.004999,9.100159,-0.899889,105.000167,1.067996,1.940997,1.200987},
- {-0.005000,0.043999,0.004999,9.100159,-0.899889,105.000167,1.043997,1.940997,1.325988},
- {-0.015000,0.053999,0.002999,7.700170,-0.899889,102.300231,0.999997,1.940997,1.009988},
- {0.003999,0.053999,0.018999,13.500167,-0.899889,102.300231,0.999997,1.940997,1.202987},
- {0.004999,0.075999,0.005999,7.100166,5.400113,102.300231,1.162997,1.940997,1.202987},
- {-0.006000,0.056999,-0.004000,7.100166,-5.599886,102.300231,0.951997,1.940997,1.202987},
- {-0.000000,0.069999,0.007999,3.400164,2.600114,102.300231,1.173997,1.940997,1.356988},
- {0.012999,0.039999,-0.007000,3.400164,2.600114,102.300231,0.971998,1.940997,1.600987},
- {0.012999,0.039999,-0.007000,3.400164,2.600114,102.300231,0.971998,1.940997,1.600987},
- {0.012999,0.070999,0.003999,12.700165,2.600114,102.300231,1.234998,1.940997,1.600987},
- {0.012999,0.070999,0.006999,9.400169,1.200114,102.300231,1.234998,1.940997,1.347987},
- {-0.002000,0.037999,0.000999,9.400169,1.200114,102.300231,0.888998,1.940997,1.347987},
- {0.023999,-0.009000,0.000999,9.400169,1.200114,102.300231,0.602998,1.940997,1.347987},
- {-0.016000,0.043999,-0.017000,6.600165,1.200114,102.300231,0.865998,1.940997,1.014986},
- {-0.008999,0.030999,0.010999,1.500166,1.200114,102.300231,0.767998,1.940997,1.085987},
- {-0.008999,0.045999,-0.000000,12.500167,1.200114,102.300231,0.876998,1.940997,1.188987},
- {0.009999,0.038999,-0.001000,12.500167,1.200114,102.300231,0.876998,1.940997,0.970987},
- {-0.007000,0.034999,0.004999,8.100160,1.200114,102.300231,0.876998,1.940997,1.490986},
- {0.000000,0.038999,-0.000000,8.100160,-7.199883,102.300231,0.876998,1.940997,1.061986},
- {0.000000,0.043999,0.000999,8.100160,-7.199883,102.300231,0.810998,1.940997,1.061986},
- {0.008999,0.040999,0.000999,12.400161,-7.199883,102.300231,0.810998,1.940997,1.061986},
- {0.007999,0.087999,0.006999,9.100162,-0.699883,102.300231,1.336998,1.940997,1.680986},
- {-0.028000,0.043999,0.002999,9.100162,-0.699883,102.300231,1.186998,1.940997,1.550985},
- {0.020999,0.043999,0.002999,9.100162,-0.699883,102.300231,0.901998,1.940997,1.180986},
- {0.020999,0.052999,-0.002000,3.100164,-0.699883,102.300231,0.813998,1.940997,1.478985},
- {0.006999,0.077999,0.017999,3.100164,-0.699883,102.300231,1.374998,1.940997,1.316985},
- {0.006999,0.077999,0.017999,3.100164,-0.699883,102.300231,1.374998,1.940997,1.316985},
- {0.006999,0.044999,-0.007000,-0.199833,-0.699883,97.600227,0.877998,1.940997,1.396985},
- {0.005999,0.044999,-0.004000,11.300162,-0.699883,106.200180,0.877998,1.940997,1.199985},
- {0.005999,0.044999,-0.004000,11.300162,-0.699883,106.200180,0.877998,1.940997,1.199985},
- {0.005999,0.044999,-0.004000,11.300162,-0.699883,106.200180,0.877998,1.940997,1.199985},
- {0.017999,0.019999,-0.004000,11.300162,-0.699883,106.200180,0.560998,1.940997,1.297984},
- {-0.020000,0.045999,-0.004000,9.300167,-0.699883,106.200180,0.936998,1.940997,1.535983},
- {0.005999,0.063999,0.006999,9.300167,-0.699883,99.400238,1.034997,1.940997,1.277983},
- {0.014999,0.025999,0.000999,9.300167,-0.699883,99.400238,0.759998,1.940997,1.599983},
- {-0.002000,0.066999,0.011999,12.900163,-0.699883,99.400238,1.063998,1.940997,1.483982},
- {0.002999,0.041999,0.009999,7.400167,-0.699883,101.300277,1.168998,1.940997,1.483982},
- {0.002999,0.046999,0.000999,7.400167,-0.699883,101.300277,0.927998,1.940997,1.222983},
- {0.002999,0.059999,0.000999,7.400167,-0.699883,101.300277,1.012997,1.940997,1.222983},
- {0.000999,0.053999,0.000999,7.400167,-0.699883,101.300277,0.910998,1.940997,1.222983},
- {-0.003000,0.061999,-0.001000,7.400167,-0.699883,101.300277,1.017998,1.940997,1.222983},
- {-0.003000,0.052999,0.000999,1.200168,-0.699883,101.300277,0.945997,1.940997,1.092982},
- {-0.003000,0.055999,0.000999,6.100170,-0.699883,101.300277,0.945997,1.940997,1.092982},
- {-0.001000,0.038999,0.011999,6.100170,-0.699883,101.300277,0.945997,1.940997,1.092982},
- {0.003999,0.044999,-0.001000,5.800170,-0.699883,101.300277,0.958997,1.940997,1.416981},
- {0.003999,0.046999,-0.004000,5.800170,-0.699883,101.300277,0.958997,1.940997,1.638981},
- {0.003999,0.049999,-0.004000,5.800170,-0.699883,101.300277,0.876997,1.940997,1.816981},
- {-0.024000,0.041999,0.002999,11.500181,-0.699883,104.700279,0.876997,1.940997,1.166980},
- {-0.005000,0.031999,-0.004000,11.500181,-0.699883,104.700279,0.777998,1.940997,1.166980},
- {0.010999,0.066999,0.011999,11.500181,-0.699883,104.700279,1.211998,1.940997,1.335980},
- {-0.014000,0.018999,-0.010000,-1.299805,-0.699883,104.700279,0.680999,1.940997,1.136980},
- {0.007999,0.040999,-0.011000,4.400195,-0.699883,104.700279,0.994999,1.940997,1.479980},
- {0.007999,0.040999,-0.011000,4.400195,-0.699883,104.700279,0.994999,1.940997,1.479980},
- {0.035000,0.037999,0.015999,4.400195,-0.699883,104.700279,0.994999,1.940997,1.479980},
- {-0.015999,0.095999,0.004999,4.400195,-0.699883,104.700279,1.552999,1.940997,1.799980},
- {-0.015999,0.065999,0.001999,4.400195,-0.699883,104.700279,1.144999,1.940997,1.332981},
- {-0.012999,0.078999,0.014999,4.400195,-0.699883,104.700279,1.237999,1.940997,1.332981},
- {0.006000,0.044999,0.000999,4.400195,-0.699883,104.700279,1.006999,1.940997,1.332981},
- {0.006000,0.044999,-0.011000,4.400195,-0.699883,104.700279,1.006999,1.940997,1.383981},
- {0.006000,0.044999,-0.004000,-0.399802,-0.699883,104.700279,0.992999,1.940997,1.624981},
- {-0.001999,0.054999,-0.004000,10.600196,-0.699883,104.700279,0.925999,1.940997,1.138981},
- {-0.001999,0.043999,-0.004000,10.600196,-0.699883,104.700279,0.925999,1.940997,1.138981},
- {-0.001999,0.085999,0.008999,10.600196,-0.699883,104.700279,1.367999,1.940997,1.760981},
- {-0.001999,0.085999,0.008999,10.600196,-0.699883,104.700279,1.367999,1.940997,1.760981},
- {0.005000,0.042999,-0.000000,6.000197,-0.699883,104.700279,0.925999,1.940997,1.563981},
- {-0.006999,0.031999,0.006999,6.000197,-0.699883,104.700279,0.777999,1.940997,1.200981},
- {0.001000,0.042999,0.008999,2.900198,-0.699883,104.700279,0.777999,1.940997,1.086981},
- {0.001000,0.039999,0.001999,7.600195,-0.699883,104.700279,0.877999,1.940997,0.997981},
- {0.016000,0.050999,0.000999,6.100193,-0.699883,104.700279,0.929999,1.940997,1.743982},
- {0.002000,0.057999,-0.005000,6.100193,-0.699883,102.100257,0.904999,1.940997,1.470981},
- {0.002000,0.041999,0.006999,6.100193,-0.699883,102.100257,0.904999,1.940997,1.470981},
- {-0.017999,0.013999,0.006999,6.100193,-0.699883,102.100257,0.638999,1.940997,1.420981},
- {-0.009999,0.046999,-0.009000,-1.999806,-0.699883,102.100257,0.896998,1.940997,1.685980},
- {0.004000,0.047999,0.010999,10.400196,-0.699883,102.100257,0.841998,1.940997,1.875981},
- {0.004000,0.047999,-0.013000,5.700193,-0.699883,102.100257,0.841998,1.940997,1.577981},
- {0.004000,0.047999,-0.006000,5.700193,-0.699883,102.100257,0.924998,1.940997,1.577981},
- {0.008999,0.080999,0.008999,5.700193,-0.699883,102.100257,1.348998,1.940997,1.577981},
- {0.008999,0.044999,-0.009000,-1.499808,-0.699883,102.100257,0.753997,1.940997,1.707981},
- {0.008999,0.044999,-0.009000,-1.499808,-0.699883,102.100257,0.753997,1.940997,1.707981},
- {0.008999,0.044999,-0.009000,-1.499808,-0.699883,102.100257,0.753997,1.940997,1.707981},
- {0.008999,0.044999,-0.009000,-1.499808,-0.699883,102.100257,0.753997,1.940997,1.707981},
- {-0.013999,0.038999,-0.015000,6.300191,-0.699883,102.100257,0.858997,1.940997,1.285981},
- {-0.013999,0.038999,-0.015000,6.300191,-0.699883,102.100257,0.858997,1.940997,1.285981},
- {-0.013999,0.038999,-0.015000,6.300191,-0.699883,102.100257,0.858997,1.940997,1.285981},
- {-0.000999,0.047999,-0.002000,4.200191,-0.699883,102.100257,0.858997,1.940997,1.359981},
- {-0.000999,0.047999,-0.002000,4.200191,-0.699883,102.100257,0.858997,1.940997,1.359981},
- {-0.000999,0.045999,-0.002000,4.200191,-0.699883,102.100257,0.858997,1.940997,1.359981},
- {-0.000999,0.045999,-0.002000,4.200191,-0.699883,102.100257,0.858997,1.940997,1.359981},
- {-0.017999,0.032999,-0.006000,9.900188,-0.699883,102.100257,0.858997,1.940997,1.359981},
- {-0.019999,0.000999,-0.008000,9.900188,-0.699883,102.100257,0.647997,1.940997,1.359981},
- {-0.012999,0.039999,-0.003000,7.100187,-0.699883,99.500244,0.828997,1.940997,1.589981},
- {0.003000,0.031999,0.014999,7.100187,-0.699883,101.700233,1.082997,1.940997,1.589981},
- {0.003000,0.045999,-0.003000,7.100187,-0.699883,101.700233,0.873997,1.940997,1.685981},
- {0.003000,0.045999,-0.000000,3.400186,-0.699883,101.800201,0.873997,1.940997,1.863981},
- {0.003000,0.045999,-0.000000,3.400186,-0.699883,101.800201,0.873997,1.940997,1.863981},
- {-0.014999,0.027999,-0.005000,3.400186,-0.699883,101.800201,0.764998,1.940997,1.582981},
- {0.003000,0.072999,0.008999,3.400186,-0.699883,101.800201,1.168997,1.940997,1.582981},
- {0.004000,0.025999,-0.016000,3.400186,-0.699883,101.800201,0.743997,1.940997,1.582981},
- {0.004000,0.033999,-0.010000,3.400186,-0.699883,101.800201,0.814997,1.940997,1.582981},
- {-0.003999,0.031999,-0.008000,-0.599818,-0.699883,101.800201,0.777997,1.940997,1.771981},
- {-0.003999,0.025999,-0.002000,-0.599818,-0.699883,101.800201,0.707998,1.940997,1.771981},
- {-0.003999,0.049999,-0.007000,-0.599818,-0.699883,101.800201,0.853998,1.940997,1.771981},
- {-0.020999,0.003999,-0.003000,7.500179,-0.699883,106.000114,0.589998,1.940997,1.082981},
- {-0.009999,0.049999,-0.004000,7.500179,-0.699883,100.800125,0.739998,1.940997,1.788981},
- {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
- {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
- {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
- {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
- {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
- {0.001000,0.048999,-0.006000,7.500179,-0.699883,100.800125,0.816998,1.940997,1.624981},
- {0.001000,0.054999,-0.000000,7.500179,-0.699883,100.800125,0.900998,1.940997,1.249981},
- {0.001000,0.054999,-0.000000,7.500179,-0.699883,100.800125,0.900998,1.940997,1.249981},
- {0.001000,0.048999,-0.000000,7.500179,-0.699883,100.800125,0.900998,1.940997,1.249981},
- {0.001000,0.048999,-0.000000,7.500179,-0.699883,100.800125,0.900998,1.940997,1.249981},
- {0.002000,0.045999,-0.001000,7.500179,-0.699883,100.800125,0.849998,1.940997,1.502981},
- {0.002000,0.045999,-0.001000,7.500179,-0.699883,100.800125,0.849998,1.940997,1.502981}
- };
- /*
- *****************************************************************************
- */
- public OnFilterScriptInit()
- {
- /// <summary>
- /// Nesta callback:
- /// - cria todas as TextDraws Globias do servidor;
- /// - imprime aviso de carregamento no console.
- /// </summary>
- /// <summary>
- /// Cria as TextDraws Globais das algemas.
- /// </summary>
- CreateGlobalTDHandcuff();
- /// <summary>
- /// Cria as TextDraws Globais do aviso do método de recuperação
- /// das algemas.
- /// </summary>
- CreateGlobalTDWarningRecovery();
- /// <summary>
- /// Imprime no console confirmação de carregamento do sistema.
- /// </summary>
- print("\n----------------------------------------");
- print(" [B13] Handcuff system loaded");
- print("----------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- /// <summary>
- /// Nesta callback:
- /// - cria todas as TextDraws Privadas do servidor;
- /// - reseta as variáveis do jogador de que envolvem as algemas.
- /// if(!RESET_TO_DISCONNECT)
- /// - identifica se o jogador desconectou algemado, se sim,
- /// algema o mesmo novamente.
- /// </summary>
- /// <summary>
- /// Cria as TextDraws Privadas das algemas.
- /// </summary>
- CreatePrivateTDHandcuff(playerid);
- /// <summary>
- /// Reseta todas as variáveis de controle dos métodos que envolvem
- /// as algemas.
- /// </summary>
- ResetPlayerHandcuff(playerid, true);
- #if !RESET_TO_DISCONNECT
- /// <summary>
- /// Identifica se o nome do jogador consta na variável de controle dos
- /// suspeitos offline de algum outro jogador, caso conste o mesmo é
- /// algemado e alerta o responsável pela imobilização.
- /// </summary>
- new ownerHandcuff, handcuffSlot = -1, i, players, a;
- for(i = 0, players = GetPlayerPoolSize(); i <= players; i++)
- {
- if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
- {
- for(a = 0; a < playerHandcuff[i][E_HANDCUFF_AMOUNT]; a++)
- {
- if(playerHandcuff[i][E_HANDCUFFED_PLAYERS][a] == TARGET_STATE_OFFLINE)
- {
- if(!strcmp(playerTargetOffline[i][a], GetNameOfPlayer(playerid)) && !isnull(playerTargetOffline[i][a]))
- {
- handcuffSlot = a;
- ownerHandcuff = i;
- break;
- }
- }
- }
- }
- }
- if(handcuffSlot != -1)
- {
- playerHandcuff[ownerHandcuff][E_HANDCUFFED_PLAYERS][handcuffSlot] = playerid;
- playerTargetOffline[ownerHandcuff][handcuffSlot] = "";
- cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = true;
- cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = ownerHandcuff;
- SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O jogador %s que você algemou conectou novamente!", GetNameOfPlayer(playerid));
- }
- #endif
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- /// <summary>
- /// Nesta callback:
- /// - identifica se o jogador em questão algemou algum suspeito, se sim
- /// todos que foram algemados pelo mesmo são desalgemados e alertados;
- /// - reseta variável de estado do jogador(vivo/morto);
- /// - finaliza o método de recuperação das algemas do suspeito morto.
- /// if(RESET_TO_DISCONNECT)
- /// - desalgema o player caso esteja e alerta o responsável por sua
- /// imobilização.
- /// if(!RESET_TO_DISCONNECT)
- /// - se estiver algemado reseta as variáveis de controle das
- /// algemas desse jogador e guarda seu nome para algemar quando
- /// conectar novamente.
- /// </summary>
- /// <summary>
- /// Identifica se o jogador realizou alguma imbolização, e se for válido
- /// desalgema todos os suspeitos imobilizados, alertando-os que o responsável
- /// desconcetou. Remove todas as algemas do jogador.
- /// </summary>
- OwnerHandcuffsDisconnected(playerid);
- /// <summary>
- /// Reseta a variável de controle do estado do jogador(vivo/morto);
- /// </summary>
- if(playerDeath[playerid]) playerDeath[playerid] = false;
- /// <summary>
- /// Finaliza por completo o método de recuperação das algemas, assim
- /// impossibilitando do responsável pela imobilização obter suas
- /// algemas de volta.
- /// </summary>
- if(GetPVarInt(playerid, "waitingSpawn"))
- {
- new ownerHandcuff = GetPVarInt(playerid, "ownerMyHandcuff"),
- myIndex = GetPVarInt(playerid, "myIndexRecover");
- HideWarningRecovery(ownerHandcuff);
- if(cuffedPlayer[playerid][E_OWNER_LABEL_INFO] != INVALID_PLAYER_3DTEXT_ID)
- DeletePlayer3DTextLabel(ownerHandcuff, cuffedPlayer[playerid][E_OWNER_LABEL_INFO]);
- cuffedPlayer[playerid][E_OWNER_LABEL_INFO] = INVALID_PLAYER_3DTEXT_ID;
- targetToRecoverHandcuff[ownerHandcuff][myIndex] = INVALID_PLAYER_ID;
- targetToRecoverCurrent[ownerHandcuff] = INVALID_PLAYER_ID;
- DeletePVar(playerid, "waitingSpawn");
- DeletePVar(playerid, "ownerMyHandcuff");
- DeletePVar(playerid, "myIndex");
- }
- #if RESET_TO_DISCONNECT
- /// <summary>
- /// Caso algemado, desalgema o jogador por desconectar e alerta
- /// o responsável pela imobilização. As algemas retornam para o
- /// responsável.
- /// </summary>
- UnshacklePlayer(playerid, REASON_DISCONNECT);
- #else
- /// <summary>
- /// Caso algemado, guarda o nome do jogador para ser algemado
- /// quando conectar novamente e alerta o responsável pela
- /// imobilização. A algema não retorna para o responsável.
- /// A mesma continua em uso, mas pode assim descartá-la jogando
- /// fora suas chaves.
- /// </summary>
- if(cuffedPlayer[playerid][E_PLAYER_HANDCUFFED])
- {
- new ownerHandcuff = cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID];
- if(ownerHandcuff != INVALID_PLAYER_ID)
- {
- new handcuffSlot = GetHandcuffSlotOfTarget(ownerHandcuff, playerid);
- cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = false;
- cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
- if(!~handcuffSlot) return 1;
- playerHandcuff[ownerHandcuff][E_HANDCUFFED_PLAYERS][handcuffSlot] = TARGET_STATE_OFFLINE;
- GetPlayerName(playerid, playerTargetOffline[ownerHandcuff][handcuffSlot], MAX_PLAYER_NAME);
- if(playerHandcuff[ownerHandcuff][E_CURRENT_TARGET] == playerid)
- {
- if(playerHandcuff[ownerHandcuff][E_HANDCUFFING_TARGET])
- {
- HideTDTargetClose(ownerHandcuff);
- SetPVarInt(ownerHandcuff, "finalizeTextActionAnimation_0", true);
- UnfreezePlayer(ownerHandcuff);
- RemovePlayerAttachedObject(ownerHandcuff, INDEX_ATTACH_HANDCUFF);
- SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O jogador %s desconectou enquanto você o algemava, vá em /chaves > 'sobre' para entender melhor.", playerTargetOffline[ownerHandcuff][handcuffSlot]);
- return 1;
- }
- }
- SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O jogador %s que você algemou desconectou, vá em /chaves > 'sobre' para entender melhor.", playerTargetOffline[ownerHandcuff][handcuffSlot]);
- }
- }
- #endif
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- /// <summary>
- /// Nesta callback:
- /// - carrega a livraria de todas animações utilizadas no jogador;
- /// - caso o jogador esteja algemado é chamado método para colocar
- /// suas algemas e alertá-lo;
- /// - caso não esteja algemado, remove se em uso os objetos das
- /// algemas;
- /// - finaliza o método de recuperação das algemas do suspeito
- /// morto;
- /// - reseta variável de estado do jogador(vivo/morto).
- /// </summary>
- /// <summary>
- /// Carrega a livraria de cada animação utilizada. Isso evita problemas
- /// com a aplicação das mesmas pela primeira vez.
- /// </summary>
- LoadPlayerAnimations(playerid);
- /// <summary>
- /// Caso o jogador esteja algemado(o que óbviamente indica que o mesmo
- /// desconectou algemado) algema o mesmo novamente e alerta por quem
- /// foi algemado e o horário da imobilização.
- /// Caso o jogador não esteja, apenas é aplicado uma verificação se
- /// o slot do attach da algema está em uso, se sim é removido.
- /// </summary>
- if(cuffedPlayer[playerid][E_PLAYER_HANDCUFFED])
- {
- SetTimerEx("SetTargetHandcuff", 1000, false, "i", playerid);
- }
- else
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, INDEX_ATTACH_HANDCUFF))
- RemovePlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF);
- }
- /// <summary>
- /// Da fim ao método de recuperação das algemas ao responsável pelo
- /// fato do suspeito ter dado respawn.
- /// </summary>
- if(GetPVarInt(playerid, "waitingSpawn"))
- {
- new ownerHandcuff = GetPVarInt(playerid, "ownerMyHandcuff"),
- myIndex = GetPVarInt(playerid, "myIndexRecover");
- HideWarningRecovery(ownerHandcuff);
- if(cuffedPlayer[playerid][E_OWNER_LABEL_INFO] != INVALID_PLAYER_3DTEXT_ID)
- DeletePlayer3DTextLabel(ownerHandcuff, cuffedPlayer[playerid][E_OWNER_LABEL_INFO]);
- cuffedPlayer[playerid][E_OWNER_LABEL_INFO] = INVALID_PLAYER_3DTEXT_ID;
- targetToRecoverHandcuff[ownerHandcuff][myIndex] = INVALID_PLAYER_ID;
- targetToRecoverCurrent[ownerHandcuff] = INVALID_PLAYER_ID;
- DeletePVar(playerid, "waitingSpawn");
- DeletePVar(playerid, "ownerMyHandcuff");
- DeletePVar(playerid, "myIndexRecover");
- }
- /// <summary>
- /// Reseta a variável de controle do estado do jogador(vivo/morto);
- /// </summary>
- if(playerDeath[playerid]) playerDeath[playerid] = false;
- return 1;
- }
- public OnPlayerDeath(playerid)
- {
- /// <summary>
- /// Nesta callback:
- /// - caso player esteja algemado é chamado método para removar as
- /// algemas e alertar o dono das mesmas;
- /// - reseta variável de estado do jogador(vivo/morto).
- /// </summary>
- /// <summary>
- /// Caso algemado, desalgema o jogador por morrer e alerta o responsável
- /// pela imobilização. É dado início ao método de recuperação das algemas
- /// caso o responsável esteja 40m próximo do suspeito algemado.
- /// </summary>
- UnshacklePlayer(playerid, REASON_DEATH);
- /// <summary>
- /// Reseta a variável de controle do estado do jogador(vivo/morto);
- /// </summary>
- playerDeath[playerid] = true;
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- /// <summary>
- /// Nesta callback:
- /// - caso jogador pressionar a telca KEY_NO e estiver com um
- /// suspeito morto como alvo atual ele recupera suas algemas
- /// e finaliza método de recuperação;
- /// - caso jogador pressionar a telca KEY_NO e estiver com um
- /// suspeito desalgemado como alvo atual é dado início ao
- /// méotodo de algemamento ao mesmo;
- /// - caso jogador pressionar a telca KEY_NO e estiver com um
- /// suspeito que algemou como alvo atual é dado início ao
- /// método de desalgemamento do mesmo.
- /// </summary>
- /// <summary>
- /// Quando teclado KEY_NO:
- /// Se o jogador tiver como alvo um suspeito morto que ainda não
- /// deu respawn, as algemas são recuperadas e é finalizado o método
- /// de recuperação.
- /// Se o jogador tiver como alvo um suspeito que algemou é dado
- /// início ao método de desalgemamento do mesmo.
- /// Se o jogador tiver como alvo um suspeito que não esteja algemado
- /// é dado início ao método de algemamento do mesmo.
- /// </summary>
- if ((newkeys & KEY_NO) && !(oldkeys & KEY_NO))
- {
- if(targetToRecoverCurrent[playerid] != INVALID_PLAYER_ID)
- {
- HideWarningRecovery(playerid);
- new targetRecover = targetToRecoverCurrent[playerid];
- targetToRecoverHandcuff[playerid][GetPVarInt(targetRecover, "myIndexRecover")] = INVALID_PLAYER_ID;
- targetToRecoverCurrent[playerid] = INVALID_PLAYER_ID;
- DeletePVar(targetRecover, "waitingSpawn");
- DeletePVar(targetRecover, "ownerMyHandcuff");
- DeletePVar(targetRecover, "myIndex");
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_2Idle", 4.1, 0, 0, 0, 1, 700, 1);
- SetTimerEx("FinalizeRecoverHandcuff", 700, false, "ii", playerid, targetRecover);
- return 1;
- }
- if(playerHandcuff[playerid][E_HAVE_HANDCUFF] && IsPlayerWithHandcuffsInHands(playerid) &&
- playerHandcuff[playerid][E_HANDCUFF_AMOUNT] > 0 && playerHandcuff[playerid][E_HANDCUFFS_USED] < playerHandcuff[playerid][E_HANDCUFF_AMOUNT])
- {
- if(!playerHandcuff[playerid][E_HANDCUFFING_TARGET] && !playerHandcuff[playerid][E_UNSHACKLING_TARGET])
- {
- new target = playerHandcuff[playerid][E_CURRENT_TARGET];
- if(target != INVALID_PLAYER_ID)
- {
- if(cuffedPlayer[target][E_PLAYER_HANDCUFFED])
- {
- if(cuffedPlayer[target][E_OWNER_HANDCUFF_ID] == playerid) UnshackleTarget(playerid, target);
- else HideTDTargetClose(playerid);
- return 1;
- }
- ToHandcuffTarget(playerid, target);
- }
- }
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- /// <summary>
- /// Nesta callback:
- /// - aplicações do menu 'Suspeitos Algemados' apresentado pelo
- /// método 'ListPlayerHandcuffKeys'.
- /// </summary>
- switch(dialogid)
- {
- /// <summary>
- /// Lista de suspeitos algemados e é apresentado opções para ver
- /// informações da imobilização e até ações sobre as chaves das
- /// algemas desse suspeito. Ha também a opção 'sobre' para
- /// entender melhor como funciona as imbolizações.
- /// </summary>
- case DIALOG_SUSPECTS_CUFFED:
- {
- if(!response)
- {
- DeletePVar(playerid, "DIALOG_TARGET_HANDCUFF_SLOT");
- return 1;
- }
- new handcuffSlot = playerHandcuff[playerid][E_AUX_TARGET_HANDCUFF_SLOT][listitem],
- target,
- targetName[MAX_PLAYER_NAME],
- caption[60];
- target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot];
- if(listitem == GetPVarInt(playerid, "DIALOG_LISTITEM_ABOUT"))
- {
- #if RESET_TO_DISCONNECT
- new string[676];
- strcat(string, "Aqui você poderá ter controle sobre os suspeitos que algemar.\n");
- strcat(string, "Você poderá saber qual o horário em que a imobilização ocorreu\n");
- strcat(string, "e também a quanto tempo o suspeito em questão está algemado.\n\n");
- strcat(string, "Veja alguns atos que podem remover a algema do suspeito:\n\n");
- strcat(string, "{E84F33}Suspeito algemado desconecta{BCD2EE}: O mesmo será desalgemado e a\nalgema utilizada será devolvida.\n\n");
- 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");
- strcat(string, "{E84F33}Você desconecta{BCD2EE}: Todos os suspeitos que você algemou serão\ndesalgemados e perderá todas suas algemas.");
- #else
- new string[1272];
- strcat(string, "Aqui você poderá ter controle sobre os suspeitos que algemar.\n");
- strcat(string, "Você poderá saber qual o horário em que a imobilização ocorreu\n");
- strcat(string, "e também a quanto tempo o suspeito em questão está algemado.\n\n");
- strcat(string, "Caso o suspeito desconecte quando algemado, você ainda ficará\n");
- strcat(string, "com as chaves das algemas dele, e assim que o mesmo conectar\n");
- strcat(string, "novamente, será algemado automaticamente.\n");
- strcat(string, "Contudo, você tem a opção de descartar as chaves, e quando o\n");
- strcat(string, "suspeito conectar novamente não estará mais algemado. Descartar\n");
- strcat(string, "as chaves resultará na perca das algemas utilizadas no mesmo.\n\n");
- strcat(string, "Veja alguns atos que podem manter/remover as algemas do suspeito:\n\n");
- 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");
- 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");
- 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");
- strcat(string, "{E84F33}Você desconecta{BCD2EE}: Todos os suspeitos que você algemou serão\ndesalgemados e perderá todas suas algemas.");
- #endif
- ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Sobre", string, "Voltar", "");
- return 1;
- }
- if(target == TARGET_STATE_OFFLINE)
- {
- #if !RESET_TO_DISCONNECT
- format(targetName, MAX_PLAYER_NAME, playerTargetOffline[playerid][handcuffSlot]);
- #endif
- }
- else
- {
- format(targetName, MAX_PLAYER_NAME, GetNameOfPlayer(target));
- if(!IsPlayerConnected(target))
- return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
- }
- SetPVarInt(playerid, "DIALOG_TARGET_HANDCUFF_SLOT", handcuffSlot);
- format(caption, 60, "Detalhes suspeito [{E84F33}%s{B9C9BF}]", targetName);
- #if RESET_TO_DISCONNECT
- new info[120];
- 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]);
- ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, caption, info, "Voltar", "");
- #else
- ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+1, DIALOG_STYLE_LIST, caption, "Informações\nDescartar chaves", "Selecionar", "Voltar");
- #endif
- }
- /// <summary>
- /// Ver informações da imobilização do suspeito algemado ou descartar
- /// as chavas das algemas do mesmo.
- /// </summary>
- case DIALOG_SUSPECTS_CUFFED+1:
- {
- if(!response)
- {
- DeletePVar(playerid, "DIALOG_TARGET_HANDCUFF_SLOT");
- if(playerHandcuff[playerid][E_HANDCUFFS_USED] > 0) ListPlayerHandcuffKeys(playerid);
- return 1;
- }
- new target,
- targetName[MAX_PLAYER_NAME],
- handcuffSlot = GetPVarInt(playerid, "DIALOG_TARGET_HANDCUFF_SLOT"),
- caption[59],
- info[120];
- target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot];
- if(target == TARGET_STATE_OFFLINE)
- {
- #if !RESET_TO_DISCONNECT
- format(targetName, MAX_PLAYER_NAME, playerTargetOffline[playerid][handcuffSlot]);
- #endif
- }
- else
- {
- if(!IsPlayerConnected(target))
- return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
- format(targetName, MAX_PLAYER_NAME, GetNameOfPlayer(target));
- }
- if(listitem == 0)//Informações da imobilização
- {
- format(caption, 55, "Informações [{E84F33}%s{B9C9BF}]", targetName);
- 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]);
- ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+2, DIALOG_STYLE_MSGBOX, caption, info, "Voltar", "");
- }
- else//Descartar chaves
- {
- format(caption, 59, "Descartar chaves [{E84F33}%s{B9C9BF}]", targetName);
- #if !RESET_TO_DISCONNECT
- if(target != TARGET_STATE_OFFLINE)
- 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", "");
- #else
- if(!IsPlayerConnected(target))
- return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
- #endif
- 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");
- }
- }
- /// <summary>
- /// Informações selecionadas são apresentadas, com botão para voltar
- /// às outras opções.
- /// </summary>
- case DIALOG_SUSPECTS_CUFFED+2:
- {
- new target,
- targetName[MAX_PLAYER_NAME],
- handcuffSlot = GetPVarInt(playerid, "DIALOG_TARGET_HANDCUFF_SLOT"),
- caption[60];
- target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot];
- if(target == TARGET_STATE_OFFLINE)
- {
- #if !RESET_TO_DISCONNECT
- format(targetName, MAX_PLAYER_NAME, playerTargetOffline[playerid][handcuffSlot]);
- #endif
- }
- else
- {
- if(!IsPlayerConnected(target))
- return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
- format(targetName, MAX_PLAYER_NAME, GetNameOfPlayer(target));
- }
- format(caption, 60, "Detalhes suspeito [{E84F33}%s{B9C9BF}]", targetName);
- ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+1, DIALOG_STYLE_LIST, caption, "Informações\nDescartar chaves", "Selecionar", "Voltar");
- }
- /// <summary>
- /// Confirmação para descartar as chaves das algemas de um suspeito
- /// que estiver desconectado.
- /// </summary>
- case DIALOG_SUSPECTS_CUFFED+3:
- {
- new target,
- targetName[MAX_PLAYER_NAME],
- handcuffSlot = GetPVarInt(playerid, "DIALOG_TARGET_HANDCUFF_SLOT"),
- caption[60];
- target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot];
- if(target == TARGET_STATE_OFFLINE)
- {
- #if !RESET_TO_DISCONNECT
- format(targetName, MAX_PLAYER_NAME, playerTargetOffline[playerid][handcuffSlot]);
- #endif
- }
- else
- {
- if(!IsPlayerConnected(target))
- return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, "Erro", "Esse suspeito não está mais algemado!", "Confirmar", "");
- format(targetName, MAX_PLAYER_NAME, GetNameOfPlayer(target));
- }
- if(!response)
- {
- format(caption, 60, "Detalhes suspeito [{E84F33}%s{B9C9BF}]", targetName);
- return ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+1, DIALOG_STYLE_LIST, caption, "Informações\nDescartar chaves", "Selecionar", "Voltar");
- }
- format(caption, 59, "Descartar chaves [{E84F33}%s{B9C9BF}]", targetName);
- if(target != TARGET_STATE_OFFLINE)
- 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", "");
- playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot] = INVALID_PLAYER_ID;
- playerHandcuff[playerid][E_HANDCUFFS_USED]--;
- playerHandcuff[playerid][E_HANDCUFF_AMOUNT]--;
- #if !RESET_TO_DISCONNECT
- playerTargetOffline[playerid][handcuffSlot] = "";
- #endif
- ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
- ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED+4, DIALOG_STYLE_MSGBOX, caption, "As chaves das algemas do suspeito foram descartadas!", "Confirmar", "");
- }
- /// <summary>
- /// Voltar ao ínicio da lista.
- /// </summary>
- case DIALOG_SUSPECTS_CUFFED+4:
- {
- DeletePVar(playerid, "DIALOG_TARGET_HANDCUFF_SLOT");
- if(playerHandcuff[playerid][E_HANDCUFFS_USED] > 0) ListPlayerHandcuffKeys(playerid);
- }
- /// <summary>
- /// Ver jogadores algemados ou responsáveis pelas imobilizações.
- /// </summary>
- case DIALOG_PANEL_HANDCUFFS:
- {
- if(!response) return 1;
- if(!listitem)//Jogadores algemados
- {
- new
- #if !RESET_TO_DISCONNECT
- string[32 + MAX_PLAYERS * 54],
- #else
- string[21 + MAX_PLAYERS * 32],
- #endif
- strAux[55],
- index;
- #if !RESET_TO_DISCONNECT
- format(string, 32, "Jogador algemado\tID\tConectado");
- #else
- format(string, 21, "Jogador algemado\tID");
- #endif
- for(new i; i < MAX_PLAYERS; i++) handcuffPanelId[playerid][i] = INVALID_PLAYER_ID, handcuffPanelName[playerid][i] = "";
- for(new i; i <= GetPlayerPoolSize(); i++)
- {
- if(cuffedPlayer[i][E_PLAYER_HANDCUFFED])
- {
- #if !RESET_TO_DISCONNECT
- format(strAux, 54, "\n%s\t%d\t{158C00}SIM{A9C4E4}", GetNameOfPlayer(i), i);
- #else
- format(strAux, 32, "\n%s\t%d", GetNameOfPlayer(i), i);
- #endif
- strcat(string, strAux);
- handcuffPanelId[playerid][index] = i;
- index++;
- }
- }
- #if !RESET_TO_DISCONNECT
- for(new i, a; i <= GetPlayerPoolSize(); i++)
- {
- if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
- {
- for(a = 0; a < playerHandcuff[i][E_HANDCUFF_AMOUNT]; a++)
- {
- if(playerHandcuff[i][E_HANDCUFFED_PLAYERS][a] == TARGET_STATE_OFFLINE)
- {
- if(!isnull(playerTargetOffline[i][a]))
- {
- format(strAux, 53, "\n%s\t-\t{E84F33}NÃO{A9C4E4}", playerTargetOffline[i][a]);
- strcat(string, strAux);
- format(handcuffPanelName[playerid][index], MAX_PLAYER_NAME, playerTargetOffline[i][a]);
- index++;
- }
- }
- }
- }
- }
- #endif
- if(!index)
- return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Não há nenhum jogador algemado!", "Voltar", "");
- return
- ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+1, DIALOG_STYLE_TABLIST_HEADERS, "Handcuff System - Painel", string, "Detalhes", "Voltar");
- }
- else//Responsáveis pelas imobilizações
- {
- new string[(34 + MAX_HANDCUFFS * 2) + MAX_PLAYERS * 38],
- strAux[38],
- index;
- format(string, 31, "Jogador\tID\tAlgemas utilizadas");
- for(new i; i <= GetPlayerPoolSize(); i++)
- {
- if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
- {
- 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]);
- strcat(string, strAux);
- handcuffPanelId[playerid][index] = i;
- index++;
- }
- }
- if(!index)
- return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Nenhuma imobilização foi realizada ainda!", "Voltar", "");
- ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+2, DIALOG_STYLE_TABLIST_HEADERS, "Handcuff System - Painel", string, "Detalhes", "Voltar");
- }
- }
- /// <summary>
- /// Informações do jogador algemado selecionado.
- /// </summary>
- case DIALOG_PANEL_HANDCUFFS+1:
- {
- if(!response)
- return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS, DIALOG_STYLE_LIST, "Handcuff System - Painel", "Ver jogadores algemados\nVer responsáveis pelas imobilizações", "Selecionar", "Fechar");
- new id = handcuffPanelId[playerid][listitem];
- if(id == INVALID_PLAYER_ID)
- {
- #if !RESET_TO_DISCONNECT
- if(!isnull(handcuffPanelName[playerid][listitem]))
- {
- new ownerHandcuff,
- handcuffSlot;
- for(new i, a; i <= GetPlayerPoolSize(); i++)
- {
- if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
- {
- for(a = 0; a < playerHandcuff[i][E_HANDCUFF_AMOUNT]; a++)
- {
- if(playerHandcuff[i][E_HANDCUFFED_PLAYERS][a] == TARGET_STATE_OFFLINE)
- {
- if(!strcmp(playerTargetOffline[i][a], handcuffPanelName[playerid][listitem]) && !isnull(playerTargetOffline[i][a]))
- {
- handcuffSlot = a;
- ownerHandcuff = i;
- break;
- }
- }
- }
- }
- }
- if(!~handcuffSlot)
- return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Erro ao acessar informações sobre esse jogador.", "Voltar", "");
- new info[184], caption[67];
- 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]);
- format(caption, 67, "Handcuff System - Painel [{E84F33}%s{BCD2EE}]", handcuffPanelName[playerid][listitem]);
- return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, caption, info, "Voltar", "");
- }
- #endif
- return
- ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Erro ao acessar informações sobre esse jogador.", "Voltar", "");
- }
- #if RESET_TO_DISCONNECT
- if(!IsPlayerConnected(id) || !cuffedPlayer[i][E_PLAYER_HANDCUFFED])
- return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Esse jogador não está mais algemado.", "Voltar", "");
- #endif
- new ownerHandcuff,
- handcuffSlot;
- ownerHandcuff = cuffedPlayer[id][E_OWNER_HANDCUFF_ID];
- handcuffSlot = GetHandcuffSlotOfTarget(ownerHandcuff, id);
- if(!~handcuffSlot)
- return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, "Handcuff System - Painel", "Erro ao acessar informações sobre esse jogador.", "Voltar", "");
- new info[184], caption[67];
- 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]);
- format(caption, 67, "Handcuff System - Painel [{E84F33}%s{BCD2EE}]", GetNameOfPlayer(id));
- ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_MSGBOX, caption, info, "Voltar", "");
- }
- /// <summary>
- /// Jogadores algemados pelo jogador responsável selecionado.
- /// </summary>
- case DIALOG_PANEL_HANDCUFFS+2:
- {
- if(!response)
- return ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS, DIALOG_STYLE_LIST, "Handcuff System - Painel", "Ver jogadores algemados\nVer responsáveis pelas imobilizações", "Selecionar", "Fechar");
- new
- #if !RESET_TO_DISCONNECT
- string[32 + MAX_PLAYERS * 52],
- #else
- string[21 + MAX_PLAYERS * 31],
- #endif
- strAux[75],
- bool:found;
- #if !RESET_TO_DISCONNECT
- format(string, 32, "Jogador algemado\tID\tConectado");
- #else
- format(string, 21, "Jogador algemado\tID");
- #endif
- listitem = handcuffPanelId[playerid][listitem];
- for(new i, target; i < playerHandcuff[listitem][E_HANDCUFF_AMOUNT]; i++)
- {
- target = playerHandcuff[listitem][E_HANDCUFFED_PLAYERS][i];
- if(target != INVALID_PLAYER_ID)
- {
- if(target == TARGET_STATE_OFFLINE)
- {
- format(strAux, 51, "\n%s\t-\t{E84F33}NÃO{A9C4E4}", playerTargetOffline[listitem][i]);
- }
- else
- {
- #if !RESET_TO_DISCONNECT
- format(strAux, 52, "\n%s\t%d\t{158C00}SIM{A9C4E4}", GetNameOfPlayer(target), target);
- #else
- format(strAux, 31, "\n%s\t%d", GetNameOfPlayer(target), target);
- #endif
- }
- strcat(string, strAux);
- if(!found) found = true;
- }
- }
- if(!found)
- 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", "");
- format(strAux, 75, "Handcuff System - Painel [{E84F33}%s{BCD2EE} algemou]", GetNameOfPlayer(listitem));
- ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS+3, DIALOG_STYLE_TABLIST_HEADERS, strAux, string, "Voltar", "");
- }
- /// <summary>
- /// Voltar ao ínicio do painel.
- /// </summary>
- case DIALOG_PANEL_HANDCUFFS+3:
- {
- ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS, DIALOG_STYLE_LIST, "Handcuff System - Painel", "Ver jogadores algemados\nVer responsáveis pelas imobilizações", "Selecionar", "Fechar");
- }
- }
- return 1;
- }
- /*
- *****************************************************************************
- */
- /// <summary>
- /// Timer para procurar suspeitos mortos e recuperar as algemas.
- /// O jogador deve estar na parte de trás do corpo do suspeito
- /// para recuperar.
- /// Intervalo: 500ms
- /// </summary>
- /// <param name="playerid">ID do jogador que está a recuperar algum par de algemas.</param>
- /// <returns>Não retorna valores.</returns>
- call:FindTargetToRecoverHandcuff(playerid)
- {
- if(targetToRecoverCurrent[playerid] != INVALID_PLAYER_ID)
- {
- if(ValidateTargetInFront(playerid, targetToRecoverCurrent[playerid], true))
- goto skip_to_end;
- else
- HideWarningRecovery(playerid), targetToRecoverCurrent[playerid] = INVALID_PLAYER_ID;
- }
- new i, bool:found;
- for(i = 0; i < MAX_HANDCUFFS; i++)
- {
- if(targetToRecoverHandcuff[playerid][i] != INVALID_PLAYER_ID)
- {
- found = true;
- break;
- }
- }
- if(!found) return;
- new a, players, Float:pos[3];
- players = GetPlayerPoolSize();
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- for(i = 0; i <= players; i++)
- {
- if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 5.0, pos[0], pos[1], pos[2]) && i != playerid)
- {
- if(playerHandcuff[playerid][E_CURRENT_TARGET] != INVALID_PLAYER_ID || !ValidateTargetInFront(playerid, i, true)) continue;
- for(a = 0; a < MAX_HANDCUFFS; a++)
- {
- if(targetToRecoverHandcuff[playerid][a] == i)
- {
- targetToRecoverCurrent[playerid] = i;
- ShowWarningRecovery(playerid);
- break;
- }
- }
- }
- }
- skip_to_end:
- SetTimerEx("FindTargetToRecoverHandcuff", 500, false, "i", playerid);
- }
- /// <summary>
- /// Timer procura suspeitos para algemar/desalgemar. O jogador
- /// deve estar posicionado na parte de trás do corpo do suspeito
- /// para ser um alvo válido.
- /// Intervalo: 500ms
- /// </summary>
- /// <param name="playerid">ID do jogador que está a procurar por suspeitos.</param>
- /// <returns>Não retorna valores.</returns>
- call:FindPlayerToHandcuff(playerid)
- {
- if(playerHandcuff[playerid][E_HANDCUFFING_TARGET] || playerHandcuff[playerid][E_UNSHACKLING_TARGET]) goto skip_to_end;
- if(!IsPlayerWithHandcuffsInHands(playerid))
- {
- HideTDTargetClose(playerid);
- return;
- }
- if(playerHandcuff[playerid][E_CURRENT_TARGET] != INVALID_PLAYER_ID)
- {
- if(RevalidateCurrentTarget(playerid))
- goto skip_to_end;
- else
- HideTDTargetClose(playerid);
- }
- new i, players, Float:pos[3];
- players = GetPlayerPoolSize();
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- for(i = 0; i <= players; i++)
- {
- if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, 5.0, pos[0], pos[1], pos[2]) && i != playerid)
- {
- if(!ValidateTargetInFront(playerid, i)) continue;
- if(targetToRecoverCurrent[playerid] != INVALID_PLAYER_ID || playerDeath[i]) continue;
- NewTargetFound(playerid, i);
- break;
- }
- }
- skip_to_end:
- SetTimerEx("FindPlayerToHandcuff", 500, false, "i", playerid);
- }
- /// <summary>
- /// Callback que finaliza o método de algemamento de um suspeito.
- /// É dado um intervalo combinado com o final da animação de
- /// imobilização do jogador.
- /// Intervalo: 2600ms.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="target">ID do suspeito.</param>
- /// <param name="auxHandcuffSlot">Variável auxiliar que carrega o valor do slot das algemas do suspeito.</param>
- /// <returns>Não retorna valores.</returns>
- call:FinalizeToHandcuffTarget(playerid, target, auxHandcuffSlot)
- {
- if(!IsPlayerConnected(target) || playerDeath[target]) return;
- ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLE);
- SetPVarInt(playerid, "finalizeTextActionAnimation_0", true);
- UnfreezePlayer(playerid);
- RemovePlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF);
- UnfreezePlayer(target);
- new skinid = GetPlayerSkin(target);
- SetPlayerAttachedObject(target, INDEX_ATTACH_HANDCUFF, 19418, 5, attachHandcuff[skinid][E_ATTACH_OFFSETX], attachHandcuff[skinid][E_ATTACH_OFFSETY],
- attachHandcuff[skinid][E_ATTACH_OFFSETZ], attachHandcuff[skinid][E_ATTACH_ROTX], attachHandcuff[skinid][E_ATTACH_ROTY],
- attachHandcuff[skinid][E_ATTACH_ROTZ], attachHandcuff[skinid][E_ATTACH_SCALEX], attachHandcuff[skinid][E_ATTACH_SCALEY],
- attachHandcuff[skinid][E_ATTACH_SCALEZ], 0, 0);
- SendClientMessageEx(target, COLOR_YELLOW, "<!> {FFFFFF}Você foi algemado por %s!", GetNameOfPlayer(playerid));
- }
- /// <summary>
- /// Callback que finaliza o método de desalgemamento de um suspeito.
- /// É dado um intervalo combinado com o final da animação de
- /// desimobilização do jogador.
- /// Intervalo: 2200ms.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="target">ID do suspeito.</param>
- /// <returns>Não retorna valores.</returns>
- call:FinalizeUnshackleTarget(playerid, target)
- {
- if(!IsPlayerConnected(target) || playerDeath[target]) return;
- ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFF);
- SetPVarInt(playerid, "finalizeTextActionAnimation_1", true);
- UnfreezePlayer(playerid);
- if(!IsPlayerConnected(target)) return;
- cuffedPlayer[target][E_PLAYER_HANDCUFFED] = false;
- cuffedPlayer[target][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
- SetPlayerSpecialAction(target, SPECIAL_ACTION_NONE);
- RemovePlayerAttachedObject(target, INDEX_ATTACH_HANDCUFF);
- UnfreezePlayer(target);
- SendClientMessageEx(target, COLOR_GREEN, "<!> {FFFFFF}Você foi desalgemado por %s.", GetNameOfPlayer(playerid));
- }
- /// <summary>
- /// Callback que finaliza o método de recuperação das algemas.
- /// É dado um intervalo combinado com o final da animação de
- /// apanhar item.
- /// Intervalo: 700ms.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="targetRecover">ID do suspeito ao qual recuperará as algemas.</param>
- /// <returns>Não retorna valores.</returns>
- call:FinalizeRecoverHandcuff(playerid, targetRecover)
- {
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_2Idle", 4.1, 0, 1, 1, 0, 1, 1);
- GivePlayerHandcuff(playerid, 1);
- if(cuffedPlayer[targetRecover][E_OWNER_LABEL_INFO] != INVALID_PLAYER_3DTEXT_ID)
- DeletePlayer3DTextLabel(playerid, cuffedPlayer[targetRecover][E_OWNER_LABEL_INFO]);
- cuffedPlayer[playerid][E_OWNER_LABEL_INFO] = INVALID_PLAYER_3DTEXT_ID;
- }
- /// <summary>
- /// Timer para a animação da TextDraw 'E_TEXT_ACTION', que
- /// informa se está algemando ou desalgemando.
- /// Intervalo: 800ms.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="type_action">Tipo de ação (algemando/desalgemando).</param>
- /// <param name="loop">Variável auxiliar para controle da animação.</param>
- /// <returns>Não retorna valores.</returns>
- call:TextActionAnimation(playerid, type_action, loop)
- {
- if(type_action == TYPE_HANDCUFFING)
- {
- if(!playerHandcuff[playerid][E_HANDCUFFING_TARGET] || GetPVarInt(playerid, "finalizeTextActionAnimation_0"))
- {
- if(playerHandcuff[playerid][E_CURRENT_TARGET] == INVALID_PLAYER_ID)
- HideTDTargetClose(playerid);
- else
- ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLE);
- playerHandcuff[playerid][E_HANDCUFFING_TARGET] = false;
- DeletePVar(playerid, "finalizeTextActionAnimation_0");
- return;
- }
- new text[18 + 4], i;
- for(i = 0; i <= 4; i++)
- {
- text[i] = '\0';
- if(loop >= i) text[i] = 0x2E;
- }
- format(text, sizeof(text), "algemando jogador%s", text);
- PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], text);
- PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
- loop++;
- if(playerHandcuff[playerid][E_HANDCUFFING_TARGET]) SetTimerEx("TextActionAnimation", 800, false, "iii", playerid, type_action, loop);
- }
- else
- {
- if(!playerHandcuff[playerid][E_UNSHACKLING_TARGET] || GetPVarInt(playerid, "finalizeTextActionAnimation_1"))
- {
- if(playerHandcuff[playerid][E_CURRENT_TARGET] == INVALID_PLAYER_ID)
- HideTDTargetClose(playerid);
- else
- ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFF);
- playerHandcuff[playerid][E_UNSHACKLING_TARGET] = false;
- DeletePVar(playerid, "finalizeTextActionAnimation_1");
- return;
- }
- new text[21 + 5], i;
- for(i = 0; i <= 5; i++)
- {
- text[i] = '\0';
- if(loop >= i) text[i] = 0x2E;
- }
- format(text, sizeof(text), "desalgemando jogador%s", text);
- PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], text);
- PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
- loop++;
- if(playerHandcuff[playerid][E_UNSHACKLING_TARGET]) SetTimerEx("TextActionAnimation", 800, false, "iii", playerid, type_action, loop);
- }
- }
- /// <summary>
- /// Timer para a animação da TextDraw 'E_AMOUNT', que informa
- /// o valor de algemadas Utilizadas de algemas Totais (u/t).
- /// Intervalo: 500ms.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="auxControl">Variável auxiliar para controle da animação.</param>
- /// <param name="auxCount">Variável de finalização da animação.</param>
- /// <param name="auxUsed">Valor de algemas utilizadas pelo jogador.</param>
- /// <param name="auxAmount">Valor de algemas totais do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- call:TextAmountAnimation(playerid, bool:auxControl, auxCount, auxUsed, auxAmount)
- {
- if(!IsPlayerWithHandcuffsInHands(playerid))
- {
- DeletePVar(playerid, "enliveningAmount");
- HideTDHandcuff(playerid);
- return;
- }
- if(auxCount >= 8)
- {
- DeletePVar(playerid, "enliveningAmount");
- ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
- return;
- }
- new string[13];
- format(string, 13, "%s%d/%d", (!auxControl) ? ("~r~") : ("~w~"), auxUsed, auxAmount);
- PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_AMOUNT], string);
- PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_AMOUNT]);
- SetTimerEx("TextAmountAnimation", 500, false, "ibiii", playerid, !auxControl, auxCount+1, auxUsed, auxAmount);
- }
- /// <summary>
- /// Callback para algemar jogador, attachando objeto das algemas
- /// em suas mãos e setando SpecialAction. Um alerta é enviado ao
- /// jogador para informar responsável e horário.
- /// Intervalo: 1000ms.
- /// </summary>
- /// <remarks>
- /// Callback importante para evitar bugs não aplicando as funções
- /// diretamente quando o jogador é spawnado.
- /// </remarks>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- call:SetTargetHandcuff(playerid)
- {
- new skinid = GetPlayerSkin(playerid),
- ownerHandcuff = cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID],
- handcuffSlot = GetHandcuffSlotOfTarget(ownerHandcuff, playerid),
- time[36],
- pos;
- SetPlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF, 19418, 5, attachHandcuff[skinid][E_ATTACH_OFFSETX], attachHandcuff[skinid][E_ATTACH_OFFSETY],
- attachHandcuff[skinid][E_ATTACH_OFFSETZ], attachHandcuff[skinid][E_ATTACH_ROTX], attachHandcuff[skinid][E_ATTACH_ROTY],
- attachHandcuff[skinid][E_ATTACH_ROTZ], attachHandcuff[skinid][E_ATTACH_SCALEX], attachHandcuff[skinid][E_ATTACH_SCALEY],
- attachHandcuff[skinid][E_ATTACH_SCALEZ], 0, 0);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
- format(time, 36, playerHandcuff[ownerHandcuff][E_TIME_CUFFED][handcuffSlot]);
- pos = strfind(time, "BCD2EE", true);
- if(pos != -1)
- {
- strdel(time, pos, pos+6);
- strins(time, "FFFFFF", pos);
- SendClientMessageEx(playerid, COLOR_YELLOW, "<!> {FFFFFF}Você foi algemado por %s, as {E84F33}%s{FFFFFF}.", GetNameOfPlayer(ownerHandcuff), time);
- }
- else SendClientMessageEx(playerid, COLOR_YELLOW, "<!> {FFFFFF}Você foi algemado por %s.", GetNameOfPlayer(ownerHandcuff));
- }
- /*
- *****************************************************************************
- */
- /// <summary>
- /// Cria todas as TextDraws Globais das algemas.
- /// </summary>
- /// <returns>Não retorna valores.</returns>
- CreateGlobalTDHandcuff()
- {
- textHandcuffGlobal[E_BACKGROUND][0] = TextDrawCreate(582.176574, 300.833374, "LD_SPAC:white");
- TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][0], 0.000000, 0.000000);
- TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][0], 90.000000, 31.666669);
- TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][0], 1);
- TextDrawColor(textHandcuffGlobal[E_BACKGROUND][0], -1523963137);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][0], 0);
- TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][0], 0);
- TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][0], 255);
- TextDrawFont(textHandcuffGlobal[E_BACKGROUND][0], 4);
- TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][0], 1);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][0], 0);
- textHandcuffGlobal[E_PREVIEW] = TextDrawCreate(589.235229, 288.583282, "");
- TextDrawLetterSize(textHandcuffGlobal[E_PREVIEW], 0.000000, 0.000000);
- TextDrawTextSize(textHandcuffGlobal[E_PREVIEW], 48.117622, 56.166671);
- TextDrawAlignment(textHandcuffGlobal[E_PREVIEW], 1);
- TextDrawColor(textHandcuffGlobal[E_PREVIEW], -1);
- TextDrawSetShadow(textHandcuffGlobal[E_PREVIEW], 0);
- TextDrawSetOutline(textHandcuffGlobal[E_PREVIEW], 0);
- TextDrawBackgroundColor(textHandcuffGlobal[E_PREVIEW], 0);
- TextDrawFont(textHandcuffGlobal[E_PREVIEW], 5);
- TextDrawSetProportional(textHandcuffGlobal[E_PREVIEW], 1);
- TextDrawSetShadow(textHandcuffGlobal[E_PREVIEW], 0);
- TextDrawSetPreviewModel(textHandcuffGlobal[E_PREVIEW], 19418);
- TextDrawSetPreviewRot(textHandcuffGlobal[E_PREVIEW], 0.000000, 0.000000, 0.000000, 0.088365);
- textHandcuffGlobal[E_DIVIDER] = TextDrawCreate(576.529602, 336.416442, "LD_SPAC:white");
- TextDrawLetterSize(textHandcuffGlobal[E_DIVIDER], 0.000000, 0.000000);
- TextDrawTextSize(textHandcuffGlobal[E_DIVIDER], 90.000000, 0.703336);
- TextDrawAlignment(textHandcuffGlobal[E_DIVIDER], 1);
- TextDrawColor(textHandcuffGlobal[E_DIVIDER], -1);
- TextDrawSetShadow(textHandcuffGlobal[E_DIVIDER], 0);
- TextDrawSetOutline(textHandcuffGlobal[E_DIVIDER], 0);
- TextDrawBackgroundColor(textHandcuffGlobal[E_DIVIDER], 255);
- TextDrawFont(textHandcuffGlobal[E_DIVIDER], 4);
- TextDrawSetProportional(textHandcuffGlobal[E_DIVIDER], 1);
- TextDrawSetShadow(textHandcuffGlobal[E_DIVIDER], 0);
- textHandcuffGlobal[E_BACKGROUND][1] = TextDrawCreate(631.176940, 342.833190, "box");
- TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][1], 0.000000, 1.011762);
- TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][1], 720.823730, 0.000000);
- TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][1], 1);
- TextDrawColor(textHandcuffGlobal[E_BACKGROUND][1], -1);
- TextDrawUseBox(textHandcuffGlobal[E_BACKGROUND][1], 1);
- TextDrawBoxColor(textHandcuffGlobal[E_BACKGROUND][1], 100);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][1], 0);
- TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][1], 0);
- TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][1], 255);
- TextDrawFont(textHandcuffGlobal[E_BACKGROUND][1], 1);
- TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][1], 1);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][1], 0);
- textHandcuffGlobal[E_BACKGROUND][2] = TextDrawCreate(629.234619, 341.666656, "hud:radar_gangY");
- TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][2], 0.000000, 0.000000);
- TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][2], 9.999987, 11.249995);
- TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][2], 1);
- TextDrawColor(textHandcuffGlobal[E_BACKGROUND][2], -1);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][2], 0);
- TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][2], 0);
- TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][2], 255);
- TextDrawFont(textHandcuffGlobal[E_BACKGROUND][2], 4);
- TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][2], 1);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][2], 0);
- textHandcuffGlobal[E_BACKGROUND][3] = TextDrawCreate(551.647766, 358.583312, "box");//algemar
- TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][3], 0.000000, 0.917644);
- TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][3], 669.529541, 0.000000);
- TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][3], 1);
- TextDrawColor(textHandcuffGlobal[E_BACKGROUND][3], -1);
- TextDrawUseBox(textHandcuffGlobal[E_BACKGROUND][3], 1);
- TextDrawBoxColor(textHandcuffGlobal[E_BACKGROUND][3], 100);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][3], 0);
- TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][3], 0);
- TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][3], 255);
- TextDrawFont(textHandcuffGlobal[E_BACKGROUND][3], 1);
- TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][3], 1);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][3], 0);
- textHandcuffGlobal[E_BACKGROUND][4] = TextDrawCreate(537.059753, 358.583312, "box");//desalgemar
- TextDrawLetterSize(textHandcuffGlobal[E_BACKGROUND][4], 0.000000, 0.917644);
- TextDrawTextSize(textHandcuffGlobal[E_BACKGROUND][4], 654.941528, 0.000000);
- TextDrawAlignment(textHandcuffGlobal[E_BACKGROUND][4], 1);
- TextDrawColor(textHandcuffGlobal[E_BACKGROUND][4], -1);
- TextDrawUseBox(textHandcuffGlobal[E_BACKGROUND][4], 1);
- TextDrawBoxColor(textHandcuffGlobal[E_BACKGROUND][4], 100);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][4], 0);
- TextDrawSetOutline(textHandcuffGlobal[E_BACKGROUND][4], 0);
- TextDrawBackgroundColor(textHandcuffGlobal[E_BACKGROUND][4], 255);
- TextDrawFont(textHandcuffGlobal[E_BACKGROUND][4], 1);
- TextDrawSetProportional(textHandcuffGlobal[E_BACKGROUND][4], 1);
- TextDrawSetShadow(textHandcuffGlobal[E_BACKGROUND][4], 0);
- }
- /// <summary>
- /// Cria todas as TextDraws Privadas das algemas.
- /// </summary>
- /// <returns>Não retorna valores.</returns>
- CreatePrivateTDHandcuff(playerid)
- {
- textHandcuffPrivate[playerid][E_AMOUNT] = CreatePlayerTextDraw(playerid, 583.176452, 320.666564, "0/5");
- PlayerTextDrawLetterSize(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 0.184468, 1.203333);
- PlayerTextDrawAlignment(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 1);
- PlayerTextDrawColor(playerid, textHandcuffPrivate[playerid][E_AMOUNT], -1);
- PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 1);
- PlayerTextDrawSetOutline(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 0);
- PlayerTextDrawBackgroundColor(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 255);
- PlayerTextDrawFont(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 2);
- PlayerTextDrawSetProportional(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 1);
- PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_AMOUNT], 1);
- textHandcuffPrivate[playerid][E_TARGET_CLOSE] = CreatePlayerTextDraw(playerid, 628.823120, 341.083251, "name(id)");
- PlayerTextDrawLetterSize(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 0.192469, 1.249999);
- PlayerTextDrawAlignment(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 3);
- PlayerTextDrawColor(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], -1);
- PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 1);
- PlayerTextDrawSetOutline(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 0);
- PlayerTextDrawBackgroundColor(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 255);
- PlayerTextDrawFont(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 2);
- PlayerTextDrawSetProportional(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 1);
- PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], 1);
- textHandcuffPrivate[playerid][E_TEXT_ACTION] = CreatePlayerTextDraw(playerid, 637.764526, 357.416656, "tecle_~y~n~w~_para_desalgemar");
- PlayerTextDrawLetterSize(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 0.176941, 1.016664);
- PlayerTextDrawAlignment(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 3);
- PlayerTextDrawColor(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], -1);
- PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 0);
- PlayerTextDrawSetOutline(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 0);
- PlayerTextDrawBackgroundColor(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 255);
- PlayerTextDrawFont(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 2);
- PlayerTextDrawSetProportional(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 1);
- PlayerTextDrawSetShadow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], 0);
- }
- /// <summary>
- /// Cria todas as TextDraws Globais do método de recuperação
- /// das algemas.
- /// </summary>
- /// <returns>Não retorna valores.</returns>
- CreateGlobalTDWarningRecovery()
- {
- textWarningRecovery[0] = TextDrawCreate(485.765655, 281.583282, "box");
- TextDrawLetterSize(textWarningRecovery[0], 0.000000, 0.917644);
- TextDrawTextSize(textWarningRecovery[0], 643.177001, 0.000000);
- TextDrawAlignment(textWarningRecovery[0], 1);
- TextDrawColor(textWarningRecovery[0], -1);
- TextDrawUseBox(textWarningRecovery[0], 1);
- TextDrawBoxColor(textWarningRecovery[0], 100);
- TextDrawSetShadow(textWarningRecovery[0], 0);
- TextDrawSetOutline(textWarningRecovery[0], 0);
- TextDrawBackgroundColor(textWarningRecovery[0], 255);
- TextDrawFont(textWarningRecovery[0], 1);
- TextDrawSetProportional(textWarningRecovery[0], 1);
- TextDrawSetShadow(textWarningRecovery[0], 0);
- textWarningRecovery[1] = TextDrawCreate(637.293945, 280.416717, "tecle ~y~N~w~ para recuperar suas algemas");
- TextDrawLetterSize(textWarningRecovery[1], 0.176941, 1.016664);
- TextDrawAlignment(textWarningRecovery[1], 3);
- TextDrawColor(textWarningRecovery[1], -1);
- TextDrawSetShadow(textWarningRecovery[1], 0);
- TextDrawSetOutline(textWarningRecovery[1], 0);
- TextDrawBackgroundColor(textWarningRecovery[1], 255);
- TextDrawFont(textWarningRecovery[1], 2);
- TextDrawSetProportional(textWarningRecovery[1], 1);
- TextDrawSetShadow(textWarningRecovery[1], 0);
- }
- //----------------------
- /// <summary>
- /// Mostra as TextDraws das algemas a um jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- stock ShowTDHandcuff(playerid)
- {
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][0]);
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_PREVIEW]);
- ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
- }
- /// <summary>
- /// Esconde as TextDraws das algemas a um jogador específico.
- /// </summary>
- /// <remarks>
- /// Também esconde as TextDraws do alvo.
- /// </remarks>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- HideTDHandcuff(playerid)
- {
- HideTDTargetClose(playerid);
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_PREVIEW]);
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_DIVIDER]);
- PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_AMOUNT]);
- PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE]);
- PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
- for(new i = 0; i < 5; i++) TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][i]);
- }
- /// <summary>
- /// Mostra as TextDraws do alvo a um jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- ShowTDTargetClose(playerid)
- {
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_DIVIDER]);
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][1]);
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][2]);
- new target;
- if(IsAValidCurrentTarget(playerid, target))
- {
- if(playerHandcuff[playerid][E_CURRENT_TARGET] == INVALID_PLAYER_ID)
- {
- HideTDTargetClose(playerid);
- return;
- }
- new target_info[MAX_PLAYER_NAME + 6];
- format(target_info, sizeof(target_info), "%s(%d)", GetNameOfPlayer(target), target);
- PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE], target_info);
- PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE]);
- if(cuffedPlayer[target][E_PLAYER_HANDCUFFED])
- {
- if(cuffedPlayer[target][E_OWNER_HANDCUFF_ID] == playerid) ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLE);
- else HideTDTargetClose(playerid);
- }
- else ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFF);
- }
- }
- /// <summary>
- /// Esconde as TextDraws do alvo a um jogador específico.
- /// Reseta a variável de controle do alvo atual.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- HideTDTargetClose(playerid)
- {
- playerHandcuff[playerid][E_CURRENT_TARGET] = INVALID_PLAYER_ID;
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_DIVIDER]);
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][1]);
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][2]);
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
- PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_TARGET_CLOSE]);
- PlayerTextDrawHide(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
- }
- /// <summary>
- /// Revalida se o alvo atual de um jogador específico
- /// está nas condições necessárias. Isso envolve:
- /// conectado, posicionado certo e vivo.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>True se for um alvo validado, False se não.</returns>
- RevalidateCurrentTarget(playerid)
- {
- new target, bool:isValid;
- isValid = bool:IsAValidCurrentTarget(playerid, target);
- if(isValid)
- {
- if(cuffedPlayer[target][E_PLAYER_HANDCUFFED])
- {
- if(cuffedPlayer[target][E_OWNER_HANDCUFF_ID] == playerid) ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLE);
- else isValid = false;
- }
- else ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFF);
- }
- return isValid;
- }
- //---------------------------
- /// <summary>
- /// Mostra as TextDraws de aviso de recuperação das algemas a
- /// um jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- ShowWarningRecovery(playerid)
- {
- TextDrawShowForPlayer(playerid, textWarningRecovery[0]);
- TextDrawShowForPlayer(playerid, textWarningRecovery[1]);
- }
- /// <summary>
- /// Esconde as TextDraws de aviso de recuperação das algemas
- /// de um jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- HideWarningRecovery(playerid)
- {
- TextDrawHideForPlayer(playerid, textWarningRecovery[0]);
- TextDrawHideForPlayer(playerid, textWarningRecovery[1]);
- }
- //----------------------------------------------
- /// <summary>
- /// Reseta todas as variáveis de controle das algemas.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="allVariables">True para resetar as variáveis de controle do jogador algemado.</param>
- /// <returns>Não retorna valores.</returns>
- ResetPlayerHandcuff(playerid, bool:allVariables)
- {
- for(new i = 0; i < MAX_HANDCUFFS; i++)
- {
- playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i] = INVALID_PLAYER_ID,
- targetToRecoverHandcuff[playerid][i] = INVALID_PLAYER_ID;
- #if !RESET_TO_DISCONNECT
- playerTargetOffline[playerid][i] = "";
- #endif
- }
- playerHandcuff[playerid][E_HAVE_HANDCUFF] = false;
- playerHandcuff[playerid][E_HANDCUFF_IN_HANDS] = false;
- playerHandcuff[playerid][E_HANDCUFFING_TARGET] = false;
- playerHandcuff[playerid][E_UNSHACKLING_TARGET] = false;
- playerHandcuff[playerid][E_HANDCUFF_AMOUNT] = 0;
- playerHandcuff[playerid][E_HANDCUFFS_USED] = 0;
- playerHandcuff[playerid][E_CURRENT_TARGET] = INVALID_PLAYER_ID;
- targetToRecoverCurrent[playerid] = INVALID_PLAYER_ID;
- if(allVariables)
- {
- cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = false;
- cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
- cuffedPlayer[playerid][E_OWNER_LABEL_INFO] = INVALID_PLAYER_3DTEXT_ID;
- }
- }
- //--------------------
- /// <summary>
- /// Pega as algemas guardadas para um jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- stock PickHandcuff(playerid)
- {
- playerHandcuff[playerid][E_HANDCUFF_IN_HANDS] = true;
- ShowTDHandcuff(playerid);
- FindPlayerToHandcuff(playerid);
- }
- /// <summary>
- /// Guarda as algemas em uso para um jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- stock SaveHandcuff(playerid)
- {
- playerHandcuff[playerid][E_HANDCUFF_IN_HANDS] = false;
- HideTDHandcuff(playerid);
- }
- //---------------------------------------
- GetHandcuffSlotOfTarget(playerid, target)
- {
- for(new i; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
- {
- if(playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i] == target)
- {
- return i;
- }
- }
- return -1;
- }
- //----------------------------------
- /// <summary>
- /// Identifica de um jogador específico desconectou enquanto
- /// possuia um ou mais suspeitos algemados. Se for válido,
- /// todos os suspeitos serão desalgemados e alertados.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>True se bem sucedido, False se: não possuir algemas; não ter algemado nenhum suspeito.</returns>
- OwnerHandcuffsDisconnected(playerid)
- {
- if(!(playerHandcuff[playerid][E_HAVE_HANDCUFF] && playerHandcuff[playerid][E_HANDCUFFS_USED] > 0)) return false;
- for(new i; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
- {
- if(IsPlayerConnected(playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i]))
- {
- new target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i];
- if(!cuffedPlayer[target][E_PLAYER_HANDCUFFED]) continue;
- cuffedPlayer[target][E_PLAYER_HANDCUFFED] = false;
- cuffedPlayer[target][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
- SetPlayerSpecialAction(target, SPECIAL_ACTION_NONE);
- UnfreezePlayer(target);
- RemovePlayerAttachedObject(target, INDEX_ATTACH_HANDCUFF);
- 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));
- }
- }
- ResetPlayerHandcuff(playerid, false);
- return true;
- }
- //-------------------------------
- /// <summary>
- /// Desalgema um alvo específico algemado pelo jogador.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="target">ID do alvo.</param>
- /// <returns>True se bem sucedido, False se: não estiver algemas em mãos; não ter algemado nenhum suspeito.</returns>
- UnshackleTarget(playerid, target)
- {
- if(!IsPlayerWithHandcuffsInHands(playerid) || playerHandcuff[playerid][E_HANDCUFFS_USED] < 1) return false;
- new handcuffSlot = GetHandcuffSlotOfTarget(playerid, target);
- if(!~handcuffSlot) return false;
- playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot] = INVALID_PLAYER_ID;
- playerHandcuff[playerid][E_HANDCUFFS_USED]--;
- ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
- FreezePlayer(target);
- ApplyAnimation(playerid, #GANGS, #prtial_hndshk_biz_01, 4.1, 0, 1, 1, 0, 0, 1);
- playerHandcuff[playerid][E_UNSHACKLING_TARGET] = true;
- ChangeInformationTDHandcuff(playerid, TYPE_UNSHACKLING);
- SetTimerEx("FinalizeUnshackleTarget", 2200, false, "ii", playerid, target);
- return true;
- }
- /// <summary>
- /// Algema um alvo específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="target">ID do alvo.</param>
- /// <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>
- ToHandcuffTarget(playerid, target)
- {
- 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;
- new handcuffSlot = -1, time[3], date[2];
- for(new i = 0; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
- {
- if(playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i] == INVALID_PLAYER_ID)
- {
- handcuffSlot = i;
- break;
- }
- }
- if(!~handcuffSlot) return false;
- playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][handcuffSlot] = target;
- playerHandcuff[playerid][E_HANDCUFFS_USED]++;
- playerHandcuff[playerid][E_TIMESTAMP_CUFFED][handcuffSlot] = gettime();
- gettime(time[0], time[1], time[2]);
- getdate(date[0], date[1], time[2]);
- 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]);
- cuffedPlayer[target][E_PLAYER_HANDCUFFED] = true;
- cuffedPlayer[target][E_OWNER_HANDCUFF_ID] = playerid;
- ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
- SetPlayerSpecialAction(target, SPECIAL_ACTION_CUFFED);
- FreezePlayer(target);
- 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);
- ApplyAnimation(playerid, #INT_HOUSE, #wash_up, 4.1, 0, 1, 1, 0, 0, 1);
- playerHandcuff[playerid][E_HANDCUFFING_TARGET] = true;
- ChangeInformationTDHandcuff(playerid, TYPE_HANDCUFFING);
- SetTimerEx("FinalizeToHandcuffTarget", 2600, false, "iii", playerid, target, handcuffSlot);
- return true;
- }
- /// <summary>
- /// Valida se um jogador específico está posicionado corretamente
- /// atrás de um alvo específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="target">ID do alvo.</param>
- /// <param name="recoverValidate">True se a validação for para o método de recuperação das algemas, False se não.</param>
- /// <returns>True for válido, False se não.</returns>
- ValidateTargetInFront(playerid, target, bool:recoverValidate = false)
- {
- new Float:pos[3], Float:angle[2], Float:resultPos[2];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- GetPlayerFacingAngle(playerid, angle[0]);
- if(IsPlayerInRangeOfPoint(target, 1.0, pos[0], pos[1], pos[2]))
- {
- if(cuffedPlayer[target][E_PLAYER_HANDCUFFED] && cuffedPlayer[target][E_OWNER_HANDCUFF_ID] != playerid) return false;
- resultPos[0] = pos[0] + (GetDistanceBetweenPlayers(playerid, target) * floatsin(-angle[0], degrees));
- resultPos[1] = pos[1] + (GetDistanceBetweenPlayers(playerid, target) * floatcos(-angle[0], degrees));
- if(IsPlayerInRangeOfPoint(target, 0.6, resultPos[0], resultPos[1], pos[2]))
- {
- if(recoverValidate) return true;
- GetPlayerFacingAngle(target, angle[1]);
- return (angle[1]-25 < angle[0] < angle[1]+30);
- }
- }
- return false;
- }
- //------------------------------
- /// <summary>
- /// Seta o novo alvo na variável de controle de um jogador
- /// específico. Mostra as TextDraws do alvo.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="target">ID do alvo.</param>
- /// <returns>Não retorna valores.</returns>
- NewTargetFound(playerid, target)
- {
- playerHandcuff[playerid][E_CURRENT_TARGET] = target;
- ShowTDTargetClose(playerid);
- }
- /// <summary>
- /// Valida se o alvo atual é um alvo válido. Isso envolve:
- /// conectado, posicionado corretamente e vivo.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="varAux">Variável de referência que adere ao ID do alvo.</param>
- /// <returns>Não retorna valores.</returns>
- IsAValidCurrentTarget(playerid, &varAux)
- {
- new target = playerHandcuff[playerid][E_CURRENT_TARGET];
- varAux = target;
- return !(target == INVALID_PLAYER_ID || !IsPlayerConnected(target) || !ValidateTargetInFront(playerid, target) || playerDeath[target]);
- }
- //----------------------------------------------------
- /// <summary>
- /// Altera informações na TextDraw de algemas de um jogador
- /// específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="informationType">Tipo da informação: TYPE_HANDCUFF|TYPE_UNSHACKLE|TYPE_HANDCUFFING|TYPE_UNSHACKLING|TYPE_AMOUNT.</param>
- /// <returns>Não retorna valores específicos.</returns>
- ChangeInformationTDHandcuff(playerid, informationType)
- {
- if(!IsPlayerWithHandcuffsInHands(playerid))
- {
- HideTDHandcuff(playerid);
- return;
- }
- switch(informationType)
- {
- case TYPE_HANDCUFF:
- {
- PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], "tecle_~y~n~w~_para_algemar");
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
- }
- case TYPE_UNSHACKLE:
- {
- PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], "tecle_~y~n~w~_para_desalgemar");
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
- }
- case TYPE_HANDCUFFING:
- {
- PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], "algemando jogador");
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
- SetTimerEx("TextActionAnimation", 500, false, "iii", playerid, TYPE_HANDCUFFING, 0);
- }
- case TYPE_UNSHACKLING:
- {
- PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION], "desalgemando jogador");
- TextDrawHideForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][3]);
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][4]);
- SetTimerEx("TextActionAnimation", 500, false, "iii", playerid, TYPE_UNSHACKLING, 0);
- }
- case TYPE_AMOUNT:
- {
- if(GetPVarInt(playerid, "enliveningAmount")) return;
- if(playerHandcuff[playerid][E_HANDCUFF_AMOUNT] < 1)
- {
- SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não possui mais algemas!");
- HideTDTargetClose(playerid);
- return;
- }
- new amountText[6];
- format(amountText, sizeof(amountText), "%d/%d", playerHandcuff[playerid][E_HANDCUFFS_USED], playerHandcuff[playerid][E_HANDCUFF_AMOUNT]);
- PlayerTextDrawSetString(playerid, textHandcuffPrivate[playerid][E_AMOUNT], amountText);
- PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_AMOUNT]);
- }
- }
- if(informationType != TYPE_AMOUNT)
- {
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_DIVIDER]);
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][1]);
- TextDrawShowForPlayer(playerid, textHandcuffGlobal[E_BACKGROUND][2]);
- PlayerTextDrawShow(playerid, textHandcuffPrivate[playerid][E_TEXT_ACTION]);
- }
- }
- /*
- *****************************************************************************
- */
- /// <summary>
- /// Obtém a distância entre 2 jogadores.
- /// </summary>
- /// <param name="playerid">ID do jogador 1.</param>
- /// <param name="playerid">ID do jogador 2.</param>
- /// <returns>A distância entre ambos em número flutuante.</returns>
- GetDistanceBetweenPlayers(playerid,playerid2)//author: Unknown
- {
- new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
- new Float:tmpdis;
- GetPlayerPos(playerid,x1,y1,z1);
- GetPlayerPos(playerid2,x2,y2,z2);
- tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
- return floatround(tmpdis);
- }
- /// <summary>
- /// Converte a diferença entre 2 Unix timestamps em unidade
- /// de tempo.
- /// </summary>
- /// <param name="timestamp">Timestamp 1 a se comparar.</param>
- /// <param name="compare">Timestamp 2 a se comparar. Null ou -1 para obter o timestamp atual.</param>
- /// <returns>A diferença de ambos timestamp em unidade de tempo.</returns>
- stock timec(timestamp, compare = -1)//author: Blacklite | modification: Bruno13
- {
- if (compare == -1) {
- compare = gettime();
- }
- new
- n,
- Float:d = (timestamp > compare) ? timestamp - compare : compare - timestamp,
- returnstr[12];
- if(d < 60)
- {
- format(returnstr, sizeof(returnstr), "%d segundo%s", floatround(d, floatround_floor), (d == 1) ? ("") : ("s"));
- return returnstr;
- }
- else if(d < 3600) // 3600 = 1 hour
- {
- n = floatround(floatdiv(d, 60.0), floatround_floor);
- format(returnstr, sizeof(returnstr), "minuto");
- }
- else if(d < 86400)// 86400 = 1 day
- {
- n = floatround(floatdiv(d, 3600.0), floatround_floor);
- format(returnstr, sizeof(returnstr), "hora");
- }
- else if(d < 2592000) // 2592000 = 1 month
- {
- n = floatround(floatdiv(d, 86400.0), floatround_floor);
- format(returnstr, sizeof(returnstr), "dia");
- }
- else if(d < 31536000) // 31536000 = 1 year
- {
- n = floatround(floatdiv(d, 2592000.0), floatround_floor);
- format(returnstr, sizeof(returnstr), "mês");
- }
- else
- {
- n = floatround(floatdiv(d, 31536000.0), floatround_floor);
- format(returnstr, sizeof(returnstr), "ano");
- }
- if(n == 1)
- {
- format(returnstr, sizeof(returnstr), "1 %s", returnstr);
- }
- else
- {
- if(2592000 < d < 31536000) format(returnstr, sizeof(returnstr), "%d meses", n);
- else format(returnstr, sizeof(returnstr), "%d %ss", n, returnstr);
- }
- return returnstr;
- }
- /// <summary>
- /// Congela jogador específico sem congelar a tela, apenas
- /// a skin.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- FreezePlayer(playerid)//author: Bruno13
- {
- ApplyAnimation(playerid, "BD_FIRE", "BD_Fire1", 4.1, 1, 1, 1, 0, 0, 1);
- }
- /// <summary>
- /// Descongela jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- UnfreezePlayer(playerid)//author: Bruno13
- {
- ApplyAnimation(playerid, "BD_FIRE", "BD_Fire1", 4.1, 0, 1, 1, 1, 1, 1);
- }
- /// <summary>
- /// Carrega a livraria de cada animação utilizada. Evita
- /// problemas com a aplicação das mesmas pela primeira vez.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores.</returns>
- LoadPlayerAnimations(playerid)//author: Bruno13
- {
- ApplyAnimation(playerid, "GANGS", "null", 0.0, 0, 0, 0, 0, 0);
- ApplyAnimation(playerid, "INT_HOUSE", "null", 0.0, 0, 0, 0, 0, 0);
- ApplyAnimation(playerid, "BD_FIRE", "null", 0.0, 0, 0, 0, 0, 0);
- ApplyAnimation(playerid, "BOMBER", "null", 0.0, 0, 0, 0, 0, 0);
- }
- /// <summary>
- /// Obtém e retorna o nome de um jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Nome do jogador. 0 se não estiver conectado.</returns>
- GetNameOfPlayer(playerid)//author: Bruno13
- {
- new name[MAX_PLAYER_NAME];
- return (GetPlayerName(playerid, name, MAX_PLAYER_NAME)), name;
- }
- /*
- *****************************************************************************
- */
- /// <summary>
- /// Da uma quantidade específica de algemas a um jogador
- /// específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="amount">Quantidade de algemas.</param>
- /// <returns>True se bem sucedido, False se já atingiu o máximo de algemas possíveis.</returns>
- stock GivePlayerHandcuff(playerid, amount)
- {
- if(playerHandcuff[playerid][E_HAVE_HANDCUFF] && playerHandcuff[playerid][E_HANDCUFFS_USED] >= playerHandcuff[playerid][E_HANDCUFF_AMOUNT]) return false;
- playerHandcuff[playerid][E_HAVE_HANDCUFF] = true;
- playerHandcuff[playerid][E_HANDCUFF_AMOUNT] += amount;
- if(playerHandcuff[playerid][E_HANDCUFF_AMOUNT] > MAX_HANDCUFFS) playerHandcuff[playerid][E_HANDCUFF_AMOUNT] = MAX_HANDCUFFS;
- ChangeInformationTDHandcuff(playerid, TYPE_AMOUNT);
- return true;
- }
- /// <summary>
- /// Remove todas as algemas de um jogador específico. Pode-se
- /// desalgemar todos suspeitos que o jogador imobilizou.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="unshackleTargets">True para desalgemar todos os suspeitos.</param>
- /// <returns>True se bem sucedido, False se o jogador: não possuir algemas; estiver algemando/desalgemando algum suspeito.</returns>
- stock RemovePlayerHandcuff(playerid, bool:unshackleTargets)
- {
- if(!playerHandcuff[playerid][E_HAVE_HANDCUFF] || playerHandcuff[playerid][E_HANDCUFFING_TARGET] || playerHandcuff[playerid][E_UNSHACKLING_TARGET]) return false;
- if(unshackleTargets)
- {
- new i, target;
- for(i = 0; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
- {
- target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i];
- if(IsPlayerConnected(target) && cuffedPlayer[target][E_PLAYER_HANDCUFFED])
- {
- cuffedPlayer[target][E_PLAYER_HANDCUFFED] = false;
- cuffedPlayer[target][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
- SetPlayerSpecialAction(target, SPECIAL_ACTION_NONE);
- UnfreezePlayer(target);
- RemovePlayerAttachedObject(target, INDEX_ATTACH_HANDCUFF);
- SendClientMessageEx(target, COLOR_GREEN, "<!> {FFFFFF}Você foi desalgemado, pois %s não possui mais a posse das chaves das algemas.", GetNameOfPlayer(playerid));
- break;
- }
- }
- }
- ResetPlayerHandcuff(playerid, false);
- return true;
- }
- /// <summary>
- /// Obtem o número de algemas de um jogador específico possui.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Valor da quantidade de algemas.</returns>
- stock GetPlayerHandcuffAmmo(playerid) return playerHandcuff[playerid][E_HANDCUFF_AMOUNT];
- /// <summary>
- /// Obtem o número de algemas usadas por um jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Valor da quantidade de algemas usadas.</returns>
- stock GetPlayerHandcuffUsed(playerid) return playerHandcuff[playerid][E_HANDCUFF_USED];
- //-----------------------------
- /// <summary>
- /// Pega/guarda as algemas de um jogador específico.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>True se bem sucedido, False se: não possuir algemas; estiver sem algemas; estiver algemando/desalgemando.</returns>
- stock PlayerHandcuffs(playerid)
- {
- if(!playerHandcuff[playerid][E_HAVE_HANDCUFF] || playerHandcuff[playerid][E_HANDCUFF_AMOUNT] < 1)
- return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não possui algemas!");
- if(playerHandcuff[playerid][E_HANDCUFFING_TARGET] || playerHandcuff[playerid][E_UNSHACKLING_TARGET])
- return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não pode guardar suas algemas enquanto as utiliza!");
- if(IsPlayerWithHandcuffsInHands(playerid))
- SaveHandcuff(playerid);
- else
- PickHandcuff(playerid);
- return true;
- }
- /// <summary>
- /// Valida se um jogador específico está com as algemas em
- /// mãos.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>True se estiver, False se não.</returns>
- stock IsPlayerWithHandcuffsInHands(playerid) return playerHandcuff[playerid][E_HANDCUFF_IN_HANDS];
- //----------------------------------------------------
- /// <summary>
- /// Desalgema um jogador específico mediante a razão.
- /// </summary>
- /// <param name="playerid">ID do jogador.</param>
- /// <param name="reason">Razão do desalgemamento.
- /// Razões: REASON_DISCONNECT/REASON_DEATH.</param>
- /// <returns>True se bem sucedido, False se não estiver algemado.</returns>
- stock UnshacklePlayer(playerid, reason, auxAdmin = -1)
- {
- if(!cuffedPlayer[playerid][E_PLAYER_HANDCUFFED]) return false;
- new ownerHandcuff;
- ownerHandcuff = cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID];
- if(reason == REASON_DEATH && playerHandcuff[ownerHandcuff][E_UNSHACKLING_TARGET])
- {
- if(playerHandcuff[ownerHandcuff][E_CURRENT_TARGET] == playerid)
- {
- HideTDTargetClose(ownerHandcuff);
- SetPVarInt(ownerHandcuff, "finalizeTextActionAnimation_1", true);
- UnfreezePlayer(ownerHandcuff);
- cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = false;
- cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- UnfreezePlayer(playerid);
- RemovePlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF);
- SendClientMessageEx(playerid, COLOR_GREEN, "<!> {FFFFFF}Você foi desalgemado por %s.", GetNameOfPlayer(ownerHandcuff));
- return true;
- }
- }
- new handcuffSlot = GetHandcuffSlotOfTarget(ownerHandcuff, playerid);
- if(!~handcuffSlot)
- playerHandcuff[ownerHandcuff][E_HANDCUFFED_PLAYERS][handcuffSlot] = INVALID_PLAYER_ID;
- cuffedPlayer[playerid][E_PLAYER_HANDCUFFED] = false;
- cuffedPlayer[playerid][E_OWNER_HANDCUFF_ID] = INVALID_PLAYER_ID;
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- RemovePlayerAttachedObject(playerid, INDEX_ATTACH_HANDCUFF);
- //---------------------------------------------
- SetPVarInt(ownerHandcuff, "enliveningAmount", true);
- TextAmountAnimation(ownerHandcuff, false, 0, playerHandcuff[ownerHandcuff][E_HANDCUFFS_USED], playerHandcuff[ownerHandcuff][E_HANDCUFF_AMOUNT]);
- playerHandcuff[ownerHandcuff][E_HANDCUFFS_USED]--;
- if(reason == REASON_ADMIN)
- {
- SendClientMessageEx(playerid, COLOR_YELLOW, "<!> {FFFFFF}Você foi desalgemado pelo administrador %s!", GetNameOfPlayer(auxAdmin));
- SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O administrador %s desalgemou %s. As algemas retornaram para você.", GetNameOfPlayer(auxAdmin), GetNameOfPlayer(playerid));
- return true;
- }
- if(reason == REASON_DEATH)
- {
- if(playerHandcuff[ownerHandcuff][E_CURRENT_TARGET] == playerid && playerHandcuff[ownerHandcuff][E_HANDCUFFING_TARGET])
- {
- HideTDTargetClose(ownerHandcuff);
- SetPVarInt(ownerHandcuff, "finalizeTextActionAnimation_0", true);
- UnfreezePlayer(ownerHandcuff);
- RemovePlayerAttachedObject(ownerHandcuff, INDEX_ATTACH_HANDCUFF);
- SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O jogador %s morreu enquanto você o algemava, as algemas retornaram para você!", GetNameOfPlayer(playerid));
- }
- else
- {
- playerHandcuff[ownerHandcuff][E_HANDCUFF_AMOUNT]--;
- new Float:pos[3];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- if(IsPlayerInRangeOfPoint(ownerHandcuff, 40.0, pos[0], pos[1], pos[2]))
- {
- 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);
- new indexFree = -1;
- for(new i; i < MAX_HANDCUFFS; i++)
- {
- if(targetToRecoverHandcuff[ownerHandcuff][i] == INVALID_PLAYER_ID)
- {
- indexFree = i;
- break;
- }
- }
- if(!~indexFree)
- goto removeHandcuff;
- targetToRecoverHandcuff[ownerHandcuff][indexFree] = playerid;
- SetPVarInt(playerid, "ownerMyHandcuff", ownerHandcuff);
- SetPVarInt(playerid, "waitingSpawn", true);
- FindTargetToRecoverHandcuff(ownerHandcuff);
- 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));
- return true;
- }
- removeHandcuff:
- SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}%s morreu, as algemas utilizadas foram perdidas!", GetNameOfPlayer(playerid));
- }
- }
- else
- {
- SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}%s desconectou, as algemas utilizadas foram devolvidas!", GetNameOfPlayer(playerid));
- }
- return true;
- }
- /// <summary>
- /// Desalgema um jogador específico offline.
- /// </summary>
- /// <param name="playerid">ID do jogador responsável pelo desalgemamento(administrador).</param>
- /// <param name="playerName">Nome do jogador.</param>
- /// <returns>True se bem sucedido, False se o jogador não estiver algemado.</returns>
- stock UnshacklePlayerOffline(playerid, playerName[])
- {
- new ownerHandcuff,
- handcuffSlot = -1,
- players,
- i,
- a;
- for(i = 0, players = GetPlayerPoolSize(); i <= players; i++)
- {
- if(playerHandcuff[i][E_HAVE_HANDCUFF] && playerHandcuff[i][E_HANDCUFFS_USED] > 0)
- {
- for(a = 0; a < playerHandcuff[i][E_HANDCUFF_AMOUNT]; a++)
- {
- if(playerHandcuff[i][E_HANDCUFFED_PLAYERS][a] == TARGET_STATE_OFFLINE)
- {
- if(!strcmp(playerTargetOffline[i][a], playerName) && !isnull(playerTargetOffline[i][a]))
- {
- handcuffSlot = a;
- ownerHandcuff = i;
- break;
- }
- }
- }
- }
- }
- if(!~handcuffSlot) return false;
- SetPVarInt(ownerHandcuff, "enliveningAmount", true);
- TextAmountAnimation(ownerHandcuff, false, 0, playerHandcuff[ownerHandcuff][E_HANDCUFFS_USED], playerHandcuff[ownerHandcuff][E_HANDCUFF_AMOUNT]);
- playerHandcuff[ownerHandcuff][E_HANDCUFFED_PLAYERS][handcuffSlot] = INVALID_PLAYER_ID;
- playerHandcuff[ownerHandcuff][E_HANDCUFFS_USED]--;
- playerTargetOffline[ownerHandcuff][handcuffSlot] = "";
- SendClientMessageEx(ownerHandcuff, COLOR_YELLOW, "<!> {FFFFFF}O administrador %s desalgemou %s. As algemas retornaram para você.", GetNameOfPlayer(playerid), playerName);
- return true;
- }
- //------------------------------------
- /// <summary>
- /// Lista em uma caixa de diálogo o nome e o ID de todos os
- /// suspeitos que um jogador específico algemou. Também é
- /// acompanhado um item com a opção 'sobre'.
- /// </summary>
- /// <remarks>
- /// Envia mensagens de erro se ocorrer.
- /// </remarks>
- /// <param name="playerid">ID do jogador.</param>
- /// <returns>Não retorna valores específicos.</returns>
- stock ListPlayerHandcuffKeys(playerid)
- {
- if(!playerHandcuff[playerid][E_HAVE_HANDCUFF])
- return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não possui algemas!");
- if(playerHandcuff[playerid][E_HANDCUFFS_USED] < 1)
- return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Você não algemou nenhum suspeito!");
- new
- #if !RESET_TO_DISCONNECT
- string[26 + 55 * MAX_HANDCUFFS + 34],
- #else
- string[18 + 31 * MAX_HANDCUFFS + 34],
- #endif
- strAux[55],
- a,
- target;
- #if !RESET_TO_DISCONNECT
- format(string, 26, "Jogador (nome/id)\tOnline");
- #else
- format(string, 18, "Jogador (nome/id)");
- #endif
- for(new i; i < playerHandcuff[playerid][E_HANDCUFF_AMOUNT]; i++)
- {
- target = playerHandcuff[playerid][E_HANDCUFFED_PLAYERS][i];
- if(target != INVALID_PLAYER_ID)
- {
- #if !RESET_TO_DISCONNECT
- if(target == TARGET_STATE_OFFLINE)
- {
- format(strAux, 54, "\n%s[-]\t{E84F33}Não{A9C4E4}", playerTargetOffline[playerid][i]);
- }
- else
- {
- format(strAux, 55, "\n%s[%d]\t{158C00}Sim{A9C4E4}", GetNameOfPlayer(target), target);
- }
- #else
- format(strAux, 31, "\n%s[%d]", GetNameOfPlayer(target), target);
- #endif
- strcat(string, strAux);
- playerHandcuff[playerid][E_AUX_TARGET_HANDCUFF_SLOT][a] = i;
- a++;
- }
- }
- if(!a) return SendClientMessage(playerid, COLOR_RED, "<!> {FFFFFF}Ops...não há nenhum suspeito para listar!");
- strcat(string, "\n{B9C9BF}{{A9C4E4}sobre{B9C9BF}}");
- SetPVarInt(playerid, "DIALOG_LISTITEM_ABOUT", a);
- ShowPlayerDialog(playerid, DIALOG_SUSPECTS_CUFFED, DIALOG_STYLE_TABLIST_HEADERS, "Suspeitos algemados", string, "Detalhes", "Fechar");
- return true;
- }
- //----------------------------------------
- stock ShowPlayerPanelOfHandcuffs(playerid)
- {
- ShowPlayerDialog(playerid, DIALOG_PANEL_HANDCUFFS, DIALOG_STYLE_LIST, "Handcuff System - Painel", "Ver jogadores algemados\nVer responsáveis pelas imobilizações", "Selecionar", "Fechar");
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement