Advertisement
Guest User

[Pawno] BasketBall Script by Peppe

a guest
Feb 27th, 2010
12,538
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 15.36 KB
  1. #include <a_samp>
  2.  
  3. new HavingBall[MAX_PLAYERS];
  4. new Anim[MAX_PLAYERS];
  5. new Ball;
  6. new BallStatus;
  7. new Baller;
  8. new ShootingBall;
  9. new BallBounce;
  10.  
  11. public OnFilterScriptInit()
  12. {
  13.     Baller = 999;
  14.     DestroyObject(Ball);
  15.     Ball = CreateObject(2114, 2782.3027,-2019.0826,13.5547-0.8, 0, 0, 96);
  16.     return 1;
  17. }
  18.  
  19. public OnFilterScriptExit()
  20. {
  21.     return 1;
  22. }
  23.  
  24. public OnObjectMoved(objectid)
  25. {
  26.     new i = Baller;
  27.     if(ShootingBall == 2)
  28.     {
  29.         BallDown2(i);
  30.         return 1;
  31.     }
  32.     else if(ShootingBall == 3)
  33.     {
  34.         BallDown3(i);
  35.         return 1;
  36.     }
  37.     else if(ShootingBall == 4)
  38.     {
  39.         BallDown4(i);
  40.         return 1;
  41.     }
  42.     else if(ShootingBall == 5)
  43.     {
  44.         BallDown5(i);
  45.         return 1;
  46.     }
  47.     else if(ShootingBall == 6)
  48.     {
  49.         ApplyAnimation(i,"BSKTBALL","BBALL_walk",4.1,1,1,1,1,1);
  50.         HavingBall[i] = 1;
  51.         Anim[i] = 0;
  52.     }
  53.     if(BallBounce == 1)
  54.     {
  55.         new Float:x, Float:y, Float:z;
  56.         GetObjectPos(Ball, x, y, z);
  57.         MoveObject(Ball, x, y, z+1.2, 4);
  58.         BallBounce = 2;
  59.     }
  60.     else if(BallBounce == 2)
  61.     {
  62.         new Float:x, Float:y, Float:z;
  63.         GetObjectPos(Ball, x, y, z);
  64.         MoveObject(Ball, x, y, z-1.2, 4);
  65.         BallBounce = 3;
  66.     }
  67.     else if(BallBounce == 3)
  68.     {
  69.         new Float:x, Float:y, Float:z;
  70.         GetObjectPos(Ball, x, y, z);
  71.         MoveObject(Ball, x, y, z+0.8, 3);
  72.         BallBounce = 4;
  73.     }
  74.     else if(BallBounce == 4)
  75.     {
  76.         new Float:x, Float:y, Float:z;
  77.         GetObjectPos(Ball, x, y, z);
  78.         MoveObject(Ball, x, y, z-0.8, 3);
  79.         BallBounce = 5;
  80.     }
  81.     else if(BallBounce == 5)
  82.     {
  83.         new Float:x, Float:y, Float:z;
  84.         GetObjectPos(Ball, x, y, z);
  85.         MoveObject(Ball, x, y, z+0.5, 2);
  86.         BallBounce = 6;
  87.     }
  88.     else if(BallBounce == 6)
  89.     {
  90.         new Float:x, Float:y, Float:z;
  91.         GetObjectPos(Ball, x, y, z);
  92.         MoveObject(Ball, x, y, z-0.5, 2);
  93.         BallBounce = 7;
  94.     }
  95.     else if(BallBounce == 7)
  96.     {
  97.         new Float:x, Float:y, Float:z;
  98.         GetObjectPos(Ball, x, y, z);
  99.         MoveObject(Ball, x, y, z+0.2, 1);
  100.         BallBounce = 8;
  101.     }
  102.     else if(BallBounce == 8)
  103.     {
  104.         new Float:x, Float:y, Float:z;
  105.         GetObjectPos(Ball, x, y, z);
  106.         MoveObject(Ball, x, y, z-0.2, 1);
  107.         BallBounce = 0;
  108.     }
  109.     if(!HavingBall[i]) return 1;
  110.     new Keys, ud, lr;
  111.     GetPlayerKeys(i, Keys, ud, lr);
  112.     if(Anim[i])
  113.     {
  114.         switch(BallStatus)
  115.         {
  116.             case 0:
  117.             {
  118.                 BallStatus = 1;
  119.                 new Float:x, Float:y, Float:z;
  120.                 GetPlayerPos(i, x, y, z);
  121.                 StopObject(Ball);
  122.                 new Float:x2, Float:y2;
  123.                 GetXYInFrontOfPlayer(i, x2, y2, 0.4);
  124.                 MoveObject(Ball, x2, y2, z+0.1, 5.5);
  125.             }
  126.             case 1:
  127.             {
  128.                 BallStatus = 0;
  129.                 new Float:x, Float:y, Float:z;
  130.                 GetPlayerPos(i, x, y, z);
  131.                 StopObject(Ball);
  132.                 new Float:x2, Float:y2;
  133.                 GetXYInFrontOfPlayer(i, x2, y2, 0.4);
  134.                 MoveObject(Ball, x2, y2, z-0.8, 5.5);
  135.             }
  136.         }
  137.         return 1;
  138.     }
  139.     if(Keys & KEY_SPRINT)
  140.     {
  141.         ApplyAnimation(i,"BSKTBALL","BBALL_run",4.1,1,1,1,1,1);
  142.         switch(BallStatus)
  143.         {
  144.             case 0:
  145.             {
  146.                 BallStatus = 1;
  147.                 new Float:x, Float:y, Float:z;
  148.                 GetPlayerPos(i, x, y, z);
  149.                 StopObject(Ball);
  150.                 new Float:x2, Float:y2;
  151.                 GetXYInFrontOfPlayer(i, x2, y2, 1.5);
  152.                 MoveObject(Ball, x2, y2, z+0.1, 8);
  153.             }
  154.             case 1:
  155.             {
  156.                 BallStatus = 0;
  157.                 new Float:x, Float:y, Float:z;
  158.                 GetPlayerPos(i, x, y, z);
  159.                 StopObject(Ball);
  160.                 new Float:x2, Float:y2;
  161.                 GetXYInFrontOfPlayer(i, x2, y2, 1.5);
  162.                 MoveObject(Ball, x2, y2, z-0.8, 8);
  163.             }
  164.         }
  165.         return 1;
  166.     }
  167.     else
  168.     {
  169.         ApplyAnimation(i,"BSKTBALL","BBALL_walk",4.1,1,1,1,1,1);
  170.     }
  171.     switch(BallStatus)
  172.     {
  173.         case 0:
  174.         {
  175.             BallStatus = 1;
  176.             new Float:x, Float:y, Float:z;
  177.             GetPlayerPos(i, x, y, z);
  178.             StopObject(Ball);
  179.             new Float:x2, Float:y2;
  180.             GetXYInFrontOfPlayer(i, x2, y2, 1.2);
  181.             MoveObject(Ball, x2, y2, z+0.1, 5);
  182.         }
  183.         case 1:
  184.         {
  185.             BallStatus = 0;
  186.             new Float:x, Float:y, Float:z;
  187.             GetPlayerPos(i, x, y, z);
  188.             StopObject(Ball);
  189.             new Float:x2, Float:y2;
  190.             GetXYInFrontOfPlayer(i, x2, y2, 1.2);
  191.             MoveObject(Ball, x2, y2, z-0.8, 5);
  192.         }
  193.     }
  194.     return 1;
  195. }
  196.  
  197. public OnPlayerConnect(playerid)
  198. {
  199.     return 1;
  200. }
  201.  
  202. public OnPlayerDisconnect(playerid, reason)
  203. {
  204.     HavingBall[playerid] = 0;
  205.     Anim[playerid] = 0;
  206.     if(HavingBall[playerid]) Baller = 999;
  207.     return 1;
  208. }
  209.  
  210. public OnPlayerSpawn(playerid)
  211. {
  212.     return 1;
  213. }
  214.  
  215. public OnPlayerDeath(playerid, killerid, reason)
  216. {
  217.     HavingBall[playerid] = 0;
  218.     if(HavingBall[playerid]) Baller = 999;
  219.     return 1;
  220. }
  221.  
  222. public OnVehicleSpawn(vehicleid)
  223. {
  224.     return 1;
  225. }
  226.  
  227. public OnVehicleDeath(vehicleid, killerid)
  228. {
  229.     return 1;
  230. }
  231.  
  232. public OnPlayerText(playerid, text[])
  233. {
  234.     return 1;
  235. }
  236.  
  237. public OnPlayerCommandText(playerid, cmdtext[])
  238. {
  239.     if (strcmp("/palla", cmdtext, true, 6) == 0)
  240.     {
  241.         new Float:x, Float:y, Float:z;
  242.         GetPlayerPos(playerid, x, y, z);
  243.         DestroyObject(Ball);
  244.         Ball = CreateObject(2114, x+random(3), y+random(3), z-0.8, 0, 0, 96);
  245.         return 1;
  246.     }
  247.     return 0;
  248. }
  249.  
  250. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  251. {
  252.     if ((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK) && !IsPlayerInAnyVehicle(playerid))
  253.     {
  254.         if(HavingBall[playerid])
  255.         {
  256.             ApplyAnimation(playerid,"BSKTBALL","BBALL_idleloop",4.1,1,1,1,1,1);
  257.         }
  258.         else
  259.         {
  260.             ApplyAnimation(playerid,"BSKTBALL","BBALL_def_loop",4.0,1,0,0,0,0);
  261.         }
  262.         Anim[playerid] = 1;
  263.     }
  264.     if (!(newkeys & KEY_SECONDARY_ATTACK) && (oldkeys & KEY_SECONDARY_ATTACK) && !IsPlayerInAnyVehicle(playerid))
  265.     {
  266.         ClearAnimations(playerid);
  267.         Anim[playerid] = 0;
  268.     }
  269.     if(newkeys & KEY_FIRE && !IsPlayerInAnyVehicle(playerid))
  270.     {
  271.         if(!HavingBall[playerid])
  272.         {
  273.             new Float:x, Float:y, Float:z;
  274.             GetObjectPos(Ball, x, y, z);
  275.             if(IsPlayerInRangeOfPoint(playerid, 1.5, x, y, z))
  276.             {
  277.                 HavingBall[playerid] = 1;
  278.                 ApplyAnimation(playerid,"BSKTBALL","BBALL_pickup",4.0,0,0,0,0,0);
  279.                 if(Baller != 999)
  280.                 {
  281.                     HavingBall[Baller] = 0;
  282.                     ClearAnimations(Baller);
  283.                     ApplyAnimation(Baller, "CARRY", "crry_prtial", 1.0, 0, 0, 0, 0, 0);
  284.                     ApplyAnimation(playerid,"BSKTBALL","BBALL_walk",4.1,1,1,1,1,1);
  285.                 }
  286.                 Baller = playerid;
  287.                 BallStatus = 1;
  288.                 new Float:x2, Float:y2;
  289.                 GetXYInFrontOfPlayer(playerid, x2, y2, 0.8);
  290.                 GetPlayerPos(playerid, x, y, z);
  291.                 StopObject(Ball);
  292.                 MoveObject(Ball, x2, y2, z, 2.5);
  293.                 Anim[playerid] = 0;
  294.                 BallBounce = 0;
  295.             }
  296.         }
  297.         else
  298.         {
  299.             if(IsPlayerInRangeOfPoint(playerid, 2, 2795.5237,-2019.6152,13.5547))
  300.             {
  301.                 MoveObject(Ball, 2794.9612,-2019.5415,15.5075, 7.5);
  302.                 SetPlayerPos(playerid, 2795.5237,-2019.6152,13.5547);
  303.                 ApplyAnimation(playerid,"BSKTBALL","BBALL_Dnk",4.0,1,0,0,0,0);
  304.                 HavingBall[playerid] = 0;
  305.                 SetTimerEx("ClearAnim", 1100, 0, "d", playerid);
  306.                 SetTimerEx("BallDown2", 1100, 0, "d", playerid);
  307.                 return 1;
  308.             }
  309.             else if(IsPlayerInRangeOfPoint(playerid, 4, 2795.5237,-2019.6152,13.5547) && IsPlayerFacingPoint(playerid, 20, 2795.5237,-2019.6152,13.5547))
  310.             {
  311.                 new rand = random(1);
  312.                 if(rand == 0)
  313.                 {
  314.                     MoveObject(Ball, 2794.9612,-2019.5415,15.5075, 10.5+random(4));
  315.                     ApplyAnimation(playerid,"BSKTBALL","BBALL_Jump_Shot",4.0,0,0,0,0,0);
  316.                     ShootingBall = 2;
  317.                     HavingBall[playerid] = 0;
  318.                     return 1;
  319.                 }
  320.                 ShootMiss(playerid);
  321.                 return 1;
  322.             }
  323.             else if(IsPlayerInRangeOfPoint(playerid, 7, 2795.5237,-2019.6152,13.5547) && IsPlayerFacingPoint(playerid, 20, 2795.5237,-2019.6152,13.5547))
  324.             {
  325.                 new rand = random(2);
  326.                 if(rand == 0)
  327.                 {
  328.                     MoveObject(Ball, 2794.9612,-2019.5415,15.5075, 11.0+random(4));
  329.                     ApplyAnimation(playerid,"BSKTBALL","BBALL_Jump_Shot",4.0,0,0,0,0,0);
  330.                     ShootingBall = 2;
  331.                     HavingBall[playerid] = 0;
  332.                     return 1;
  333.                 }
  334.                 ShootMiss(playerid);
  335.                 return 1;
  336.             }
  337.             else if(IsPlayerInRangeOfPoint(playerid, 10, 2795.5237,-2019.6152,13.5547) && IsPlayerFacingPoint(playerid, 20, 2795.5237,-2019.6152,13.5547))
  338.             {
  339.                 new rand = random(3);
  340.                 if(rand == 0)
  341.                 {
  342.                     MoveObject(Ball, 2794.9612,-2019.5415,15.5075, 11.5+random(4));
  343.                     ApplyAnimation(playerid,"BSKTBALL","BBALL_Jump_Shot",4.0,0,0,0,0,0);
  344.                     ShootingBall = 2;
  345.                     HavingBall[playerid] = 0;
  346.                     return 1;
  347.                 }
  348.                 ShootMiss(playerid);
  349.                 return 1;
  350.             }
  351.             else if(IsPlayerInRangeOfPoint(playerid, 2, 2768.3669,-2019.6644,13.5547))
  352.             {
  353.                 MoveObject(Ball, 2768.6289,-2019.7227,15.6287, 7.5);
  354.                 SetPlayerPos(playerid, 2768.3669,-2019.6644,13.5547);
  355.                 ApplyAnimation(playerid,"BSKTBALL","BBALL_Dnk",4.0,1,0,0,0,0);
  356.                 HavingBall[playerid] = 0;
  357.                 SetTimerEx("ClearAnim", 800, 0, "d", playerid);
  358.                 SetTimerEx("BallDown3", 1100, 0, "d", playerid);
  359.                 return 1;
  360.             }
  361.             else if(IsPlayerInRangeOfPoint(playerid, 4, 2768.3669,-2019.6644,13.5547) && IsPlayerFacingPoint(playerid, 20, 2768.3669,-2019.6644,13.5547))
  362.             {
  363.                 new rand = random(1);
  364.                 if(rand == 0)
  365.                 {
  366.                     MoveObject(Ball, 2768.6289,-2019.7227,15.6287, 10.5+random(4));
  367.                     ApplyAnimation(playerid,"BSKTBALL","BBALL_Jump_Shot",4.0,0,0,0,0,0);
  368.                     ShootingBall = 3;
  369.                     HavingBall[playerid] = 0;
  370.                     return 1;
  371.                 }
  372.                 ShootMiss2(playerid);
  373.                 return 1;
  374.             }
  375.             else if(IsPlayerInRangeOfPoint(playerid, 7, 2768.3669,-2019.6644,13.5547) && IsPlayerFacingPoint(playerid, 20, 2768.3669,-2019.6644,13.5547))
  376.             {
  377.                 new rand = random(2);
  378.                 if(rand == 0)
  379.                 {
  380.                     MoveObject(Ball, 2768.6289,-2019.7227,15.6287, 11.0+random(4));
  381.                     ApplyAnimation(playerid,"BSKTBALL","BBALL_Jump_Shot",4.0,0,0,0,0,0);
  382.                     ShootingBall = 3;
  383.                     HavingBall[playerid] = 0;
  384.                     return 1;
  385.                 }
  386.                 ShootMiss2(playerid);
  387.                 return 1;
  388.             }
  389.             else if(IsPlayerInRangeOfPoint(playerid, 10, 2768.3669,-2019.6644,13.5547) && IsPlayerFacingPoint(playerid, 20, 2768.3669,-2019.6644,13.5547))
  390.             {
  391.                 new rand = random(3);
  392.                 if(rand == 0)
  393.                 {
  394.                     MoveObject(Ball, 2768.6289,-2019.7227,15.6287, 11.5+random(4));
  395.                     ApplyAnimation(playerid,"BSKTBALL","BBALL_Jump_Shot",4.0,0,0,0,0,0);
  396.                     ShootingBall = 3;
  397.                     HavingBall[playerid] = 0;
  398.                     return 1;
  399.                 }
  400.                 ShootMiss2(playerid);
  401.                 return 1;
  402.             }
  403.             for(new i; i < MAX_PLAYERS; i++)
  404.             {
  405.                 if(IsPlayerConnected(i))
  406.                 {
  407.                     if(IsPlayerFacingPlayer(playerid, i, 15))
  408.                     {
  409.                         new Float:x, Float:y, Float:z;
  410.                         GetPlayerPos(i, x, y, z);
  411.                         if(IsPlayerInRangeOfPoint(playerid, 20.0, x, y, z))
  412.                         {
  413.                             Baller = i;
  414.                             HavingBall[playerid] = 0;
  415.                             ClearAnimations(playerid);
  416.                             ApplyAnimation(playerid,"BSKTBALL","BBALL_def_loop",4.0,1,0,0,0,0);
  417.                             SetTimerEx("ClearAnim", 700, 0, "d", playerid);
  418.                             MoveObject(Ball, x, y, z, 13+random(4));
  419.                             Anim[i] = 0;
  420.                             ShootingBall = 6;
  421.                             ApplyAnimation(i,"BSKTBALL","BBALL_def_loop",4.0,1,0,0,0,0);
  422.                             return 1;
  423.                         }
  424.                     }
  425.                 }
  426.             }
  427.             new Float:x, Float:y, Float:z;
  428.             GetPlayerPos(playerid, x, y, z);
  429.             HavingBall[playerid] = 0;
  430.             new Float:x2, Float:y2;
  431.             GetXYInFrontOfPlayer(playerid, x2, y2, 6.0);
  432.             SetTimerEx("BallDown", 600, 0, "df", playerid, z);
  433.             MoveObject(Ball, x2, y2, z+random(8)+3, 10.0+random(4));
  434.             ApplyAnimation(playerid,"BSKTBALL","BBALL_Jump_Shot",4.0,0,0,0,0,0);
  435.             ShootingBall = 0;
  436.         }
  437.     }
  438.     return 1;
  439. }
  440.  
  441. stock IsPlayerFacingPoint(playerid, Float:dOffset, Float:pX, Float:pY, Float:pZ)
  442. {
  443.     #pragma unused pZ
  444.     new
  445.         Float:X,
  446.         Float:Y,
  447.         Float:Z,
  448.         Float:pA,
  449.         Float:ang;
  450.  
  451.     if(!IsPlayerConnected(playerid)) return 0;
  452.  
  453.     GetPlayerPos(playerid, X, Y, Z);
  454.     GetPlayerFacingAngle(playerid, pA);
  455.  
  456.     if( Y > pY ) ang = (-acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 90.0);
  457.     else if( Y < pY && X < pX ) ang = (acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 450.0);
  458.     else if( Y < pY ) ang = (acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 90.0);
  459.  
  460.     if(AngleInRangeOfAngle(-ang, pA, dOffset)) return true;
  461.  
  462.     return false;
  463.  
  464. }
  465.  
  466. stock IsPlayerFacingPlayer(playerid, targetid, Float:dOffset)
  467. {
  468.  
  469.     new
  470.         Float:pX,
  471.         Float:pY,
  472.         Float:pZ,
  473.         Float:pA,
  474.         Float:X,
  475.         Float:Y,
  476.         Float:Z,
  477.         Float:ang;
  478.  
  479.     if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetid)) return 0;
  480.  
  481.     GetPlayerPos(targetid, pX, pY, pZ);
  482.     GetPlayerPos(playerid, X, Y, Z);
  483.     GetPlayerFacingAngle(playerid, pA);
  484.  
  485.     if( Y > pY ) ang = (-acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 90.0);
  486.     else if( Y < pY && X < pX ) ang = (acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 450.0);
  487.     else if( Y < pY ) ang = (acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 90.0);
  488.  
  489.     if(AngleInRangeOfAngle(-ang, pA, dOffset)) return true;
  490.  
  491.     return false;
  492.  
  493. }
  494.  
  495. stock AngleInRangeOfAngle(Float:a1, Float:a2, Float:range)
  496. {
  497.  
  498.     a1 -= a2;
  499.     if((a1 < range) && (a1 > -range)) return true;
  500.  
  501.     return false;
  502.  
  503. }
  504.  
  505. forward BallDown(playerid, Float:oldz);
  506. public BallDown(playerid, Float:oldz)
  507. {
  508.     new Float:x, Float:y, Float:z;
  509.     GetObjectPos(Ball, x, y, z);
  510.     new Float:a;
  511.     new Float:x2, Float:y2;
  512.     GetPlayerPos(playerid, x2, y2, a);
  513.     GetPlayerFacingAngle(playerid, a);
  514.     x2 += (16 * floatsin(-a, degrees));
  515.     y2 += (16 * floatcos(-a, degrees));
  516.     MoveObject(Ball, x2, y2, oldz-0.8, 10.0+random(3));
  517.     Baller = 999;
  518.     ShootingBall = 0;
  519.     BallBounce = 1;
  520.     return 1;
  521. }
  522.  
  523. forward BallDown2(playerid);
  524. public BallDown2(playerid)
  525. {
  526.     MoveObject(Ball, 2795.5237,-2019.6152,13.5547-0.8, 10.0+random(3));
  527.     Baller = 999;
  528.     ShootingBall = 0;
  529.     GameTextForPlayer(playerid, "~g~Canestro!", 3000, 3);
  530.     BallBounce = 1;
  531.     return 1;
  532. }
  533.  
  534. forward BallDown3(playerid);
  535. public BallDown3(playerid)
  536. {
  537.     MoveObject(Ball, 2768.3669,-2019.6644,13.5547-0.8, 10.0+random(3));
  538.     Baller = 999;
  539.     ShootingBall = 0;
  540.     GameTextForPlayer(playerid, "~g~Canestro!", 3000, 3);
  541.     BallBounce = 1;
  542.     return 1;
  543. }
  544.  
  545. forward BallDown4(playerid);
  546. public BallDown4(playerid)
  547. {
  548.     MoveObject(Ball, 2795.5237+random(5),-2019.6152+random(5),13.5547-0.8, 10.0+random(3));
  549.     Baller = 999;
  550.     ShootingBall = 0;
  551.     GameTextForPlayer(playerid, "~r~Mancato!", 3000, 3);
  552.     BallBounce = 1;
  553.     return 1;
  554. }
  555.  
  556. forward BallDown5(playerid);
  557. public BallDown5(playerid)
  558. {
  559.     MoveObject(Ball, 2768.3669+random(5),-2019.6644+random(5),13.5547-0.8, 10.0+random(3));
  560.     Baller = 999;
  561.     ShootingBall = 0;
  562.     GameTextForPlayer(playerid, "~r~Mancato!", 3000, 3);
  563.     BallBounce = 1;
  564.     return 1;
  565. }
  566.  
  567. forward ShootMiss(playerid);
  568. public ShootMiss(playerid)
  569. {
  570.     MoveObject(Ball, 2794.9612+random(2), -2019.5415+random(2), 15.5075+random(2), 12.5+random(4));
  571.     ApplyAnimation(playerid,"BSKTBALL","BBALL_Jump_Shot",4.0,0,0,0,0,0);
  572.     ShootingBall = 4;
  573.     HavingBall[playerid] = 0;
  574.     return 1;
  575. }
  576.  
  577. forward ShootMiss2(playerid);
  578. public ShootMiss2(playerid)
  579. {
  580.     MoveObject(Ball, 2768.6289+random(2),-2019.7227+random(2),15.6287+random(2), 12.5+random(4));
  581.     ApplyAnimation(playerid,"BSKTBALL","BBALL_Jump_Shot",4.0,0,0,0,0,0);
  582.     ShootingBall = 5;
  583.     HavingBall[playerid] = 0;
  584.     return 1;
  585. }
  586.  
  587. forward ClearAnim(playerid);
  588. public ClearAnim(playerid)
  589. {
  590.     ClearAnimations(playerid);
  591.     return 1;
  592. }
  593.  
  594. GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  595. {
  596.     new Float:a;
  597.     GetPlayerPos(playerid, x, y, a);
  598.     GetPlayerFacingAngle(playerid, a);
  599.     if (GetPlayerVehicleID(playerid))
  600.     {
  601.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  602.     }
  603.     x += (distance * floatsin(-a, degrees));
  604.     y += (distance * floatcos(-a, degrees));
  605. }
Advertisement
RAW Paste Data Copied
Advertisement