Advertisement
Guest User

Untitled

a guest
Jan 19th, 2008
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.09 KB | None | 0 0
  1. /* This script was made by WeeDarr thanks to the ideas of this thread:
  2. http://forum.sa-mp.com/index.php?topic=37951.0
  3. You are not permitted to change anything other that the four defines below
  4. if you use this you must also add me in to your credits list. If you are found
  5. taking credit for it I will simply delete the files so nobody can download, so
  6. you ruin it for others...
  7. Anyway i hope you have fun with the script, if you find any errors or bugs please
  8. report them at the official topic on the sa-mp forums. WeeDarr & thanks to denver?
  9. for the PlayerToPoint function.
  10.  
  11. Last note, if you have teleport commands and you do not what the person to get
  12. the minigun out of the minigun zone please remember to remove the minigun from the
  13. player, i may add this in future versions, wait and see. I may also add support for multiple miniguns
  14. */
  15.  
  16. #include <a_samp>
  17. new minigun1,minigun2,minigun3,minigun4,minigun5;
  18. new timer;
  19. new weapons[13][2];
  20. new gunid[MAX_PLAYERS];
  21. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  22. forward mini(playerid);
  23.  
  24. /* A Tip:
  25. If saving minigun positions on foot set the Z cordinate 1 lower, e.g i got the cord 9.2578 change it
  26. to 8.2578 and the minigun should be on the floor.
  27. */
  28.  
  29. // Minigun 1
  30. #define GUN1 true
  31. #define X1,Y1,Z1 1962.9644,1358.7168,8.2578
  32. #define RX1,RY1,RZ1 0.0,0.0,359.1342
  33. // Minigun 2
  34. #define GUN2 true
  35. #define X2,Y2,Z2 1962.8313,1330.7249,8.2501
  36. #define RX2,RY2,RZ2 0.0,0.0,183.3760
  37. // Minigun 3
  38. #define GUN3 false
  39. #define X3,Y3,Z3 0.0,0.0,0.0
  40. #define RX3,RY3,RZ3 0.0,0.0,0.0
  41. // Minigun 4
  42. #define GUN4 false
  43. #define X4,Y4,Z4 0.0,0.0,0.0
  44. #define RX4,RY4,RZ4 0.0,0.0,0.0
  45. // Minigun 5
  46. #define GUN5 false
  47. #define X5,Y5,Z5 0.0,0.0,0.0
  48. #define RX5,RY5,RZ5 0.0,0.0,0.0
  49. // Other defines
  50. #define DISTANCE 3.0 // the distance for playertopoint
  51. #define AMMO 500 // the amount of ammo for the minigun
  52.  
  53. // Do NOT change anything except the things marked with this: // you can change this line
  54.  
  55. #define FILTERSCRIPT
  56. #if defined FILTERSCRIPT
  57.  
  58. public OnFilterScriptInit()
  59. {
  60. print("\n--------------------------------------");
  61. print(" Minigun FS by WeeDarr [2008] LOADED");
  62. print("--------------------------------------\n");
  63. return 1;
  64. }
  65.  
  66. public OnFilterScriptExit()
  67. {
  68. print("\n--------------------------------------");
  69. print(" Minigun FS by WeeDarr [2008] UNLOADED");
  70. print("--------------------------------------\n");
  71. return 1;
  72. }
  73.  
  74. #else
  75.  
  76. #endif
  77.  
  78. public OnGameModeInit()
  79. {
  80. // Don't use these lines if it's a filterscript
  81. SetGameModeText("Blank Script");
  82. #if GUN1 == true
  83. minigun1 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
  84. #endif
  85. #if GUN2 == true
  86. minigun2 = CreateObject(2985,X2,Y2,Z2,RX2,RY2,RZ2);
  87. #endif
  88. #if GUN3 == true
  89. minigun3 = CreateObject(2985,X3,Y3,Z3,RX3,RY3,RZ3);
  90. #endif
  91. #if GUN4 == true
  92. minigun4 = CreateObject(2985,X4,Y4,Z4,RX4,RY4,RZ4);
  93. #endif
  94. #if GUN5 == true
  95. minigun5 = CreateObject(2985,X5,Y5,Z5,RX5,RY5,RZ5);
  96. #endif
  97. return 1;
  98. }
  99.  
  100. public OnPlayerCommandText(playerid, cmdtext[])
  101. {
  102. if (strcmp("/usegun", cmdtext, true, 7) == 0) // you can change this line
  103. {
  104. if(PlayerToPoint(DISTANCE,playerid,X1,Y1,Z1))
  105. {
  106. DestroyObject(minigun1);
  107. timer = SetTimerEx("mini",500,1,"i",playerid);
  108. for (new i = 0; i < 13; i++)
  109. {
  110. GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
  111. }
  112. ResetPlayerWeapons(playerid);
  113. GivePlayerWeapon(playerid,38,AMMO);
  114. gunid[playerid]=1;
  115. }
  116.  
  117. else if(PlayerToPoint(DISTANCE,playerid,X2,Y2,Z2))
  118. {
  119. DestroyObject(minigun2);
  120. timer = SetTimerEx("mini",500,1,"i",playerid);
  121. for (new i = 0; i < 13; i++)
  122. {
  123. GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
  124. }
  125. ResetPlayerWeapons(playerid);
  126. GivePlayerWeapon(playerid,38,AMMO);
  127. gunid[playerid]=2;
  128. }
  129.  
  130. else if(PlayerToPoint(DISTANCE,playerid,X3,Y3,Z3))
  131. {
  132. DestroyObject(minigun3);
  133. timer = SetTimerEx("mini",500,1,"i",playerid);
  134. for (new i = 0; i < 13; i++)
  135. {
  136. GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
  137. }
  138. ResetPlayerWeapons(playerid);
  139. GivePlayerWeapon(playerid,38,AMMO);
  140. gunid[playerid]=3;
  141. }
  142.  
  143. else if(PlayerToPoint(DISTANCE,playerid,X4,Y4,Z4))
  144. {
  145. DestroyObject(minigun4);
  146. timer = SetTimerEx("mini",500,1,"i",playerid);
  147. for (new i = 0; i < 13; i++)
  148. {
  149. GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
  150. }
  151. ResetPlayerWeapons(playerid);
  152. GivePlayerWeapon(playerid,38,AMMO);
  153. gunid[playerid]=4;
  154. }
  155.  
  156. else if(PlayerToPoint(DISTANCE,playerid,X5,Y5,Z5))
  157. {
  158. DestroyObject(minigun5);
  159. timer = SetTimerEx("mini",500,1,"i",playerid);
  160. for (new i = 0; i < 13; i++)
  161. {
  162. GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
  163. }
  164. ResetPlayerWeapons(playerid);
  165. GivePlayerWeapon(playerid,38,AMMO);
  166. gunid[playerid]=5;
  167. }
  168. return 1;
  169. }
  170.  
  171. if (strcmp("/exitgun", cmdtext, true, 5) == 0) // you can change this line
  172. {
  173. if(gunid[playerid] == 0)
  174. {
  175. SendClientMessage(playerid,0xFFFFFFFF,"what gun?"); // you can change this message or delete it
  176. }
  177.  
  178. else if(gunid[playerid] == 1)
  179. {
  180. KillTimer(timer);
  181. minigun1 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
  182. ResetPlayerWeapons(playerid);
  183. gunid[playerid]=0;
  184. for (new i = 0; i < 13; i++)
  185. {
  186. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  187. }
  188. }
  189.  
  190. else if(gunid[playerid] == 2)
  191. {
  192. KillTimer(timer);
  193. minigun2 = CreateObject(2985,X2,Y2,Z2,RX2,RY2,RZ2);
  194. ResetPlayerWeapons(playerid);
  195. gunid[playerid]=0;
  196. for (new i = 0; i < 13; i++)
  197. {
  198. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  199. }
  200. }
  201.  
  202. else if(gunid[playerid] == 3)
  203. {
  204. KillTimer(timer);
  205. minigun3 = CreateObject(2985,X3,Y3,Z3,RX3,RY3,RZ3);
  206. ResetPlayerWeapons(playerid);
  207. gunid[playerid]=0;
  208. for (new i = 0; i < 13; i++)
  209. {
  210. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  211. }
  212. }
  213.  
  214. else if(gunid[playerid] == 4)
  215. {
  216. KillTimer(timer);
  217. minigun4 = CreateObject(2985,X4,Y4,Z4,RX4,RY4,RZ4);
  218. ResetPlayerWeapons(playerid);
  219. gunid[playerid]=0;
  220. for (new i = 0; i < 13; i++)
  221. {
  222. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  223. }
  224. }
  225.  
  226. else if(gunid[playerid] == 5)
  227. {
  228. KillTimer(timer);
  229. minigun5 = CreateObject(2985,X5,Y5,Z5,RX5,RY5,RZ5);
  230. ResetPlayerWeapons(playerid);
  231. gunid[playerid]=0;
  232. for (new i = 0; i < 13; i++)
  233. {
  234. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  235. }
  236. }
  237. return 1;
  238. }
  239. return 0;
  240. }
  241.  
  242. public mini(playerid)
  243. {
  244. if(gunid[playerid] == 1 && PlayerToPoint(DISTANCE,playerid,X1,Y1,Z1) == 0)
  245. {
  246. KillTimer(timer);
  247. minigun1 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
  248. ResetPlayerWeapons(playerid);
  249. gunid[playerid]=0;
  250. for (new i = 0; i < 13; i++)
  251. {
  252. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  253. }
  254. }
  255.  
  256. if(gunid[playerid] == 2 && PlayerToPoint(DISTANCE,playerid,X2,Y2,Z2) == 0)
  257. {
  258. KillTimer(timer);
  259. minigun2 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
  260. ResetPlayerWeapons(playerid);
  261. gunid[playerid]=0;
  262. for (new i = 0; i < 13; i++)
  263. {
  264. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  265. }
  266. }
  267.  
  268. else if(gunid[playerid] == 3 && PlayerToPoint(DISTANCE,playerid,X3,Y3,Z3) == 0)
  269. {
  270. KillTimer(timer);
  271. minigun3 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
  272. ResetPlayerWeapons(playerid);
  273. gunid[playerid]=0;
  274. for (new i = 0; i < 13; i++)
  275. {
  276. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  277. }
  278. }
  279.  
  280. else if(gunid[playerid] == 4 && PlayerToPoint(DISTANCE,playerid,X4,Y4,Z4) == 0)
  281. {
  282. KillTimer(timer);
  283. minigun4 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
  284. ResetPlayerWeapons(playerid);
  285. gunid[playerid]=0;
  286. for (new i = 0; i < 13; i++)
  287. {
  288. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  289. }
  290. }
  291.  
  292. else if(gunid[playerid] == 5 && PlayerToPoint(DISTANCE,playerid,X5,Y5,Z5) == 0)
  293. {
  294. KillTimer(timer);
  295. minigun5 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
  296. ResetPlayerWeapons(playerid);
  297. gunid[playerid]=0;
  298. for (new i = 0; i < 13; i++)
  299. {
  300. GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
  301. }
  302. }
  303. }
  304.  
  305. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  306. {
  307. new Float:oldposx, Float:oldposy, Float:oldposz;
  308. new Float:tempposx, Float:tempposy, Float:tempposz;
  309. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  310. tempposx = (oldposx -x);
  311. tempposy = (oldposy -y);
  312. tempposz = (oldposz -z);
  313. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  314. {
  315. return 1;
  316. }
  317. return 0;
  318. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement