Guest User

Untitled

a guest
Aug 17th, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. CMD:knockout(playerid, params[])
  2. {
  3. new giveplayerid;
  4.  
  5. if(sscanf(params, "u", giveplayerid))
  6. return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /token5 [playerid/partofname]");
  7.  
  8. if(IsPlayerConnected(giveplayerid))
  9. {
  10. if(PlayerInfo[playerid][pLevel] < 3)
  11. {
  12. SendClientMessage(playerid, COLOR_GREY, "You need to be atleast level 3 to use this command.");
  13. return 1;
  14. }
  15. if(KnockedDown[playerid] == 1)
  16. {
  17. SendClientMessage(playerid, COLOR_GREY, "Can't swing when you're knocked down.");
  18. return 1;
  19. }
  20. if(PlayerBoxing[playerid] != 0)
  21. {
  22. SendClientMessage(playerid, COLOR_GREY, "Can't use that command while boxing.");
  23. return 1;
  24. }
  25. if(IsPlayerConnected(giveplayerid))
  26. {
  27. if(giveplayerid != INVALID_PLAYER_ID)
  28. {
  29. if (ProxDetectorS(1.0, playerid, giveplayerid))
  30. {
  31. if(KnockedDown[giveplayerid] != 1)
  32. {
  33. if(giveplayerid == playerid)
  34. {
  35. SendClientMessage(playerid, COLOR_GREY, " You can not swing at yourself.");
  36. return 1;
  37. }
  38. if(IsPlayerInAnyVehicle(giveplayerid))
  39. {
  40. return 1;
  41. }
  42. new giveplayername[MAX_PLAYER_NAME];
  43. GetPlayerName(playerid, playername, sizeof(playername));
  44. new rands = random(2)+1;
  45. format(string,sizeof(string),"%s swings at %s and tries to knock him out.", sendername, giveplayername);
  46. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  47. ApplyAnimation(playerid,"FIGHT_D","FightD_3",4.0,0,1,1,0,0);
  48. if(rands == 1)
  49. {
  50. TogglePlayerControllable(giveplayerid, 0);
  51. ApplyAnimation(giveplayerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
  52. SetTimerEx("ClearKnock", 20000, false, "i", giveplayerid);
  53. KnockedDown[giveplayerid] = 1;
  54. format(string, sizeof(string), "* %s succeeds to knock him down.", sendername);
  55. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  56. }
  57. else
  58. {
  59. format(string, sizeof(string), "* %s misses the swing and fails to knock him out.", sendername);
  60. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  61. }
  62. return 1;
  63. }
  64. else
  65. {
  66. SendClientMessage(playerid, COLOR_GREY, "Player is knocked down already.");
  67. }
  68. }
  69. else
  70. {
  71. SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
  72. }
  73. }
  74. }
  75.  
  76. }
  77. return 1;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment