Advertisement
ZeR2505

[FilterScript]Laser

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