Advertisement
Guest User

<3 SA-MP

a guest
Nov 22nd, 2013
832
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.16 KB | None | 0 0
  1. //Mark Shade's Tackle & Auto Crack System
  2. #include <a_samp>
  3.  
  4. #define FILTERSCRIPT
  5.  
  6. new g_bCrackState[MAX_PLAYERS];
  7. new g_tCrackTick[MAX_PLAYERS];
  8. new g_bDownState[MAX_PLAYERS];
  9.  
  10. main( ) { }
  11.  
  12. #undef MAX_PLAYERS
  13. #define MAX_PLAYERS 15
  14.  
  15. forward AutoCrack(playerid);
  16.  
  17. public OnFilterScriptInit( )
  18. {
  19. SetGameModeText("Blank Script");
  20. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  21. return 1;
  22. }
  23.  
  24. public OnFilterScriptExit( )
  25. {
  26. return 1;
  27. }
  28.  
  29. public OnPlayerRequestClass(playerid, classid)
  30. {
  31. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  32. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  33. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  34. return 1;
  35. }
  36.  
  37. public OnPlayerConnect(playerid)
  38. {
  39. return 1;
  40. }
  41.  
  42. public OnPlayerDisconnect(playerid, reason)
  43. {
  44. return 1;
  45. }
  46.  
  47. public OnPlayerSpawn(playerid)
  48. {
  49. SetTimer("AutoCrack", 2500, true);
  50. SetPlayerSkin(playerid, 28);
  51. GivePlayerWeapon(playerid, 24, 50);
  52. GivePlayerWeapon(playerid, 25, 50);
  53. GivePlayerWeapon(playerid, 29, 300);
  54. GivePlayerWeapon(playerid, 30, 300);
  55. return 1;
  56. }
  57.  
  58. public OnPlayerDeath(playerid, killerid, reason)
  59. {
  60. return 1;
  61. }
  62.  
  63. public OnVehicleSpawn(vehicleid)
  64. {
  65. return 1;
  66. }
  67.  
  68. public OnVehicleDeath(vehicleid, killerid)
  69. {
  70. return 1;
  71. }
  72.  
  73. public OnPlayerText(playerid, text[])
  74. {
  75. return 1;
  76. }
  77.  
  78. public OnPlayerCommandText(playerid, cmdtext[])
  79. {
  80. new
  81. Float:health;
  82.  
  83. GetPlayerHealth(playerid, health);
  84.  
  85. if (strcmp("/getup", cmdtext, true, 6) == 0)
  86. {
  87. GetPlayerHealth(playerid,health);
  88. if(health < 20.0)
  89. if ((GetTickCount() - g_tCrackTick[playerid]) > 15000)
  90. {
  91. SetPlayerHealth(playerid, 21);
  92. TogglePlayerControllable(playerid, true);
  93. ApplyAnimation(playerid,"PED","getup_front",5.0,0,1,1,1,1,1);
  94. SendClientMessage(playerid, 0x4AF8FF, "You've successfully got up! Remember to roleplay your injuries. ");
  95. g_bCrackState[playerid] = 0;
  96. g_tCrackTick[playerid] = GetTickCount();
  97. }
  98. }
  99. if (strcmp("/crackme", cmdtext, true, 8) == 0)
  100. {
  101. SetPlayerHealth(playerid, 10);
  102. return 1;
  103. }
  104. if (strcmp("/unfreeze", cmdtext, true, 9) == 0)
  105. {
  106. TogglePlayerControllable(playerid, true);
  107. return 1;
  108. }
  109. if (strcmp("/tackle", cmdtext, true, 7) == 0) {
  110. new victimid = GetClosestPlayer(playerid);
  111. if(GetDistanceBetweenPlayers(playerid,victimid) < 2)
  112. {
  113. new Chance = random(10);
  114. {
  115. switch(Chance)
  116. {
  117. case 5,10:
  118. {
  119. ApplyAnimation(playerid,"DODGE","Cover_Dive_01",5.0,0,1,1,1,1,1);
  120. TogglePlayerControllable(victimid, false);
  121. ApplyAnimation(victimid,"PARACHUTE","FALL_skyDive_DIE",5.0,0,1,1,1,1,1);
  122. g_bDownState[victimid] = 1;
  123. SendClientMessage(playerid, 0x4AF8FF, " You have successfully downed your target! ");
  124. SendClientMessage(victimid, 0x4AF8FF, " You have been tackle'd down by someone! ");
  125. SetTimer("Tackle", 30000, false);
  126. }
  127. case 1,2,3,4,7,8,9:
  128. {
  129. SendClientMessage(playerid, 0x4AF8FF, " You've failed to tackle your target. ");
  130. SendClientMessage(victimid, 0x4AF8FF, " Someone tried to tackle you! ");
  131. }
  132. }
  133. }
  134. }
  135. return 1;
  136. }
  137. return 1;
  138. }
  139.  
  140. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  141. {
  142. return 1;
  143. }
  144.  
  145. public OnPlayerExitVehicle(playerid, vehicleid)
  146. {
  147. return 1;
  148. }
  149.  
  150. public OnPlayerStateChange(playerid, newstate, oldstate)
  151. {
  152. return 1;
  153. }
  154.  
  155. public OnPlayerEnterCheckpoint(playerid)
  156. {
  157. return 1;
  158. }
  159.  
  160. public OnPlayerLeaveCheckpoint(playerid)
  161. {
  162. return 1;
  163. }
  164.  
  165. public OnPlayerEnterRaceCheckpoint(playerid)
  166. {
  167. return 1;
  168. }
  169.  
  170. public OnPlayerLeaveRaceCheckpoint(playerid)
  171. {
  172. return 1;
  173. }
  174.  
  175. public OnRconCommand(cmd[])
  176. {
  177. return 1;
  178. }
  179.  
  180. public OnPlayerRequestSpawn(playerid)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnObjectMoved(objectid)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnPlayerObjectMoved(playerid, objectid)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnPlayerPickUpPickup(playerid, pickupid)
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnVehicleMod(playerid, vehicleid, componentid)
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  206. {
  207. return 1;
  208. }
  209.  
  210. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  211. {
  212. return 1;
  213. }
  214.  
  215. public OnPlayerSelectedMenuRow(playerid, row)
  216. {
  217. return 1;
  218. }
  219.  
  220. public OnPlayerExitedMenu(playerid)
  221. {
  222. return 1;
  223. }
  224.  
  225. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  226. {
  227. return 1;
  228. }
  229.  
  230. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  231. {
  232. return 1;
  233. }
  234.  
  235. public OnRconLoginAttempt(ip[], password[], success)
  236. {
  237. return 1;
  238. }
  239.  
  240. public OnPlayerUpdate(playerid)
  241. {
  242. return 1;
  243. }
  244.  
  245. public OnPlayerStreamIn(playerid, forplayerid)
  246. {
  247. return 1;
  248. }
  249.  
  250. public OnPlayerStreamOut(playerid, forplayerid)
  251. {
  252. return 1;
  253. }
  254.  
  255. public OnVehicleStreamIn(vehicleid, forplayerid)
  256. {
  257. return 1;
  258. }
  259.  
  260. public OnVehicleStreamOut(vehicleid, forplayerid)
  261. {
  262. return 1;
  263. }
  264.  
  265. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  266. {
  267. return 1;
  268. }
  269.  
  270. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  271. {
  272. return 1;
  273. }
  274.  
  275. public AutoCrack(playerid)
  276. {
  277. new Float:health;
  278.  
  279. GetPlayerHealth(playerid,health);
  280. if(health < 20.0 && !g_bCrackState[playerid])
  281. {
  282. TogglePlayerControllable(playerid, false);
  283. ApplyAnimation(playerid,"PED","KO_spin_L",3.0,0,1,1,1,1,1);
  284. g_bCrackState[playerid] = 1;
  285. g_tCrackTick[playerid] = GetTickCount();
  286. }
  287. return 1;
  288. }
  289.  
  290. forward Tackle(victimid);
  291. public Tackle(victimid)
  292. {
  293. if ((g_bDownState[victimid] = 1))
  294. {
  295. TogglePlayerControllable(victimid, false);
  296. }
  297. return 1;
  298. }
  299.  
  300. forward Float:GetDistanceBetweenPlayers(p1,p2);
  301. public Float:GetDistanceBetweenPlayers(p1,p2)
  302. {
  303. new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  304. if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) {
  305. return -1.00;
  306. }
  307. GetPlayerPos(p1,x1,y1,z1);
  308. GetPlayerPos(p2,x2,y2,z2);
  309. return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  310. }
  311.  
  312.  
  313. forward GetClosestPlayer(p1);
  314. public GetClosestPlayer(p1)
  315. {
  316. new x,Float:dis,Float:dis2,player;
  317. player = -1;
  318. dis = 99999.99;
  319. for (x=0;x<MAX_PLAYERS;x++) {
  320. if(IsPlayerConnected(x)) {
  321. if(x != p1) {
  322. dis2 = GetDistanceBetweenPlayers(x,p1);
  323. if(dis2 < dis && dis2 != -1.00) {
  324. dis = dis2;
  325. player = x;
  326. }
  327. }
  328. }
  329. }
  330. return player;
  331. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement