Advertisement
Guest User

SA:MP Headshot System by Peppe

a guest
Aug 23rd, 2010
6,630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.23 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. /*-------------------------
  4. HeadShot System by Peppe
  5. The faster implementation of a headshot system in SA:MP.
  6. This script requires the new version of SA:MP 0.3b.
  7.  
  8. www.pawnoitalia.forumfree.it
  9. www.atlantisgaming.it
  10. -------------------------*/
  11.  
  12. #define TIMER_INTERVAL 150
  13.  
  14. new
  15.     maxPlayers;
  16.  
  17. public OnFilterScriptInit()
  18. {
  19.     maxPlayers = GetMaxPlayers();
  20.     SetTimer("CheckHeadShot", TIMER_INTERVAL, 1);
  21.     return 1;
  22. }
  23.  
  24. public OnPlayerDeath(playerid, killerid, reason)
  25. {
  26.     if(GetPVarInt(playerid, "Headshotted") == 1)
  27.     {
  28.         SetPVarInt(playerid, "Headshotted", 0);
  29.         GameTextForPlayer(playerid, "~r~Headshotted", 3000, 3);
  30.         GameTextForPlayer(killerid, "~r~Headshott", 3000, 3);
  31.     }
  32.     return 1;
  33. }
  34.  
  35. forward CheckHeadShot();
  36. public CheckHeadShot()
  37. {
  38.     new
  39.         index;
  40.     for(new playerid; playerid < maxPlayers; playerid++)
  41.     {
  42.         if(IsPlayerConnected(playerid))
  43.         {
  44.         index = GetPlayerAnimationIndex(playerid);
  45.         if(index == 1173 || index == 1175 || index == 1177 || index == 1178)
  46.         {
  47.                 SetPVarInt(playerid, "Headshotted", 1);
  48.                 SetPlayerHealth(playerid, 0);
  49.             }
  50.         }
  51.     }
  52.     return 1;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement