Guest User

Joe Torran C

a guest
Apr 30th, 2010
919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define COLOR_RED 0xFF0000FF
  5. #define COLOR_YELLOW 0xFFFF00FF
  6.  
  7. forward NotAtBuyableLocation(playerid);
  8. forward C4Options(playerid);
  9. forward ExplodeC4(playerid);
  10.  
  11. new C4Owned[MAX_PLAYERS];
  12. new C4[MAX_PLAYERS];
  13. new string[128];
  14.  
  15. public OnFilterScriptInit()
  16. {
  17. print("\n - | Torran's Plant C4 Script | - \n");
  18.  
  19. CreatePickup(1239, 29, -2044.0807, 149.9639, 28.8359);
  20. return 1;
  21. }
  22.  
  23. public OnPlayerConnect(playerid)
  24. {
  25. C4Owned[playerid] = 0;
  26. C4[playerid] = 0;
  27. return 1;
  28. }
  29.  
  30. public OnPlayerEnterCheckpoint(playerid)
  31. {
  32. DisablePlayerCheckpoint(playerid);
  33. return 1;
  34. }
  35.  
  36. public NotAtBuyableLocation(playerid)
  37. {
  38. SendClientMessage(playerid, COLOR_RED, " - | You need to be at the point marked on your map with a checkpoint | -");
  39. SetPlayerCheckpoint(playerid, -2044.0807, 149.9639, 28.8359, 5.0);
  40. return 1;
  41. }
  42.  
  43. public C4Options(playerid)
  44. {
  45. SendClientMessage(playerid, COLOR_RED, " - | Usage: /c4 [option] | -");
  46. SendClientMessage(playerid, COLOR_RED, " - | Options: buy, plant, detonate, quantity, credits | -");
  47. return 1;
  48. }
  49.  
  50. public ExplodeC4(playerid)
  51. {
  52. new Float:x, Float:y, Float:z;
  53. GetObjectPos(C4[playerid], x, y, z);
  54. DestroyObject(C4[playerid]);
  55. CreateExplosion(x, y, z, 7, 10.0);
  56. C4[playerid] = 0;
  57. return 1;
  58. }
  59.  
  60. CMD:c4(playerid, params[])
  61. {
  62. if(strcmp(params, "buy", true) == 0)
  63. {
  64. if(!IsPlayerInRangeOfPoint(playerid, 5.0, -2044.0807, 149.9639, 28.8359)) return NotAtBuyableLocation(playerid);
  65.  
  66. C4Owned[playerid]++;
  67. format(string, sizeof string, " - | Success: C4 Bought, You currently have %d C4 | -", C4Owned[playerid]);
  68. SendClientMessage(playerid, COLOR_YELLOW, string);
  69. return 1;
  70. }
  71. if(strcmp(params, "plant", true) == 0)
  72. {
  73. new Float:x, Float:y, Float:z;
  74. if(!C4Owned[playerid]) return SendClientMessage(playerid, COLOR_RED, " - | You must buy C4 before using this command | -");
  75. if(C4[playerid]) return SendClientMessage(playerid, COLOR_RED, " - | You can only plant one C4 block at a time | -");
  76.  
  77. GetPlayerPos(playerid, x, y, z);
  78. C4[playerid] = CreateObject(1654, x, y, z, 0, 0, 0);
  79.  
  80. SendClientMessage(playerid, COLOR_YELLOW, " - | Success: C4 Planted, Detonate using: /c4 detonate| -");
  81. return 1;
  82. }
  83. if(strcmp(params, "detonate", true) == 0)
  84. {
  85. if(!C4Owned[playerid]) return SendClientMessage(playerid, COLOR_RED, " - | You must buy C4 before using this command | -");
  86. if(!C4[playerid]) return SendClientMessage(playerid, COLOR_RED, " - | You must plant your current C4 before detonating | -");
  87.  
  88. C4Owned[playerid]--;
  89. SendClientMessage(playerid, COLOR_YELLOW, " - | C4 Detonated, Exploding in 5 seconds, Run! | -");
  90. SetTimerEx("ExplodeC4", 5000, 0, "i", playerid);
  91. return 1;
  92. }
  93. if(strcmp(params, "quantity", true) == 0)
  94. {
  95. if(!C4Owned[playerid]) return SendClientMessage(playerid, COLOR_RED, " - | You do not have any C4 | -");
  96.  
  97. format(string, sizeof string, " - | Quantity of C4: %d | -", C4Owned[playerid]);
  98. SendClientMessage(playerid, COLOR_YELLOW, string);
  99. return 1;
  100. }
  101. if(strcmp(params, "credits", true) == 0)
  102. {
  103. SendClientMessage(playerid, COLOR_YELLOW, " - | Made by Torran | -");
  104. return 1;
  105. }
  106. return C4Options(playerid);
  107. }
Advertisement
Add Comment
Please, Sign In to add comment