Advertisement
Guest User

Laser Pointer 3.0

a guest
Aug 30th, 2012
1,856
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 9.75 KB | None | 0 0
  1. #include <a_samp>
  2. #include <foreach>
  3. #include <sscanf2>
  4. #include <zcmd>
  5.  
  6. //====================================================
  7.  
  8. #define C_GREY 0xAFAFAFAA
  9. #define C_VIOLET 0x9955DEEE
  10.  
  11. //====================================================
  12.  
  13. public OnFilterScriptInit()
  14. {
  15.         foreach(new i: Player)
  16.         {
  17.                 SetPVarInt(i, "laser", 0);
  18.                 SetPVarInt(i, "color", 18643);
  19.         }
  20.         return 1;
  21. }
  22.  
  23. public OnFilterScriptExit()
  24. {
  25.         foreach(new i: Player)
  26.         {
  27.                 SetPVarInt(i, "laser", 0);
  28.                 RemovePlayerAttachedObject(i, 0);
  29.         }
  30.         return 1;
  31. }
  32.  
  33. //====================================================
  34.  
  35. public OnPlayerSpawn(playerid)
  36. {
  37.     if (!GetPVarInt(playerid, "color")) SetPVarInt(playerid, "color", 18643);
  38. }
  39.  
  40. public OnPlayerDisconnect(playerid)
  41. {
  42.         RemovePlayerAttachedObject(playerid, 0);
  43.         return 1;
  44. }
  45.  
  46. //====================================================
  47.  
  48.  
  49. CMD:laseron(playerid, params[])
  50. {
  51.     SetPVarInt(playerid, "laser", 1);
  52.     SetPVarInt(playerid, "color", GetPVarInt(playerid, "color"));
  53.     return 1;
  54. }
  55.  
  56. CMD:laseroff(playerid, params[])
  57. {
  58.     SetPVarInt(playerid, "laser", 0);
  59.     RemovePlayerAttachedObject(playerid, 0);
  60.     return 1;
  61. }
  62.  
  63. CMD:lasercol(playerid, params[])
  64. {
  65.     new color[16];
  66.     if(sscanf(params, "s[15]", color)) return SendClientMessage(playerid, C_GREY, "USAGE: /lasercol [color]");
  67.  
  68.     if(!strcmp(color, "red", true)) SetPVarInt(playerid, "color", 18643);
  69.     else if(!strcmp(color, "blue", true)) SetPVarInt(playerid, "color", 19080);
  70.     else if(!strcmp(color, "pink", true)) SetPVarInt(playerid, "color", 19081);
  71.     else if(!strcmp(color, "orange", true)) SetPVarInt(playerid, "color", 19082);
  72.     else if(!strcmp(color, "green", true)) SetPVarInt(playerid, "color", 19083);
  73.     else if(!strcmp(color, "yellow", true)) SetPVarInt(playerid, "color", 19084);
  74.     else SendClientMessage(playerid, C_VIOLET, "Color not available!");
  75.     return 1;
  76. }
  77.  
  78. public OnPlayerUpdate(playerid)
  79. {
  80.         if(GetPVarInt(playerid, "laser") == 1)
  81.         {
  82.             RemovePlayerAttachedObject(playerid, 0);
  83.             if ((IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid))) return 1;
  84.             switch (GetPlayerWeapon(playerid))
  85.             {
  86.                 case 23:
  87.                 {
  88.                     if (IsPlayerAiming(playerid))
  89.                     {
  90.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  91.                         {
  92.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
  93.                             0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240);
  94.                         }
  95.                         else
  96.                         {
  97.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched aiming
  98.                             0.108249, 0.030232, 0.118051, 1.468254, 349.862579, 364.784240);
  99.                         }
  100.                     }
  101.                     else
  102.                     {
  103.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  104.                         {
  105.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing not aiming
  106.                             0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
  107.                         }
  108.                         else
  109.                         {
  110.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched not aiming
  111.                             0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
  112.                         }
  113.                     }
  114.                 }
  115.                 case 27:
  116.                 {
  117.                     if (IsPlayerAiming(playerid))
  118.                     {
  119.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  120.                         {
  121.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing aiming
  122.                             0.588246, -0.022766, 0.138052, -11.531745, 347.712585, 352.784271);
  123.                         }
  124.                         else
  125.                         {
  126.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched aiming
  127.                             0.588246, -0.022766, 0.138052, 1.468254, 350.712585, 352.784271);
  128.                         }
  129.                     }
  130.                     else
  131.                     {
  132.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  133.                         {
  134.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing not aiming
  135.                             0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
  136.                         }
  137.                         else
  138.                         {
  139.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched not aiming
  140.                             0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
  141.                         }
  142.                     }
  143.                 }
  144.                 case 30:
  145.                 {
  146.                     if (IsPlayerAiming(playerid))
  147.                     {
  148.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  149.                         {
  150.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing aiming
  151.                             0.628249, -0.027766, 0.078052, -6.621746, 352.552642, 355.084289);
  152.                         }
  153.                         else
  154.                         {
  155.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched aiming
  156.                             0.628249, -0.027766, 0.078052, -1.621746, 356.202667, 355.084289);
  157.                         }
  158.                     }
  159.                     else
  160.                     {
  161.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  162.                         {
  163.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing not aiming
  164.                             0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
  165.                         }
  166.                         else
  167.                         {
  168.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched not aiming
  169.                             0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
  170.                         }
  171.                     }
  172.                 }
  173.                 case 31:
  174.                 {
  175.                     if (IsPlayerAiming(playerid))
  176.                     {
  177.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  178.                         {
  179.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing aiming
  180.                             0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
  181.                         }
  182.                         else
  183.                         {
  184.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched aiming
  185.                             0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
  186.                         }
  187.                     }
  188.                     else
  189.                     {
  190.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  191.                         {
  192.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing not aiming
  193.                             0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
  194.                         }
  195.                         else
  196.                         {
  197.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched not aiming
  198.                             0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
  199.                         }
  200.                     }
  201.                 }
  202.                 /*case 34:
  203.                 {
  204.                     if (IsPlayerAiming(playerid))
  205.                     {
  206.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  207.                         {
  208.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing aiming
  209.                             0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
  210.                         }
  211.                         else
  212.                         {
  213.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched aiming
  214.                             0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
  215.                         }
  216.                     }
  217.                     else
  218.                     {
  219.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  220.                         {
  221.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing not aiming
  222.                             0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
  223.                         }
  224.                         else
  225.                         {
  226.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched not aiming
  227.                             0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259);
  228.                         }
  229.                     }
  230.                 }*/
  231.                 case 29:
  232.                 {
  233.                     if (IsPlayerAiming(playerid))
  234.                     {
  235.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  236.                         {
  237.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing aiming
  238.                             0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259);
  239.                         }
  240.                         else
  241.                         {
  242.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched aiming
  243.                             0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259);
  244.                         }
  245.                     }
  246.                     else
  247.                     {
  248.                         if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
  249.                         {
  250.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing not aiming
  251.                             0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
  252.                         }
  253.                         else
  254.                         {
  255.                             SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched not aiming
  256.                             0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
  257.                         }
  258.                     }
  259.                 }
  260.             }
  261.         }
  262.         return 1;
  263. }
  264.  
  265. stock IsPlayerInWater(playerid)
  266. {
  267.     new anim = GetPlayerAnimationIndex(playerid);
  268.     if (((anim >=  1538) && (anim <= 1542)) || (anim == 1544) || (anim == 1250) || (anim == 1062)) return 1;
  269.     return 0;
  270. }
  271.  
  272. stock IsPlayerAiming(playerid)
  273. {
  274.     new anim = GetPlayerAnimationIndex(playerid);
  275.     if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) || (anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
  276.     return 0;
  277. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement