Advertisement
Guest User

Fuja dos Tubarões v2.0

a guest
Jul 18th, 2012
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.69 KB | None | 0 0
  1. // FilterScript Criado por [S]trong, obrigado a LucifeR pelo SetObjectToFaceCords
  2. // Agradecimentos a [iPs] TeaM
  3. // Mapa do tubarão feito por Vinicius e Papai_Smurf!
  4. // teleporte feito por vinicius e tubarões adicionado por vinicius!
  5. // Não retire os creditos!
  6.  
  7. #include <a_samp>
  8.  
  9. #define MIN_RANGE_ATTACK 4.0
  10. #define MIN_SHARK_RANGE 40.0
  11.  
  12. new
  13. Float:SharkPlaces[][] =
  14. {
  15. {688.4228, -2163.0522, -0.7187},
  16. {3971.0630,-2135.6909,-1.0000,185.7436},
  17. {3967.5725,-2139.8162,-0.0947,68.6186},
  18. {3966.7112,-2139.4788,-1.0000,68.6186},
  19. {3963.0762,-2136.5352,-0.9089,48.2935},
  20. {3961.8062,-2138.9031,0.2535,155.9140},
  21. {3959.3738,-2141.8362,-0.8218,129.0089},
  22. {3955.9329,-2140.7336,-1.0000,48.5859},
  23. {3954.4128,-2138.0510,-0.2787,39.8125},
  24. {3951.9861,-2137.4463,0.2818,85.1418},
  25. {3949.3225,-2139.6624,-0.9912,148.1642},
  26. {3945.3098,-2141.0381,-1.0000,101.2264},
  27. {3944.7185,-2139.5669,0.0983,14.3696},
  28. {3941.9624,-2137.3093,0.0119,70.3732},
  29. {3939.1084,-2139.1599,-1.0000,133.2494},
  30. {3935.2412,-2142.7988,-0.6166,133.2494},
  31. {3933.4861,-2141.0671,0.3489,32.3551},
  32. {3932.7402,-2139.8938,-0.0396,32.3551},
  33. {3931.9661,-2138.6719,-1.0000,32.3551},
  34. {3930.9316,-2137.0386,-1.0000,32.3551},
  35. {3930.8362,-2136.8879,-0.3928,32.3551},
  36. {3930.0271,-2135.6108,0.1781,32.3551},
  37. {3928.3220,-2136.1113,-0.5454,151.3811},
  38. {3928.0623,-2136.5813,-1.0000,151.3811},
  39. {3928.0623,-2136.5813,-1.0000,151.3811},
  40. {3925.9822,-2140.4084,0.3040,151.5273},
  41. {3924.3433,-2140.7703,-0.1933,38.9352},
  42. {3922.7427,-2138.8071,-0.9143,38.9352},
  43. {3922.2639,-2138.2141,-1.0000,38.9352},
  44. {3919.0552,-2138.8503,-0.4501,113.6554},
  45. {3918.9719,-2138.8870,0.0673,113.6554},
  46. {3917.7012,-2140.6907,-0.2004,144.9473},
  47. {3915.5920,-2142.3196,-1.0000,114.6790},
  48. {3914.1799,-2140.5054,-0.2285,20.3648},
  49. {3913.0483,-2139.2590,0.2244,43.7606},
  50. {3910.4092,-2138.7168,-0.6811,101.3726},
  51. {3908.0701,-2139.6267,-1.0000,119.0657},
  52. {3906.0962,-2140.5940,-0.1483,100.7878},
  53. {3903.7070,-2139.5791,-0.3901,64.6705},
  54. {3901.9453,-2138.7449,-1.0000,64.6705},
  55. {3901.9453,-2138.7449,-1.0000,64.6705},
  56. {3898.9299,-2138.1150,-0.0763,87.1890},
  57. {3897.7295,-2138.0864,0.0272,145.3859},
  58. {3895.7380,-2138.8293,-0.8908,109.5612},
  59. {3893.7148,-2141.0625,-0.8452,145.9708},
  60. {3892.6980,-2140.9282,0.2811,82.5098},
  61. {3891.4446,-2140.7610,-0.0837,82.0711},
  62. {3890.1812,-2140.5847,-0.8918,82.0711},
  63. {3890.8518,-2138.6194,-1.0000,330.3563},
  64. {3889.0334,-2137.8364,0.0244,69.4959},
  65. {3888.1350,-2138.0356,-0.2119,178.5787},
  66. {3887.4448,-2137.5913,-1.0000,55.1660},
  67. {3885.2266,-2137.9751,-0.8625,100.1660},
  68. {3885.2266,-2137.9751,-0.0408,55.1660},
  69. {3883.8542,-2138.7854,-0.1790,123.7449},
  70. {3881.9385,-2139.7813,-1.0000,109.8536},
  71. {3878.9766,-2140.8518,-1.0000,109.8536},
  72. {3878.9766,-2140.8518,-1.0000,78.5618},
  73. {3877.8333,-2140.6204,-0.9166,78.5618},
  74. {3875.9006,-2139.6914,0.1551,64.0857},
  75. {3875.0967,-2138.5242,-0.7204,7.4971},
  76. {3873.2004,-2137.0647,-0.9001,51.9491},
  77. {3871.5562,-2136.5913,0.1058,173.3147},
  78. {3871.4910,-2137.1533,-0.7093,173.3147},
  79. {837.7982,-2123.5688,-0.8022,315.1072},
  80. {859.9446,-2111.3884,0.1280,299.7538},
  81. {867.0594,-2082.5313,-0.0458,343.0361},
  82. {639.5123, -2155.1782, -0.6878}
  83. },
  84. Shark[sizeof SharkPlaces],
  85. Hunting[sizeof SharkPlaces]
  86. ;
  87.  
  88. ToFace(playerid, id);
  89.  
  90. public OnFilterScriptInit() {
  91.  
  92. for (new ii = 0; ii != sizeof SharkPlaces; ++ii) {
  93. Shark[ii] = CreateObject(1608, SharkPlaces[ii][0], SharkPlaces[ii][1], SharkPlaces[ii][2], 0.0, 0.0, 80.0, 300.0);
  94. }
  95.  
  96. return 1;
  97. }
  98.  
  99. public ToFace(playerid, id) {
  100.  
  101. new
  102. Float: h,
  103. Float: x,
  104. Float: y,
  105. Float: z,
  106. anim = GetPlayerAnimationIndex(playerid);
  107.  
  108. if (!(anim == 1543 || anim == 1538 || anim == 1539)) {
  109. goto Finish;
  110. }
  111.  
  112. GetPlayerHealth(playerid, h);
  113.  
  114. if (h <= 0.0) {
  115. goto Finish;
  116. }
  117.  
  118. GetObjectPos(Shark[id], x, y, z);
  119.  
  120. if (IsPlayerInRangeOfPoint(playerid, MIN_RANGE_ATTACK, x, y, z)) {
  121.  
  122. SetPlayerHealth(playerid, h - 10);
  123.  
  124. GetPlayerPos(playerid, x, y, z);
  125. SetObjectToFaceCords(Shark[id], x, y, z);
  126.  
  127. Hunting[id] = gettime() + 5;
  128.  
  129. SetTimerEx("ToFace", 1500, 0, "ii", playerid, id);
  130. return SendClientMessage(playerid, 0xFF0000FF, "| AVISO | Você foi mordido por um tubarão, fuja rápido!");
  131. }
  132.  
  133. if (!IsPlayerInRangeOfPoint(playerid, MIN_SHARK_RANGE, SharkPlaces[id][0], SharkPlaces[id][1], SharkPlaces[id][2])) {
  134.  
  135. Finish:
  136.  
  137. Hunting[id] = 0;
  138. MoveObject(Shark[id], SharkPlaces[id][0], SharkPlaces[id][1], SharkPlaces[id][2], 2.5);
  139. }
  140.  
  141. else {
  142.  
  143. new
  144. time;
  145.  
  146. GetPlayerPos(playerid, x, y, z);
  147. time = MoveObject(Shark[id], x, y, z, 2.5);
  148.  
  149. SetTimerEx("ToFace", time + 10, 0, "ii", playerid, id);
  150. Hunting[id] = gettime() + time + 5;
  151. }
  152.  
  153. return 1;
  154. }
  155.  
  156. public OnPlayerUpdate(playerid) {
  157.  
  158. new
  159. anim = GetPlayerAnimationIndex(playerid);
  160.  
  161. if ((anim == 1543 || anim == 1538 || anim == 1539)) {
  162.  
  163. for (new ii = 0; ii != sizeof SharkPlaces; ++ii) {
  164.  
  165. if (gettime() > Hunting[ii] && IsPlayerInRangeOfPoint(playerid, MIN_SHARK_RANGE, SharkPlaces[ii][0], SharkPlaces[ii][1], SharkPlaces[ii][2])) {
  166.  
  167. new
  168. time,
  169. Float: x,
  170. Float: y,
  171. Float: z;
  172.  
  173. GetPlayerPos(playerid, x, y, z);
  174. time = MoveObject(Shark[ii], x, y, z, 2.5);
  175.  
  176. Hunting[ii] = gettime() + time + 5;
  177. SetTimerEx("ToFace", time + 10, 0, "ii", playerid, ii);
  178. }
  179. }
  180. }
  181.  
  182. return 1;
  183. }
  184.  
  185. SetObjectToFaceCords(objectid, Float:x1,Float:y1,Float:z1) {
  186.  
  187. // SetObjectToFaceCords() By LucifeR //
  188. // LucifeR@vgames.co.il //
  189.  
  190. // setting the objects cords
  191. new Float:x2,Float:y2,Float:z2;
  192. GetObjectPos(objectid, x2,y2,z2);
  193.  
  194. // setting the distance values
  195. new Float:DX = floatabs(x2-x1);
  196. new Float:DY = floatabs(y2-y1);
  197. new Float:DZ = floatabs(z2-z1);
  198.  
  199. // defining the angles and setting them to 0
  200. new Float:yaw = 0;
  201. new Float:pitch = 0;
  202.  
  203. // check that there isnt any 0 in one of the distances,
  204. // if there is any use the given parameters:
  205. if(DY == 0 || DX == 0) {
  206. if(DY == 0 && DX > 0) {
  207. yaw = 00;
  208. pitch = 0;
  209. }
  210. else if(DY == 0 && DX < 0) {
  211. yaw = 180;
  212. pitch = 180;
  213. }
  214. else if(DY > 0 && DX == 0) {
  215. yaw = 90;
  216. pitch = 90;
  217. }
  218. else if(DY < 0 && DX == 0) {
  219. yaw = 270;
  220. pitch = 270;
  221. }
  222. else if(DY == 0 && DX == 0) {
  223. yaw = 0;
  224. pitch = 0;
  225. }
  226. }
  227. // calculating the angale using atan
  228. else { // non of the distances is 0.
  229. // calculatin the angles
  230. yaw = atan(DX/DY);
  231. pitch = atan(floatsqroot(DX*DX + DZ*DZ) / DY);
  232. // there are three quarters in a circle, now i will
  233. // check wich circle this is and change the angles
  234. // according to it.
  235. if(x1 > x2 && y1 <= y2) {
  236. yaw = yaw + 90;
  237. pitch = pitch - 45;
  238. }
  239. else if(x1 <= x2 && y1 < y2) {
  240. yaw = 90 - yaw;
  241. pitch = pitch - 45;
  242. }
  243. else if(x1 < x2 && y1 >= y2) {
  244. yaw = yaw - 90;
  245. pitch = pitch - 45;
  246. }
  247. else if(x1 >= x2 && y1 > y2) {
  248. yaw = 270 - yaw;
  249. pitch = pitch + 315;
  250. }
  251.  
  252. // the pitch could be only in two quarters, lets see wich one:
  253. if(z1 < z2)
  254. pitch = 360-pitch;
  255. }
  256. // setting the object rotation (should be twice cuz of lame GTA rotation system)
  257. SetObjectRot(objectid, 0, 0, yaw);
  258. SetObjectRot(objectid, 0, pitch, yaw+90);
  259. }
  260.  
  261. public OnGameModeInit()
  262. {
  263. // Mapa de Tubarões feito por Papai_Smurf e Arthenry
  264. CreateObject(8150,3930.50097656,-2130.20434570,0.00000000,0.00000000,0.00000000,0.00000000); //object(vgsselecfence04) (1)
  265. CreateObject(8150,3932.21801758,-2148.92822266,0.00000000,0.00000000,0.00000000,0.00000000); //object(vgsselecfence04) (2)
  266. CreateObject(4867,3982.54931641,-2148.65087891,-2.00000000,0.00000000,0.00000000,0.00000000); //object(lasrnway3_las) (1)
  267. CreateObject(3524,3867.69799805,-2129.78442383,3.13534021,0.00000000,0.00000000,268.00000000); //object(skullpillar01_lvs) (1)
  268. CreateObject(3524,3869.26489258,-2148.62402344,3.13534021,0.00000000,0.00000000,267.99499512); //object(skullpillar01_lvs) (2)
  269. CreateObject(9131,3886.02758789,-2118.49829102,0.00000000,0.00000000,0.00000000,0.00000000); //object(shbbyhswall13_lvs) (1)
  270. CreateObject(3816,3839.82055664,-2136.84716797,8.75000000,0.00000000,0.00000000,86.00000000); //object(bighangar1_sfx) (1)
  271. CreateObject(10282,3864.93017578,-2117.37768555,1.38542843,0.00000000,0.00000000,0.00000000); //object(mich_int_sfe) (1)
  272. CreateObject(11391,3814.38378906,-2132.32177734,1.66879320,0.00000000,0.00000000,0.00000000); //object(hubprops6_sfse) (1)
  273. CreateObject(14826,3815.38232422,-2160.23413086,1.13769269,0.00000000,0.00000000,0.00000000); //object(int_kbsgarage2) (1)
  274. CreateObject(14826,3815.26928711,-2155.33813477,0.99667382,0.00000000,0.00000000,0.00000000); //object(int_kbsgarage2) (2)
  275. CreateObject(14826,3815.39916992,-2150.08618164,0.99667382,0.00000000,0.00000000,0.00000000); //object(int_kbsgarage2) (3)
  276. CreateObject(3066,3863.67260742,-2161.15527344,1.28083873,0.00000000,0.00000000,0.00000000); //object(ammotrn_obj) (1)
  277. CreateObject(3066,3859.64916992,-2160.91625977,1.28083873,0.00000000,0.00000000,0.00000000); //object(ammotrn_obj) (2)
  278. CreateObject(3066,3855.06860352,-2160.71582031,1.28083873,0.00000000,0.00000000,0.00000000); //object(ammotrn_obj) (3)
  279. CreateObject(18257,3849.90380859,-2160.25122070,0.23229599,0.00000000,0.00000000,0.00000000); //object(crates) (1)
  280. CreateObject(925,3838.65454102,-2161.82617188,1.28846753,0.00000000,0.00000000,0.00000000); //object(rack2) (1)
  281. CreateObject(925,3833.72265625,-2162.63793945,1.28846753,0.00000000,0.00000000,0.00000000); //object(rack2) (2)
  282. CreateObject(930,3830.78881836,-2161.82836914,0.70243800,0.00000000,0.00000000,358.00000000); //object(o2_bottles) (1)
  283. CreateObject(930,3829.18432617,-2163.15869141,0.70243800,0.00000000,0.00000000,357.99499512); //object(o2_bottles) (2)
  284. CreateObject(930,3826.96679688,-2162.21850586,0.70243800,0.00000000,0.00000000,357.99499512); //object(o2_bottles) (3)
  285. CreateObject(2669,3815.95800781,-2143.95336914,1.57256794,0.00000000,0.00000000,84.00000000); //object(cj_chris_crate) (1)
  286. CreateObject(2678,3860.51171875,-2145.32543945,1.31078768,0.00000000,0.00000000,0.00000000); //object(cj_chris_crate_ld) (1)
  287. CreateObject(10814,3814.07153320,-2249.39965820,0.00000000,0.00000000,0.00000000,0.00000000); //object(apfuel2_sfse) (1)
  288. CreateObject(2933,3884.49218750,-2144.55566406,-0.75000000,0.00000000,0.00000000,265.99548340); //object(pol_comp_gate) (3)
  289. CreateObject(2933,3868.92773438,-2125.75341797,1.46782756,0.00000000,0.00000000,268.00000000); //object(pol_comp_gate) (4)
  290. CreateObject(2933,3869.00610352,-2152.36840820,1.50000000,0.00000000,0.00000000,52.00000000); //object(pol_comp_gate) (5)
  291. CreateObject(2933,3903.41308594,-2134.54980469,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (6)
  292. CreateObject(1337,3812.19067383,-2093.92797852,12.71217251,0.00000000,0.00000000,0.00000000); //object(binnt07_la) (1)
  293. CreateObject(2933,3920.80004883,-2144.19995117,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  294. CreateObject(2933,3940.31030273,-2144.28613281,0.06815720,0.00000000,0.00000000,273.99902344); //object(pol_comp_gate) (14)
  295. CreateObject(2933,3957.51171875,-2134.74023438,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (15)
  296. CreateObject(2933,3975.05371094,-2143.58496094,0.00000000,0.00000000,0.00000000,267.99499512); //object(pol_comp_gate) (19)
  297. CreateObject(8171,3995.40649414,-2143.91894531,1.25000000,0.00000000,0.00000000,0.00000000); //object(vgssairportland06) (1)
  298. CreateObject(993,4002.08032227,-2131.96777344,0.00000000,0.00000000,0.00000000,0.00000000); //object(bar_barrier10) (1)
  299. CreateObject(2098,4079.61669922,-2126.43408203,23.87342453,0.00000000,0.00000000,0.00000000); //object(cj_slotcover1) (1)
  300. CreateObject(3550,4114.07812500,-2054.04199219,61.90873337,0.00000000,0.00000000,0.00000000); //object(vgsn_fncelec_msh) (1)
  301. CreateObject(16782,3838.12768555,-2109.60742188,1.41971159,0.00000000,0.00000000,268.00000000); //object(a51_radar_scan) (1)
  302. CreateObject(2933,3968.30004883,-2134.10009766,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (15)
  303. CreateObject(2933,3963.60009766,-2143.30004883,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (15)
  304. CreateObject(2933,3952.00000000,-2143.80004883,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (15)
  305. CreateObject(2933,3946.50000000,-2134.80004883,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (15)
  306. CreateObject(2933,3934.19995117,-2134.39990234,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (15)
  307. CreateObject(2933,3928.50000000,-2142.30004883,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  308. CreateObject(2933,3924.39990234,-2135.39990234,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  309. CreateObject(2933,3915.89990234,-2135.30004883,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  310. CreateObject(2933,3910.10009766,-2143.60009766,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  311. CreateObject(2933,3897.69995117,-2143.00000000,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  312. CreateObject(2933,3893.30004883,-2134.50000000,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  313. CreateObject(2933,3879.60009766,-2135.10009766,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  314. CreateObject(2933,3873.10009766,-2141.89990234,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  315. CreateObject(2933,3868.00000000,-2135.60009766,0.00000000,0.00000000,0.00000000,270.00000000); //object(pol_comp_gate) (10)
  316. }
  317.  
  318. public OnPlayerCommandText(playerid,cmdtext[])
  319. {
  320. if (strcmp("/tubarao", cmdtext, true, 10) == 0)
  321. {
  322. SetPlayerPos(playerid,3971.0630,-2135.6909,-1.0000,185.7436);
  323. GameTextForPlayer(playerid,"~b~Fuja dos Tubaroes",4000,0);
  324. return 1;
  325. }
  326. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement