Advertisement
Guest User

Stinger

a guest
Aug 27th, 2014
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1.  
  2. //#define FILTERSCRIPT
  3.  
  4. #include <a_samp>
  5. #define MAX_STINGER 10 //You can increase it .
  6. #define white 0xFFFFFFAA
  7. forward PlayerToPoint(Float:radi,playerid,Float:x,Float:y,Float:z);
  8. forward stinger();
  9. forward StopVehicle(playerid);
  10. new sting[MAX_STINGER], Float:Rot[4][MAX_STINGER];
  11.  
  12. #if defined FILTERSCRIPT
  13.  
  14. public OnFilterScriptInit()
  15. {
  16.  
  17. //STINGERS:
  18.  
  19. CreateStinger(0,332.2, 2503.8, 15.8);
  20. CreateStinger(1,332.2+15, 2503.8+15, 15.8);
  21. {
  22. print("\n--------------------------------------");
  23. print(" Blank Filterscript by your name here");
  24. print("--------------------------------------\n");
  25. return 1;
  26. }
  27. print("Stinger script");
  28. SetTimer("stinger",40,1);
  29. MAXPLAYERS = GetMaxPlayers();
  30. public OnFilterScriptExit()
  31. {
  32. return 1;
  33. }
  34.  
  35.  
  36.  
  37. public OnPlayerCommandText(playerid, cmdtext[])
  38. {
  39. if (strcmp("/ts", cmdtext, true, 10) == 0)
  40. {
  41. stock CreateStinger(id,Float:X,Float:Y,Float:Z)
  42. {
  43. sting[id] = CreateObject(1593,X,Y,Z,0,0,0);
  44. GetObjectPos(sting[id],Rot[1][id],Rot[2][id],Rot[3][id]);
  45. return id;
  46. }
  47.  
  48. OnPlayerCrossStinger(playerid,stingerid)
  49. {
  50. if(!IsPlayerInAnyVehicle(playerid)) return false;
  51. PlayerPlaySound(playerid,32000,0,0,0);
  52. SetVehicleToRespawn((GetPlayerVehicleID(playerid)));
  53. GameTextForPlayer(playerid,"~r~Stinger!",5000,5);
  54.  
  55. #pragma unused stingerid
  56.  
  57.  
  58. return true;
  59. }
  60.  
  61.  
  62. public stinger()
  63. {
  64. for(new i = 0; i < MAX_STINGER; i++)
  65. {
  66. for(new pi = 0; pi <MAXPLAYERS; pi++)
  67. {
  68. if(PlayerToPoint(1.2,pi,Rot[1][i],Rot[2][i],Rot[3][i]))
  69. {
  70. OnPlayerCrossStinger(pi,i);
  71. }
  72. }
  73. }
  74. }
  75.  
  76. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  77. {
  78. new Float:oldposx, Float:oldposy, Float:oldposz;
  79. new Float:tempposx, Float:tempposy, Float:tempposz;
  80. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  81. tempposx = (oldposx -x);
  82. tempposy = (oldposy -y);
  83. tempposz = (oldposz -z);
  84. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  85. {
  86. return 1;
  87. }
  88. return 0;
  89. }
  90. return 1;
  91. }
  92. return 0;
  93. }
  94. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement