Advertisement
djhonga2001

GTAV - Rapid fire

Nov 18th, 2016
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. //----------------- Rapid Fire -----------------
  2.  
  3.  
  4. #include <math.h>
  5.  
  6. RapidFireLoop()
  7. {
  8. if ( (RapidfireActive == true) && (IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID(),1)==False) && (IS_CONTROL_PRESSED(2,199) && (GET_GAME_TIMER()>=Timeout) )
  9. {
  10. FromCoord = GET_PED_BONE_COORDS(PLAYER_PED_ID(),57005,0,0,0)
  11. ToCoord = GetCoordsInfrontOfCam(75)
  12. GET_CURRENT_PED_WEAPON(PLAYER_PED_ID,*WeaponID,0)
  13. SHOOT_SINGLE_BULLET_BETWEEN_COORDS(FromCoord,ToCoo rd,250,0,WeaponID,PLAYER_PED_ID(),1,0,1)
  14. Timeout = GET_GAME_TIMER() + 50
  15. }
  16. }
  17.  
  18. Vector3 GetCoordsInfrontOfCam(float distance)
  19. {
  20. Vector3 GameplayCamRot = GET_GAMEPLAY_CAM_ROT(2);
  21. Vector3 GameplayCamCoord = GET_GAMEPLAY_CAM_COORD();
  22.  
  23. float tan = Cos(GameplayCamRot.X) * distance);
  24. float xPlane = Sin(GameplayCamRot.Z * -1.0f) * tan) + GameplayCamCoord.X);
  25. float yPlane = Cos(GameplayCamRot.Z * -1.0f) * tan) + GameplayCamCoord.Y);
  26. float zPlane = Sin(GameplayCamRot.X) * distance) + GameplayCamCoord.Z);
  27.  
  28. return new Vector3(xPlane, yPlane, zPlane);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement