Advertisement
Guest User

Untitled

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