Advertisement
Lordz

L_SAM2.inc

Jan 2nd, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 15.93 KB | None | 0 0
  1. #if defined FOR_FUCK_SAKE_L_SAM
  2. PLEASE DEFINE FILTERSCRIPT IF YOU ARE USING IT AS A FILTERSCRIPT
  3. I've spent too much time for forgetting that define, I thought my include was
  4. fucked up. But nope, you must define it to use it as a filterscript!
  5. #endif
  6.  
  7. /*______________________________________________________________________________
  8.  
  9.                     L-SAM "Lordz's Surface To Air Missiles" - v1.2
  10.                     Copyright(c) 2014 - L_SAM.inc
  11.                     Author : Lordz™
  12.                     Version : 1.2
  13.                     Thanks to Incognito for Streamer,
  14.                     Thanks to the person who created randomEx,
  15.                         &
  16.            All the players of YoUnG Generations for Testing this!
  17.  
  18. * Happy New Year!
  19.  
  20. //Functions:
  21.  
  22. native CreateSAM(Float:X, Float:Y, Float:Z, Float:rX=0.0, Float:rY=0.0, Float:rZ=0.0, Float:DrawDistance=200.0, Float:Range=300.0, Speed=80, Power=SAM_POWER_NORMAL, bool:follow=false)
  23. native IsSAMMissilesFollowing(samid);
  24. native DestroySAM(samid);
  25. native AvoidSAMAttacksOnPlayer(playerid, samid);
  26. native EnableSAMAttacksOnPlayer(playerid, samid);
  27. native ToggleNoSAMAttacksOnPlayer(playerid, samid, bool:noattack);
  28. native SetSAMMissileSpeed(samid, speed);
  29. native SetSAMMissilePower(samid, Power);
  30. native SetSAMMissileColor(samid, color);
  31. native GetSAMMissileSpeed(samid);
  32. native GetSAMMissilePower(samid);
  33. native GetSAMObjectID(samid);
  34. native GetSAMMissileColor(samid);
  35.  
  36. ChangeLogs:
  37. v1.0 (01/01/2014)
  38. Initial release.
  39.  
  40. v1.2 (02/01/2014)
  41. + The following missile system has been done! Parameter is at the end of CreateSAM.
  42.  Set it to true to allow the SAM to target lock players.
  43. + Added a function called IsSAMMissilesFollowing which returns true in case if SAM
  44.  got following missiles, false if not.
  45. + Missiles can now have colors specified on radar. It's per-sam colors.
  46. + Added two functions called GetSAMMissileColor and SetSAMMissileColor.
  47. _______________________________________________________________________________*/
  48.  
  49. //#define FILTERSCRIPT
  50.  
  51. #if defined _included_l_sam
  52. #endinput
  53. #endif
  54.  
  55. #define _included_l_sam
  56.  
  57. #include <a_samp>
  58.  
  59. //#define USE_STREAMER //Uncomment this line in case if you want to use streamer -
  60.                     // SAM objects.
  61.  
  62. #if defined USE_STREAMER
  63. #include <streamer>
  64. #endif
  65.  
  66. #define MAX_LSAMS 100
  67.  
  68. #define SAM_POWER_LOW    0
  69. #define SAM_POWER_NORMAL 1
  70. #define SAM_POWER_HIGH   2
  71. #define SAM_POWER_BEST   3
  72.  
  73. #define MISSILE_RADAR_COLOR 0x660000FF
  74.  
  75.  
  76.  
  77. enum L_saminfo
  78. {
  79. Float:L_SAMX,
  80. Float:L_SAMY,
  81. Float:L_SAMZ,
  82. Float:L_SAMrX,
  83. Float:L_SAMrY,
  84. Float:L_SAMrZ,
  85. Float:L_SAMDrawDistance,
  86. Float:L_SAMRange,
  87. L_SAMSpeed,
  88. L_SAMPower,
  89. bool:L_SAMFollow,
  90. bool:L_SAMCreated,
  91. L_SAMObjectID,
  92. L_SAMMissileColor,
  93. }
  94.  
  95. new L_SAMData[MAX_LSAMS][L_saminfo];
  96. new L_CountSAMS = 0;
  97. new Float:L_SAMPlayerPos[MAX_PLAYERS][3];
  98. new PlayerMissile[MAX_PLAYERS];
  99. new bool:MissileInProgress[MAX_PLAYERS];
  100. new L_SAMMissileObject[MAX_OBJECTS];
  101. new L_SAMMissilePower[MAX_OBJECTS];
  102. new L_SAMMissileProgress[MAX_OBJECTS];
  103. new L_SAMMissileMarker[MAX_PLAYERS];
  104. new bool:L_SAM_ExceptionalPlayer[MAX_PLAYERS][MAX_LSAMS];
  105.  
  106. new
  107.     L_SAMAssignedSpeed[MAX_OBJECTS],
  108.     bool:L_SAMMissileStopped[MAX_OBJECTS];
  109. #if defined USE_STREAMER
  110. stock CreateStreamedObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, vworld = -1, interiorid = -1, playerid = -1, Float:streamdistance = 300.0, Float:drawdistance = 300.0)
  111. {
  112. new Object_ID = CreateDynamicObject(modelid, X, Y, Z, rX, rY, rZ, vworld, interiorid, playerid, streamdistance);
  113. Streamer_SetFloatData(STREAMER_TYPE_OBJECT, Object_ID, E_STREAMER_DRAW_DISTANCE, drawdistance);
  114. return Object_ID;
  115. }
  116. #endif
  117.  
  118. stock CreateSAM(Float:X, Float:Y, Float:Z, Float:rX=0.0, Float:rY=0.0, Float:rZ=0.0, Float:DrawDistance=200.0, Float:Range=300.0, Speed=80, Power=SAM_POWER_NORMAL, bool:follow=false)
  119. {
  120. if(L_CountSAMS > MAX_LSAMS) return printf("<L_SAM> Error : Couldn't create SAM, maximum SAMS have already been done!"), 0;
  121. new samid = L_CountSAMS;
  122. L_SAMData[samid][L_SAMX] = X;
  123. L_SAMData[samid][L_SAMY] = Y;
  124. L_SAMData[samid][L_SAMZ] = Z;
  125. L_SAMData[samid][L_SAMrX] = rX;
  126. L_SAMData[samid][L_SAMrY] = rY;
  127. L_SAMData[samid][L_SAMrZ] = rZ;
  128. L_SAMData[samid][L_SAMDrawDistance] = DrawDistance;
  129. L_SAMData[samid][L_SAMRange] = Range;
  130. L_SAMData[samid][L_SAMSpeed] = Speed;
  131. if(Power >= SAM_POWER_BEST) L_SAMData[samid][L_SAMPower] = SAM_POWER_BEST;
  132. else if(Power <= SAM_POWER_LOW) L_SAMData[samid][L_SAMPower] = SAM_POWER_LOW;
  133. else L_SAMData[samid][L_SAMPower] = Power;
  134. L_SAMData[samid][L_SAMFollow] = follow;
  135. #if defined USE_STREAMER
  136. L_SAMData[samid][L_SAMObjectID] = CreateStreamedObject(3267, X, Y, Z, rX, rY, rZ, -1, -1, -1, DrawDistance, DrawDistance);
  137. #else
  138. L_SAMData[samid][L_SAMObjectID] = CreateObject(3267, X, Y, Z, rX, rY, rZ, DrawDistance);
  139. #endif
  140. L_SAMData[samid][L_SAMMissileColor] = MISSILE_RADAR_COLOR;
  141. L_SAMData[samid][L_SAMCreated] = true;
  142. L_CountSAMS++;
  143. return samid;
  144. }
  145.  
  146. stock DestroySAM(samid)
  147. {
  148.  if(L_SAMData[samid][L_SAMCreated] == false) return 0;
  149.  L_SAMData[samid][L_SAMX] = 0.0;
  150.  L_SAMData[samid][L_SAMY] = 0.0;
  151.  L_SAMData[samid][L_SAMZ] = 0.0;
  152.  L_SAMData[samid][L_SAMrX] = 0.0;
  153.  L_SAMData[samid][L_SAMrY] = 0.0;
  154.  L_SAMData[samid][L_SAMrZ] = 0.0;
  155.  L_SAMData[samid][L_SAMDrawDistance] = 0.0;
  156.  L_SAMData[samid][L_SAMRange] = 0.0;
  157.  L_SAMData[samid][L_SAMSpeed] = 0;
  158.  L_SAMData[samid][L_SAMPower] = 0;
  159.  L_SAMData[samid][L_SAMFollow] = false;
  160.  L_SAMData[samid][L_SAMCreated] = false;
  161.  DestroyObject(L_SAMData[samid][L_SAMObjectID]);
  162.  L_SAMData[samid][L_SAMObjectID] = -1;
  163.  L_SAMData[samid][L_SAMMissileColor] = MISSILE_RADAR_COLOR;
  164.  return 1;
  165. }
  166.  
  167. #if defined FILTERSCRIPT
  168.  
  169. public OnFilterScriptInit()
  170. {
  171. for(new samid; samid< MAX_LSAMS; samid++)
  172. {
  173.  L_SAMData[samid][L_SAMX] = 0.0;
  174.  L_SAMData[samid][L_SAMY] = 0.0;
  175.  L_SAMData[samid][L_SAMZ] = 0.0;
  176.  L_SAMData[samid][L_SAMrX] = 0.0;
  177.  L_SAMData[samid][L_SAMrY] = 0.0;
  178.  L_SAMData[samid][L_SAMrZ] = 0.0;
  179.  L_SAMData[samid][L_SAMDrawDistance] = 0.0;
  180.  L_SAMData[samid][L_SAMRange] = 0.0;
  181.  L_SAMData[samid][L_SAMSpeed] = 0;
  182.  L_SAMData[samid][L_SAMPower] = 0;
  183.  L_SAMData[samid][L_SAMFollow] = false;
  184.  L_SAMData[samid][L_SAMCreated] = false;
  185.  L_SAMData[samid][L_SAMObjectID] = -1;
  186.  L_SAMData[samid][L_SAMMissileColor] = MISSILE_RADAR_COLOR;
  187.  for(new a; a< MAX_PLAYERS; a++) L_SAM_ExceptionalPlayer[a][samid] = false;
  188. }
  189. for(new i; i< MAX_OBJECTS; i++)
  190. {
  191.  L_SAMMissileObject[i] = 0;
  192.  L_SAMMissilePower[i] = 0;
  193.  L_SAMMissileProgress[i] = -1;
  194. }
  195. for(new i; i< MAX_PLAYERS; i++)
  196. {
  197.  MissileInProgress[i] = false;
  198.  L_SAMPlayerPos[i][0] = 0.0;
  199.  L_SAMPlayerPos[i][1] = 0.0;
  200.  L_SAMPlayerPos[i][2] = 0.0;
  201.  PlayerMissile[i] = -1;
  202. }
  203. L_CountSAMS = 0;
  204. SetTimer("LordzSAMTimer", 2500, true);
  205. CallLocalFunction("L_SAM_OnFS", "");
  206. return 1;
  207. }
  208.  
  209. #if defined _ALS_OnFilterScriptInit
  210. #undef OnFilterScriptInit
  211. #else
  212. #define _ALS_OnFilterScriptInit
  213. #endif
  214.  
  215. public OnFilterScriptExit()
  216. {
  217. #if !defined USE_STREAMER
  218. for(new i; i< MAX_LSAMS; i++)
  219. {
  220.  if(L_SAMData[i][L_SAMCreated])
  221.  {
  222.   DestroyObject(L_SAMData[i][L_SAMObjectID]);
  223.  }
  224. }
  225. #endif
  226. for(new i; i< MAX_OBJECTS; i++)
  227. {
  228.  if(L_SAMMissileProgress[i])
  229.  {
  230.   DestroyObject(i);
  231.  }
  232. }
  233. for(new i; i< MAX_PLAYERS; i++)
  234. {
  235.  if(MissileInProgress[i]) RemovePlayerMapIcon(i, 99);
  236. }
  237. CallLocalFunction("L_SAM_OnFSExit", "");
  238. return 1;
  239. }
  240.  
  241. #if defined _ALS_OnFilterScriptExit
  242. #undef OnFilterScriptExit
  243. #else
  244. #define _ALS_OnFilterScriptExit
  245. #endif
  246.  
  247. forward L_SAM_OnFS();
  248. forward L_SAM_OnFSExit();
  249.  
  250. #else
  251.  
  252. public OnGameModeInit()
  253. {
  254. for(new samid; samid< MAX_LSAMS; samid++)
  255. {
  256.  L_SAMData[samid][L_SAMX] = 0.0;
  257.  L_SAMData[samid][L_SAMY] = 0.0;
  258.  L_SAMData[samid][L_SAMZ] = 0.0;
  259.  L_SAMData[samid][L_SAMrX] = 0.0;
  260.  L_SAMData[samid][L_SAMrY] = 0.0;
  261.  L_SAMData[samid][L_SAMrZ] = 0.0;
  262.  L_SAMData[samid][L_SAMDrawDistance] = 0.0;
  263.  L_SAMData[samid][L_SAMRange] = 0.0;
  264.  L_SAMData[samid][L_SAMSpeed] = 0;
  265.  L_SAMData[samid][L_SAMPower] = 0;
  266.  L_SAMData[samid][L_SAMFollow] = false;
  267.  L_SAMData[samid][L_SAMCreated] = false;
  268.  L_SAMData[samid][L_SAMObjectID] = -1;
  269.  L_SAMData[samid][L_SAMMissileColor] = MISSILE_RADAR_COLOR;
  270.  for(new a; a< MAX_PLAYERS; a++) L_SAM_ExceptionalPlayer[a][samid] = false;
  271. }
  272. for(new i; i< MAX_OBJECTS; i++)
  273. {
  274.  L_SAMMissileObject[i] = 0;
  275.  L_SAMMissilePower[i] = 0;
  276.  L_SAMMissileProgress[i] = -1;
  277. }
  278. for(new i; i< MAX_PLAYERS; i++)
  279. {
  280.  MissileInProgress[i] = false;
  281.  L_SAMPlayerPos[i][0] = 0.0;
  282.  L_SAMPlayerPos[i][1] = 0.0;
  283.  L_SAMPlayerPos[i][2] = 0.0;
  284.  PlayerMissile[i] = -1;
  285. }
  286. L_CountSAMS = 0;
  287. SetTimer("LordzSAMTimer", 2500, true);
  288. CallLocalFunction("L_SAM_OnGM", "");
  289. return 1;
  290. }
  291.  
  292. #if defined _ALS_OnGameModeInit
  293. #undef OnGameModeInit
  294. #else
  295. #define _ALS_OnGameModeInit
  296. #endif
  297.  
  298. forward L_SAM_OnGM();
  299. public OnGameModeExit()
  300. {
  301. #if !defined USE_STREAMER
  302. for(new i; i< MAX_LSAMS; i++)
  303. {
  304.  if(L_SAMData[i][L_SAMCreated])
  305.  {
  306.   DestroyObject(L_SAMData[i][L_SAMObjectID]);
  307.  }
  308. }
  309. #endif
  310. for(new i; i< MAX_OBJECTS; i++)
  311. {
  312.  if(L_SAMMissileProgress[i])
  313.  {
  314.   DestroyObject(i);
  315.  }
  316. }
  317. for(new i; i< MAX_PLAYERS; i++)
  318. {
  319.  if(MissileInProgress[i]) RemovePlayerMapIcon(i, 99);
  320. }
  321. CallLocalFunction("L_SAM_OnGMExit", "");
  322. return 1;
  323. }
  324.  
  325. #if defined _ALS_OnGameModeExit
  326. #undef OnGameModeExit
  327. #else
  328. #define _ALS_OnGameModeExit
  329. #endif
  330. forward L_SAM_OnGMExit();
  331. #endif
  332.  
  333. forward LordzSAMTimer();
  334.  
  335. stock AvoidSAMAttacksOnPlayer(playerid, samid)
  336. {
  337. if(L_SAMData[samid][L_SAMCreated] == false) return -1;
  338. L_SAM_ExceptionalPlayer[playerid][samid] = true;
  339. return 1;
  340. }
  341.  
  342. stock EnableSAMAttacksOnPlayer(playerid, samid)
  343. {
  344. if(L_SAMData[samid][L_SAMCreated] == false) return -1;
  345. L_SAM_ExceptionalPlayer[playerid][samid] = false;
  346. return 1;
  347. }
  348.  
  349. stock ToggleNoSAMAttacksOnPlayer(playerid, samid, bool:noattack)
  350. {
  351. if(L_SAMData[samid][L_SAMCreated] == false) return -1;
  352. L_SAM_ExceptionalPlayer[playerid][samid] = noattack;
  353. return 1;
  354. }
  355.  
  356. stock SetSAMMissileSpeed(samid, speed)
  357. {
  358. if(L_SAMData[samid][L_SAMCreated] == false) return 0;
  359. L_SAMData[samid][L_SAMSpeed] = speed;
  360. return 1;
  361. }
  362.  
  363. stock GetSAMMissileSpeed(samid)
  364. {
  365.  if(L_SAMData[samid][L_SAMCreated] == false) return -1;
  366.  return L_SAMData[samid][L_SAMSpeed];
  367. }
  368.  
  369. stock SetSAMMissilePower(samid, Power)
  370. {
  371. if(L_SAMData[samid][L_SAMCreated] == false) return -1;
  372. if(Power >= SAM_POWER_BEST) L_SAMData[samid][L_SAMPower] = SAM_POWER_BEST;
  373. else if(Power <= SAM_POWER_LOW) L_SAMData[samid][L_SAMPower] = SAM_POWER_LOW;
  374. else L_SAMData[samid][L_SAMPower] = Power;
  375. return Power;
  376. }
  377.  
  378. stock GetSAMMissilePower(samid)
  379. {
  380. if(L_SAMData[samid][L_SAMCreated] == false) return -1;
  381. return L_SAMData[samid][L_SAMPower];
  382. }
  383.  
  384. stock GetSAMObjectID(samid)
  385. {
  386. if(L_SAMData[samid][L_SAMCreated] == false) return -1;
  387. return L_SAMData[samid][L_SAMObjectID];
  388. }
  389.  
  390. stock IsSAMMissilesFollowing(samid)
  391. {
  392. if(L_SAMData[samid][L_SAMCreated] == false) return -1;
  393. if(L_SAMData[samid][L_SAMFollow] == true) return true;
  394. else return false;
  395. }
  396.  
  397. stock SetSAMMissileColor(samid, color)
  398. {
  399. if(L_SAMData[samid][L_SAMCreated] == false) return 0;
  400. L_SAMData[samid][L_SAMMissileColor] = color;
  401. return 1;
  402. }
  403.  
  404. stock GetSAMMissileColor(samid)
  405. {
  406. return L_SAMData[samid][L_SAMMissileColor];
  407. }
  408.  
  409. //Thanks to the person who created the function "randomEx"
  410. stock L_SAMrandomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
  411.  
  412.  
  413. public LordzSAMTimer()
  414. {
  415. for(new i; i< MAX_LSAMS; i++)
  416. {
  417.  if(L_SAMData[i][L_SAMCreated])
  418.  {
  419.   for(new a; a< GetMaxPlayers(); a++)
  420.   {
  421.     if(!IsPlayerConnected(a)) continue;
  422.     if(!IsPlayerInRangeOfPoint(a, L_SAMData[i][L_SAMRange], L_SAMData[i][L_SAMX], L_SAMData[i][L_SAMY], L_SAMData[i][L_SAMZ])) continue;
  423.     if(L_SAM_ExceptionalPlayer[a][i] == true) continue;
  424.     if(MissileInProgress[a] == true) continue;
  425.     GetPlayerPos(a, L_SAMPlayerPos[a][0], L_SAMPlayerPos[a][1], L_SAMPlayerPos[a][2]);
  426.     new p_missileobj = CreateObject(345, L_SAMData[i][L_SAMX], L_SAMData[i][L_SAMY], L_SAMData[i][L_SAMZ], 0.0, 0.0, 0.0, 300.0);
  427.     PlayerMissile[a] = p_missileobj;
  428.     L_SAMMissileObject[p_missileobj] = 1;
  429.     L_SAMMissilePower[p_missileobj] = L_SAMData[i][L_SAMPower];
  430.     L_SAMMissileProgress[p_missileobj] = a;
  431.     MoveObject(p_missileobj, L_SAMPlayerPos[a][0], L_SAMPlayerPos[a][1], L_SAMPlayerPos[a][2], L_SAMData[i][L_SAMSpeed]);
  432.     MissileInProgress[a] = true;
  433.     SetPlayerMapIcon(a, 99, L_SAMData[i][L_SAMX], L_SAMData[i][L_SAMY], L_SAMData[i][L_SAMZ], 0, L_SAMData[i][L_SAMMissileColor]);
  434.     L_SAMMissileMarker[a] = SetTimerEx("L_SAMUpdateMapIcon", 250, true, "ii", a, i);
  435.   }
  436.  }
  437. }
  438. return 1;
  439. }
  440.  
  441.  
  442. forward L_SAMUpdateMapIcon(playerid, samid);
  443. public L_SAMUpdateMapIcon(playerid, samid)
  444. {
  445. if(!MissileInProgress[playerid]) return KillTimer(L_SAMMissileMarker[playerid]);
  446. new Float:X, Float:Y, Float:Z, Float:oX, Float:oY, Float:oZ;
  447. if(L_SAMData[samid][L_SAMFollow] == true)
  448. {
  449.  GetPlayerPos(playerid, X, Y, Z);
  450.  GetObjectPos(PlayerMissile[playerid], oX, oY, oZ);
  451.  if(IsPlayerInRangeOfPoint(playerid, 10.0, oX, oY, oZ))
  452.  {
  453.     L_SAMMissileStopped[PlayerMissile[playerid]] = false;
  454.     return CallLocalFunction("OnObjectMoved", "i", PlayerMissile[playerid]);
  455.  }
  456.  else
  457.  {
  458.   L_SAMMissileStopped[PlayerMissile[playerid]] = true;
  459.   L_SAMAssignedSpeed[PlayerMissile[playerid]] = L_SAMData[samid][L_SAMSpeed]+L_SAMrandomEx(2,20); //Increasing the speed!
  460.   StopObject(PlayerMissile[playerid]);
  461.   MoveObject(PlayerMissile[playerid], X, Y, Z, L_SAMAssignedSpeed[PlayerMissile[playerid]]);
  462.  }
  463. }
  464. GetObjectPos(PlayerMissile[playerid], X, Y, Z);
  465. SetPlayerMapIcon(playerid, 99, X, Y, Z, 0, L_SAMData[samid][L_SAMMissileColor]);
  466. return 1;
  467. }
  468.  
  469. public OnObjectMoved(objectid)
  470. {
  471. if(L_SAMMissileObject[objectid] == 1)
  472. {
  473.  if(L_SAMMissileStopped[objectid] == false)
  474.  {
  475.  new Float:X, Float:Y, Float:Z;
  476.  GetObjectPos(objectid, X, Y, Z);
  477.  switch(L_SAMMissilePower[objectid])
  478.  {
  479.   case 0: CreateExplosion(X+4.0, Y+4.0, Z, 2, 12.0);
  480.   case 1: CreateExplosion(X+4.0, Y+4.0, Z, 7, 12.0);
  481.   case 2:
  482.   {
  483.      CreateExplosion(X+8.0,Y, Z, 7, 10.0);
  484.       CreateExplosion(X-8.0,Y, Z, 7, 10.0);
  485.       CreateExplosion(X, Y+8.0,Z, 7, 10.0);
  486.       CreateExplosion(X, Y-8.0,Z, 7, 10.0);
  487.   }
  488.   case 3:
  489.   {
  490.       new Float:range = 8.0;
  491.      CreateExplosion(X+range,Y, Z, 6, 10.0);
  492.       CreateExplosion(X-range,Y, Z, 6, 10.0);
  493.       CreateExplosion(X, Y+range,Z, 6, 10.0);
  494.       CreateExplosion(X, Y-range,Z, 6, 10.0);
  495.       CreateExplosion(X+range,Y+range,Z, 6, 10.0);
  496.      CreateExplosion(X-range,Y+range,Z, 6, 10.0);
  497.      CreateExplosion(X-range,Y-range,Z, 6, 10.0);
  498.   }
  499.  }
  500.  DestroyObject(objectid);
  501.  RemovePlayerMapIcon(L_SAMMissileProgress[objectid], 99);
  502.  L_SAMMissileObject[objectid] = 0;
  503.  L_SAMMissilePower[objectid] = 0;
  504.  MissileInProgress[L_SAMMissileProgress[objectid]] = false;
  505.  L_SAMMissileProgress[objectid] = -1;
  506.  }
  507. }
  508. CallLocalFunction("L_SAM_OnObjMoved", "i", objectid);
  509. return 1;
  510. }
  511.  
  512. #if defined _ALS_OnObjectMoved
  513. #undef OnObjectMoved
  514. #else
  515. #define _ALS_OnObjectMoved
  516. #endif
  517.  
  518. forward L_SAM_OnObjMoved(objectid);
  519.  
  520. public OnPlayerConnect(playerid)
  521. {
  522. for(new i; i< MAX_LSAMS; i++) L_SAM_ExceptionalPlayer[playerid][i] = false;
  523. CallLocalFunction("L_SAM_OPC", "i", playerid);
  524. return 1;
  525. }
  526.  
  527. #if defined _ALS_OnPlayerConnect
  528. #undef OnPlayerConnect
  529. #else
  530. #define _ALS_OnPlayerConnect
  531. #endif
  532.  
  533. forward L_SAM_OPC(playerid);
  534.  
  535. public OnPlayerSpawn(playerid)
  536. {
  537. if(MissileInProgress[playerid] == true)
  538. {
  539.  L_SAMMissileStopped[PlayerMissile[playerid]] = false;
  540.  CallLocalFunction("OnObjectMoved", "i", PlayerMissile[playerid]);
  541. }
  542. CallLocalFunction("L_SAM_OPS", "i", playerid);
  543. return 1;
  544. }
  545.  
  546. #if defined _ALS_OnPlayerSpawn
  547. #undef OnPlayerSpawn
  548. #else
  549. #define _ALS_OnPlayerSpawn
  550. #endif
  551.  
  552. forward L_SAM_OPS(playerid);
  553.  
  554. #define OnObjectMoved L_SAM_OnObjMoved
  555. #if defined FILTERSCRIPT
  556. #define OnFilterScriptInit L_SAM_OnFS
  557. #define OnFilterScriptExit L_SAM_OnFSExit
  558. #else
  559. #define OnGameModeInit L_SAM_OnGM
  560. #define OnGameModeExit L_SAM_OnGMExit
  561. #endif
  562. #define OnPlayerConnect L_SAM_OPC
  563. #define OnPlayerSpawn L_SAM_OPS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement