Guest User

Untitled

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