Advertisement
Guest User

Hiddos

a guest
Dec 3rd, 2010
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.49 KB | None | 0 0
  1. #include <mapandreas>
  2.  
  3.  
  4.     //Settings
  5. #if !defined BOMBS
  6.     #define BOMBS 4                     // Amount of bombs in a single load - caution: Can bug up!
  7. #endif
  8.  
  9. #if !defined LOADS
  10.     #define LOADS 3                     // Amount of loads dropped
  11. #endif
  12.  
  13. #if !defined AREA
  14.     #define AREA 45                     // Area of Effect in SA-MP units. Square.
  15. #endif
  16.  
  17. #if !defined MINIMUM_INTERVAL
  18.     #define MINIMUM_INTERVAL 3250       // Minimum interval between loads
  19. #endif
  20.  
  21. #if !defined EXTRA_MAX_INTERVAL
  22.     #define EXTRA_MAX_INTERVAL 550      // 'Additional' interval between dropped bombs
  23. #endif
  24.  
  25. #if !defined EXPLOSION_TYPE
  26.     #define EXPLOSION_TYPE 7           // Type of explosion, check the wiki for lists. Standard 7 = HUGE
  27. #endif
  28.  
  29. #if !defined EXPLOSION_RADIUS
  30.     #define EXPLOSION_RADIUS 8.5        // Explosion radius. I don't really have any effect of it but maybe you do.
  31. #endif
  32.  
  33.     //End
  34.  
  35. forward Airstrike_Init();
  36. public Airstrike_Init()
  37. {
  38.     MapAndreas_Init(2);
  39.     print("IT R LOAD!");
  40. }
  41.  
  42. public OnPlayerDisconnect(playerid, reason)
  43. {
  44.     if(GetPVarInt(playerid, "Airstrike") != 0) KillTimer(GetPVarInt(playerid, "Airstrike") - 1);
  45.     return 1;
  46. }
  47.  
  48. #if defined _ALS_OnPlayerDisconnect
  49.     #undef OnPlayerDisconnect
  50. #else
  51.     #define _ALS_OnPlayerDisconnect
  52. #endif
  53. #define OnPlayerDisconnect AIRHID_OnPlayerDisconnect
  54. forward AIRHID_OnPlayerDisconnect(playerid, reason);
  55.  
  56. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  57. {
  58.     if(GetPVarInt(playerid, "Airstrike") != 0 && newkeys & KEY_FIRE && !(oldkeys & KEY_FIRE))
  59.     {
  60.         new Float:Pos[3];
  61.         Pos[0] = GetPVarFloat(playerid, "CamX");
  62.         Pos[1] = GetPVarFloat(playerid, "CamY");
  63.         Pos[2] = GetPVarFloat(playerid, "CamZ");
  64.         SetTimerEx("SetUpAirstrike", 750, 0, "dffd", playerid, Pos[0], Pos[1], LOADS);
  65.         GameTextForPlayer(playerid, "Airstrike inbound!", 1250, 3);
  66.         KillTimer(GetPVarInt(playerid, "Airstrike") - 1);
  67.         DeletePVar(playerid, "Airstrike");
  68.         DeletePVar(playerid, "CamX");
  69.         DeletePVar(playerid, "CamY");
  70.         DeletePVar(playerid, "CamZ");
  71.     }
  72.     return 1;
  73. }
  74.  
  75. #if defined _ALS_OnPlayerKeyStateChange
  76.     #undef OnPlayerKeyStateChange
  77. #else
  78.     #define _ALS_OnPlayerKeyStateChange
  79. #endif
  80. #define OnPlayerKeyStateChange AIRHID_OnPlayerKeyStateChange
  81. forward AIRHID_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
  82.  
  83. forward OnPlayerAirMapUpdate(playerid);
  84. public OnPlayerAirMapUpdate(playerid)
  85. {
  86.     new Keys[3];
  87.     GetPlayerKeys(playerid, Keys[0], Keys[1], Keys[2]);
  88.    
  89.     new Float:Pos[3];
  90.     Pos[0] = GetPVarFloat(playerid, "CamX");
  91.     Pos[1] = GetPVarFloat(playerid, "CamY");
  92.     Pos[2] = GetPVarFloat(playerid, "CamZ");
  93.     Pos[0] += ((Keys[2] > 0) ? ((Keys[0] & KEY_SPRINT) ? (3.6) : (1.8)) : (Keys[2] < 0) ? ((Keys[0] & KEY_SPRINT) ? (-3.6) : (-1.8)) : (0.0));
  94.     Pos[1] += ((Keys[1] < 0) ? ((Keys[0] & KEY_SPRINT) ? (3.6) : (1.8)) : (Keys[1] > 0) ? ((Keys[0] & KEY_SPRINT) ? (-3.6) : (-1.8)) : (0.0));
  95.     SetPlayerCameraPos(playerid, Pos[0], Pos[1], Pos[2]);
  96.     SetPlayerCameraLookAt(playerid, Pos[0], Pos[1] + 0.01, Pos[2] - 1);
  97.     SetPVarFloat(playerid, "CamX", Pos[0]);
  98.     SetPVarFloat(playerid, "CamY", Pos[1]);
  99.     SetPVarFloat(playerid, "CamZ", Pos[2]);
  100.     return 1;
  101. }
  102.  
  103. stock SetUpPlayerForAirstrike(playerid)
  104. {
  105.     new Float:Pos[3];
  106.     GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  107.     MapAndreas_FindZ_For2DCoord(Pos[0], Pos[1], Pos[2]);
  108.     Pos[2] += 85;
  109.     SetPlayerCameraPos(playerid, Pos[0], Pos[1], Pos[2] + 85);
  110.     SetPlayerCameraLookAt(playerid, Pos[0], Pos[1], Pos[2] - 1);
  111.     TogglePlayerControllable(playerid, 0);
  112.     SetPVarFloat(playerid, "CamX", Pos[0]);
  113.     SetPVarFloat(playerid, "CamY", Pos[1]);
  114.     SetPVarFloat(playerid, "CamZ", Pos[2]);
  115.     SetPVarInt(playerid, "Airstrike", SetTimerEx("OnPlayerAirMapUpdate", 100, 1, "i", playerid) + 1);
  116.     return 1;
  117. }
  118.  
  119. forward SetUpAirstrike(playerid, Float:x, Float:y, load);
  120. public SetUpAirstrike(playerid, Float:x, Float:y, load)
  121. {
  122.     if(!load) return;
  123.     if(load == LOADS)
  124.     {
  125.         SetCameraBehindPlayer(playerid);
  126.         TogglePlayerControllable(playerid, 1);
  127.     }
  128.     for(new b; b < BOMBS; b++)
  129.     {
  130.         SetTimerEx("Bomb", MINIMUM_INTERVAL + random(EXTRA_MAX_INTERVAL), 0, "ff", x, y);
  131.     }
  132.     load--;
  133.     SetTimerEx("SetUpAirstrike", MINIMUM_INTERVAL, 0, "dffd", playerid, x, y, load);
  134. }
  135.  
  136. forward Bomb(Float:x, Float:y);
  137. public Bomb(Float:x, Float:y)
  138. {
  139.     new Float:z;
  140.     x += random(AREA) - floatdiv(AREA, 2);
  141.     y += random(AREA) - floatdiv(AREA, 2);
  142.     MapAndreas_FindZ_For2DCoord(x, y, z);
  143.     CreateExplosion(x, y, z, EXPLOSION_TYPE, EXPLOSION_RADIUS);
  144. }
  145.  
  146. /*
  147. native SetUpPlayerForAirstrike(playerid);
  148. native Airstrike_Init();
  149. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement