Advertisement
Pedro_Sousa6

[Filterscript] Respirar para Mirar

Jan 21st, 2016
869
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.63 KB | None | 0 0
  1. /* ===============================
  2.  
  3. Sistema de Respirar para Mirar feito por: JPedro
  4.  
  5. Mantenha os créditos do Autor!
  6.  
  7. ===================================*/
  8.  
  9. #include <a_samp>
  10.  
  11. /* ==================== [ Macros ] ===================== */
  12.  
  13. #define RELEASED(%0) (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
  14.  
  15. #define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  16.  
  17. #define HOLDING(%0) ((newkeys & (%0)) == (%0))
  18.  
  19. /* ========================================= */
  20.  
  21. new bool:pMirando[MAX_PLAYERS] = false,
  22. bool:pRespirando[MAX_PLAYERS] = true;
  23.  
  24.  
  25. public OnFilterScriptInit()
  26. {
  27. print("\n\n\n| INFO |: Sistema de Respirar para Mirar | Carregado com sucesso!\n\n\n");
  28. return 1;
  29. }
  30.  
  31. public OnFilterScriptExit()
  32. {
  33. return 1;
  34. }
  35.  
  36. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  37. {
  38. if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  39. {
  40. if(GetPlayerWeapon(playerid) == 34)
  41. {
  42. if(PRESSED(KEY_HANDBRAKE)) // Checa quando mira
  43. {
  44. if(pMirando[playerid] == false)
  45. {
  46. SoltarRespiracao(playerid);
  47. pMirando[playerid] = true;
  48. pRespirando[playerid] = false;
  49. }
  50. }
  51. if(RELEASED(KEY_HANDBRAKE)) // Checa quando solta a mira
  52. {
  53. if(pMirando[playerid] == true)
  54. {
  55. SegurarRespiracao(playerid);
  56. pMirando[playerid] = false;
  57. pRespirando[playerid] = true;
  58. }
  59. }
  60. if(HOLDING(KEY_WALK)) // Checa se esta segurando a respiracao
  61. {
  62. if(pMirando[playerid] == true)
  63. {
  64. if(pRespirando[playerid] == false)
  65. {
  66. pRespirando[playerid] = true;
  67. SegurarRespiracao(playerid);
  68. }
  69. }
  70. }
  71. if(RELEASED(KEY_WALK)) // Checa quando soltou a respiracao
  72. {
  73. if(pMirando[playerid] == true)
  74. {
  75. if(pRespirando[playerid] == true)
  76. {
  77. pRespirando[playerid] = false;
  78. SoltarRespiracao(playerid);
  79. }
  80. }
  81. }
  82. if(HOLDING(KEY_FIRE)) // caso o jogador segure o butao de atirar
  83. {
  84. if(pMirando[playerid] == true)
  85. {
  86. if(pRespirando[playerid] == true)
  87. {
  88. pRespirando[playerid] = false;
  89. SoltarRespiracao(playerid);
  90. }
  91. }
  92. }
  93. else if(RELEASED(KEY_FIRE)) // Checa se o jogador soltou o butao de atirar
  94. {
  95. if(pMirando[playerid] == true)
  96. {
  97. if(pRespirando[playerid] == true)
  98. {
  99. pRespirando[playerid] = false;
  100. SoltarRespiracao(playerid);
  101. }
  102. }
  103. }
  104. }
  105. }
  106. return 1;
  107. }
  108.  
  109. stock SoltarRespiracao(playerid)
  110. {
  111. PlayerPlaySound(playerid, 31400, 0.0, 0.0, 0.0);
  112. SetPlayerDrunkLevel(playerid, 7000);
  113. return 1;
  114. }
  115.  
  116. stock SegurarRespiracao(playerid)
  117. {
  118. PlayerPlaySound(playerid, 31400+1, 0.0, 0.0, 0.0);
  119. SetPlayerDrunkLevel(playerid, 0);
  120. return 1;
  121. }
  122.  
  123.  
  124. // www.homehots.com.br
  125. //Todos os direitos reservados a JPedro pela criação do filterscript.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement