XADRENALINEIX

Jumper's Eject Near Ped's Through Windscreen

May 20th, 2013
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.54 KB | None | 0 0
  1. /* To compile this you need to add the following line to
  2. your scocl\bin\nativeO.cfg if it does not already exist:
  3. SET_PED_FORCE_FLY_THROUGH_WINDSCREEN=$f7fdd0f1
  4. ******** Controls: Hold L2 and tap L3 to toggle ********/
  5. #include <natives.h>
  6. #include <common.h>
  7. #include <strings.h>
  8. #include <types.h>
  9. #include <consts.h>
  10.  
  11. /********************** PS3 CONTROLLER BUTTON MAP **********************/
  12. #define L1 0x4
  13. #define L2 0x5
  14. #define R1 0x6
  15. #define R2 0x7
  16. #define DPAD_UP 0x8
  17. #define DPAD_DOWN  0x9
  18. #define DPAD_LEFT  0xA
  19. #define DPAD_RIGHT 0xB
  20. #define START  0xC
  21. #define SELECT 0xD
  22. #define SQUARE 0xE
  23. #define TRIANGLE  0xF
  24. #define X  0x10
  25. #define CIRCLE 0x11
  26. #define STICK_L 0x12  // L3
  27. #define STICK_R 0x13  // R3
  28. /**************************************************  *********************/
  29.  
  30. float ppedX, ppedY, ppedZ, cnX[5], cnY[5], cnZ[5];
  31. Ped ccd[5], ccp0[5], ccp1[5], ccp2[5];
  32. Vehicle cc[5];
  33. int EPDActive = 0;
  34.  
  35. void EjectPedDrivers(void)
  36. {
  37. int CN;
  38. for (CN = 0; CN <= 4; CN++)
  39. {
  40. GET_CHAR_COORDINATES(GetPlayerPed(),&ppedX, &ppedY, &ppedZ);
  41. GET_NTH_CLOSEST_CAR_NODE(ppedX, ppedY, ppedZ, CN * 2, &cnX[CN], &cnY[CN], &cnZ[CN]);
  42. cc[CN] = GET_CLOSEST_CAR(cnX[CN], cnY[CN], cnZ[CN], 20, false, 70);
  43. if (DOES_VEHICLE_EXIST(cc[CN]))
  44. {
  45. GET_DRIVER_OF_CAR(cc[CN], &ccd[CN]);
  46. if (DOES_CHAR_EXIST(ccd[CN]))
  47. {
  48. GET_CHAR_IN_CAR_PASSENGER_SEAT(cc[CN], 0, &ccp0[CN]);
  49. GET_CHAR_IN_CAR_PASSENGER_SEAT(cc[CN], 1, &ccp1[CN]);
  50. GET_CHAR_IN_CAR_PASSENGER_SEAT(cc[CN], 2, &ccp2[CN]);
  51. SET_PED_FORCE_FLY_THROUGH_WINDSCREEN(ccd[CN], 1);
  52. WAIT(50);
  53. APPLY_FORCE_TO_PED(ccd[CN], 1, 0.0, 8.0, 2.0, 0.0, 0.0, 0.0, 1, 1, 1, 1);
  54. if (DOES_CHAR_EXIST(ccp0[CN]))
  55. {
  56. SET_PED_FORCE_FLY_THROUGH_WINDSCREEN(ccp0[CN], 1);
  57. WAIT(50);
  58. APPLY_FORCE_TO_PED(ccp0[CN], 1, 0.0, 8.0, 2.0, 0.0, 0.0, 0.0, 1, 1, 1, 1);
  59. }
  60. if (DOES_CHAR_EXIST(ccp1[CN]))
  61. {
  62. SET_PED_FORCE_FLY_THROUGH_WINDSCREEN(ccp1[CN], 1);
  63. WAIT(50);
  64. APPLY_FORCE_TO_PED(ccp1[CN], 1, 0.0, 8.0, 2.0, 0.0, 0.0, 0.0, 1, 1, 1, 1);
  65. }
  66. if (DOES_CHAR_EXIST(ccp2[CN]))
  67. {
  68. SET_PED_FORCE_FLY_THROUGH_WINDSCREEN(ccp2[CN], 1);
  69. WAIT(50);
  70. APPLY_FORCE_TO_PED(ccp2[CN], 1, 0.0, 8.0, 2.0, 0.0, 0.0, 0.0, 1, 1, 1, 1);
  71. }
  72. }
  73. }
  74. }
  75. }
  76.  
  77. void main(void)
  78. {
  79. while(true)
  80. {
  81. WAIT(0);
  82. if (IS_BUTTON_PRESSED(0, L2) && IS_BUTTON_JUST_PRESSED(0, STICK_L))
  83. {
  84. if (EPDActive == 0)
  85. {
  86. EPDActive = 1;
  87. PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Eject Ped Drivers ON", 5000, 1);
  88. }
  89. else
  90. {
  91. EPDActive = 0;
  92. PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Eject Ped Drivers OFF", 5000, 1);
  93. }
  94. }
  95. if (EPDActive == 1)
  96. {
  97. EjectPedDrivers();
  98. }
  99. }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment