Guest User

Untitled

a guest
Oct 28th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. /*
  2. CREDITOS: Reski
  3. El tito Reski ¬ ¬
  4. */
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <sscanf2>
  8.  
  9. #define COLOR_PURPLE 0xC2A2DAAA
  10. #define SACAR_TAZER (5000)
  11. new AmmoTazer[MAX_PLAYERS];
  12. new bool:ActivarTazer[MAX_PLAYERS]=false;
  13. new bool:PlayerTazeado[MAX_PLAYERS]=false;
  14. new TerminarTazeado[MAX_PLAYERS];
  15.  
  16. COMMAND:tazer(playerid, params[]) {
  17. new string[128], name[MAX_PLAYER_NAME+1];
  18. GetPlayerName(playerid, name, sizeof(name));
  19. AmmoTazer[playerid] = GetPlayerAmmo(playerid);
  20. switch(GetPlayerWeapon(playerid)) {
  21. case 22: { //9mm
  22. GivePlayerWeapon(playerid, 23, AmmoTazer[playerid]);
  23. ActivarTazer[playerid] = true;
  24. format(string, sizeof(string), "* %s Load your tazer.", name);
  25. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  26. }
  27. case 23: { //Silenced 9mm
  28. GivePlayerWeapon(playerid, 22, AmmoTazer[playerid]);
  29. ActivarTazer[playerid] = false;
  30. format(string, sizeof(string), "* %s off his tazer.", name);
  31. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  32. }
  33. }
  34. return 1;
  35. }
  36.  
  37. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  38. {
  39. if(issuerid != INVALID_PLAYER_ID) {
  40. if(ActivarTazer[issuerid] == true && GetPlayerWeapon(issuerid) == 23 && PlayerTazeado[playerid] == false) {
  41. SetPlayerHealth(playerid, (0-amount));
  42. TogglePlayerControllable(playerid, false);
  43. PlayerTazeado[playerid] = true;
  44. TerminarTazeado[playerid]=SetTimerEx("TocarTazer", SACAR_TAZER, false, "i", playerid);
  45. new string[128];
  46. format(string, sizeof(string), "Tazeado %i Milisegundos.", SACAR_TAZER);
  47. GameTextForPlayer(playerid, string, 3000, 1);
  48. ApplyAnimation(playerid, "CRACK","crckdeth2",4.1,0,1,1,1,1,1);
  49. }
  50. }
  51. return 1;
  52. }
  53.  
  54. forward TocarTazer(playerid);
  55. public TocarTazer(playerid) {
  56. TogglePlayerControllable(playerid, true);
  57. PlayerTazeado[playerid] = false;
  58. GameTextForPlayer(playerid, "Tazer taken.", 3000, 1);
  59. KillTimer(TerminarTazeado[playerid]);
  60. ClearAnimations(playerid);
  61. return 1;
  62. }
  63.  
  64. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  65. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  66. {
  67. if(IsPlayerConnected(playerid))
  68. {
  69. new Float:posx, Float:posy, Float:posz;
  70. new Float:oldposx, Float:oldposy, Float:oldposz;
  71. new Float:tempposx, Float:tempposy, Float:tempposz;
  72. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  73. for(new i = 0; i < MAX_PLAYERS; i++)
  74. {
  75. if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  76. {
  77. GetPlayerPos(i, posx, posy, posz);
  78. tempposx = (oldposx -posx);
  79. tempposy = (oldposy -posy);
  80. tempposz = (oldposz -posz);
  81. if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
  82. {
  83. SendClientMessage(i, col1, string);
  84. }
  85. else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
  86. {
  87. SendClientMessage(i, col2, string);
  88. }
  89. else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
  90. {
  91. SendClientMessage(i, col3, string);
  92. }
  93. else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
  94. {
  95. SendClientMessage(i, col4, string);
  96. }
  97. else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
  98. {
  99. SendClientMessage(i, col5, string);
  100. }
  101. }
  102. else
  103. {
  104. SendClientMessage(i, col1, string);
  105. }
  106. }
  107. }
  108. return 1;
  109. }
  110. /*
  111. CREDITOS: Reski
  112. El tito Reski ¬ ¬
  113. */
Advertisement
Add Comment
Please, Sign In to add comment