Advertisement
iPLEOMAX

iVE - Vehicle Explosion Physics

Aug 15th, 2011
1,455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.92 KB | None | 0 0
  1. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
  2. /* iVE: Vehicle Death/Explosion Physics */
  3. /* by iPLEOMAX, 2011                    */
  4. /* Please keep the credits!             */
  5. /* Simple yet nice to see.. :D      */
  6. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
  7.  
  8. #include <a_samp>
  9.  
  10. // Tweak your own..
  11. #define EFFECT_RANDOM           20
  12. #define EFFECT_FIX_DEFAULT      10
  13. #define EFFECT_FIX_Z            0.008
  14. #define EFFECT_MULTIPLIER       0.05
  15. #define EFFECT_HELI_VEL         0.1
  16. #define EFFECT_EXPLOSIONTYPE    1
  17. #define EFFECT_EXPLOSIONOFFSET  -1.2
  18. #define EFFECT_EXPLOSIONRADIUS  2.5
  19.  
  20. //Model IDs for Vehicles
  21. #define PLANES 460,476,511,512,513,519,520,553,577,592,593
  22. #define HELIS 417,425,447,469,488,497,548,563
  23.  
  24. public OnFilterScriptInit()
  25. {
  26.     printf("  iVE: Vehicle Explosion Physics Loaded! -iPLEOMAX");
  27.     return true;
  28. }
  29.  
  30. public OnFilterScriptExit()
  31. {
  32.     printf("  iVE: Vehicle Explosion Physics Exited.");
  33.     return true;
  34. }
  35.  
  36. public OnPlayerStateChange(playerid, newstate, oldstate)
  37. {
  38.     return true;
  39. }
  40.  
  41. public OnVehicleDeath(vehicleid, killerid)
  42. {
  43.     new Float:P[3]; GetVehiclePos(vehicleid, P[0], P[1], P[2]);
  44.     if(P[2] <= 0.4) return true; //Water Exception.. (added later)
  45.  
  46.     new model = GetVehicleModel(vehicleid);
  47.     switch(model)
  48.     {
  49.         case PLANES: return true;
  50.         case HELIS: return true;
  51.         default:
  52.         {
  53.             new
  54.                 ht = random(EFFECT_RANDOM),
  55.                 xang = random(EFFECT_RANDOM)-EFFECT_FIX_DEFAULT,
  56.                 yang = random(EFFECT_RANDOM)-EFFECT_FIX_DEFAULT,
  57.                 zang = random(EFFECT_RANDOM)
  58.             ;
  59.             GetVehiclePos(vehicleid, P[0], P[1], P[2]);
  60.             CreateExplosion(P[0], P[1], P[2]+EFFECT_EXPLOSIONOFFSET, EFFECT_EXPLOSIONTYPE, EFFECT_EXPLOSIONRADIUS);
  61.             SetVehicleAngularVelocity(vehicleid, xang*EFFECT_MULTIPLIER, yang*EFFECT_MULTIPLIER, zang*EFFECT_FIX_Z);
  62.             GetVehicleVelocity(vehicleid, P[0], P[1], P[2]);
  63.             SetVehicleVelocity(vehicleid, P[0], P[1], P[2] + (ht*EFFECT_FIX_Z) );
  64.         }
  65.     }
  66.     return true;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement