LouNGeR

GTA IV Smashing Peds

May 6th, 2011
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. // SMASHING PEDS
  2. // ©2009-2011 LouNGeR
  3.  
  4. // THIS IS NOT A COMPLETE SCRIPT, It's just a code snippet
  5. // showing how to "smash" peds as seen on this video:
  6. // http://www.youtube.com/watch?v=XJjhQxQ_Hr0
  7.  
  8.  
  9. #define IsNull(x) (x.Handle == 0)
  10.  
  11. Player LouNGeRClass::PlayerIndex() {
  12.     return ConvertIntToPlayerIndex(GetPlayerId());
  13. }
  14.  
  15. Ped LouNGeRClass::PlayerChar() {
  16.     Ped p;
  17.     GetPlayerChar(PlayerIndex(), &p);
  18.     return p;
  19. }
  20.  
  21. bool LouNGeRClass::IsPedReady(Ped p) {
  22.     return (!IsNull(p) && !IsCharDead(p));
  23. }
  24.  
  25. void LouNGeRClass::ClosePedTest() {
  26.     Ped p = PlayerChar();
  27.     Ped closePed;
  28.     f32 x, y, z;
  29.  
  30.     GetCharCoordinates(p, &x, &y, &z);
  31.     GetClosestChar(x, y, z, 20.0, true, true, &closePed);
  32.  
  33.     if(IsCharVisible(closePed) && IsPedReady(closePed)) {
  34.         SmashPed(closePed);
  35.     }
  36. }
  37.  
  38. void LouNGeRClass::SmashPed(Ped p) {
  39.     ApplyForceToPed(p, 1, 0.0, 0.0, 15.0, 0.0, 0.0, 0.0, 7, 1, 1, 1);   // Up
  40.     m_pThread->Wait(250);
  41.     ApplyForceToPed(p, 1, 0.0, 0.0, -150.0, 0.0, 0.0, 0.0, 7, 1, 1, 1); // Down
  42. }
Advertisement
Add Comment
Please, Sign In to add comment