Advertisement
Guest User

Army.pwn

a guest
Jun 28th, 2018
1,373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. //Made by lokii.
  2.  
  3. //Credits to SA-MP team for samp, Ziggi for fcnpc and Incognito for streamer.
  4.  
  5. #include <a_samp>
  6. #include <streamer>
  7. #include <fcnpc>
  8.  
  9. static Area51;
  10. static Solider[25];
  11.  
  12. static const Float:Positions[][] =
  13. {
  14. {99.8491,1931.7933,18.2811},
  15. {108.5983,1931.3282,18.6246},
  16. {105.2435,1907.0781,18.4694},
  17. {132.1906,1912.8110,18.8366},
  18. {168.0923,1926.9628,18.4076},
  19. {177.1358,1927.6698,18.1062},
  20. {200.2923,1916.5547,17.6406},
  21. {202.3618,1902.2300,17.6406},
  22. {201.8292,1863.2948,19.9082},
  23. {166.8584,1819.4879,17.6406},
  24. {187.8508,1803.8325,17.6406},
  25. {207.3230,1814.3622,21.8672},
  26. {158.4858,1929.3832,27.8438},
  27. {265.2886,1893.9838,33.8984},
  28. {250.5889,1889.2881,20.6406},
  29. {236.3748,1885.1506,17.6406},
  30. {169.9098,1903.9590,18.4284},
  31. {148.9974,1866.4457,17.7895},
  32. {132.1002,1861.5874,17.7845},
  33. {136.1683,1849.6047,17.6870},
  34. {109.9748,1817.0808,22.9922},
  35. {279.1203,1850.9598,17.6406},
  36. {278.2896,1872.3582,17.6481},
  37. {279.7938,1903.9222,17.6481},
  38. {259.3168,1920.9006,17.6406}
  39. };
  40.  
  41. public OnFilterScriptInit()
  42. {
  43. new string[12];
  44. Area51 = CreateDynamicSphere(189.9946, 1871.6069, 17.6406, 150.0, -1, -1, -1);
  45. for(new i = 0; i < 25; i++)
  46. {
  47. format(string, sizeof(string), "Solider_%i", i);
  48. Solider[i] = FCNPC_Create(string);
  49. FCNPC_Spawn(Solider[i], 287, Positions[i][0], Positions[i][1], Positions[i][2]);
  50. FCNPC_SetInvulnerable(Solider[i], true);
  51. FCNPC_SetWeaponAccuracy(Solider[i], 31, 0.1);
  52. FCNPC_SetWeapon(Solider[i], 31);
  53. FCNPC_SetAmmo(Solider[i], 9999);
  54. }
  55. return 1;
  56. }
  57.  
  58. public OnFilterScriptExit()
  59. {
  60. DestroyDynamicArea(Area51);
  61. for(new i = 0; i < 25; i++)
  62. {
  63. FCNPC_Destroy(Solider[i]);
  64. }
  65. return 1;
  66. }
  67.  
  68. public OnPlayerEnterDynamicArea(playerid, areaid)
  69. {
  70. new player, Float: last = 99999, Float:x, Float:y, Float:z;
  71. if(IsPlayerNPC(playerid)) return 1;
  72. GameTextForPlayer(playerid, "~h~~r~Leave the area!", 3000, 4);
  73. SetPlayerWantedLevel(playerid, 4);
  74. if(areaid == Area51)
  75. {
  76. for(new c = 0; c < 25; c++)
  77. {
  78. for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  79. {
  80. if(!IsPlayerConnected(i)) continue;
  81. FCNPC_GetPosition(Solider[c], x, y, z);
  82. if(IsPlayerNPC(i) || !IsPlayerInRangeOfPoint(i, 150.0, 189.9946, 1871.6069, 17.6406) || GetPlayerDistanceFromPoint(i, x, y, z) > last) continue;
  83. last = GetPlayerDistanceFromPoint(i, x, y, z);
  84. player = i;
  85. }
  86. FCNPC_AimAtPlayer(Solider[c], player, true, -1, true, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  87. }
  88. }
  89. return 1;
  90. }
  91.  
  92. public OnPlayerLeaveDynamicArea(playerid, areaid)
  93. {
  94. new player, Float: last = 99999, Float:x, Float:y, Float:z;
  95. if(IsPlayerNPC(playerid)) return 1;
  96. SetPlayerWantedLevel(playerid, 0);
  97. if(areaid == Area51)
  98. {
  99. for(new c = 0; c < 25; c++)
  100. {
  101. for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  102. {
  103. if(!IsPlayerConnected(i)) continue;
  104. FCNPC_GetPosition(Solider[c], x, y, z);
  105. if(IsPlayerNPC(i) || !IsPlayerInRangeOfPoint(i, 150.0, 189.9946, 1871.6069, 17.6406) || GetPlayerDistanceFromPoint(i, x, y, z) > last) continue;
  106. last = GetPlayerDistanceFromPoint(i, x, y, z);
  107. player = i;
  108. }
  109. FCNPC_AimAtPlayer(Solider[c], player, true, 2000, true, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  110. }
  111. }
  112. return 1;
  113. }
  114.  
  115.  
  116. //EOF.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement