Advertisement
Guest User

C4 v1.1

a guest
Mar 27th, 2014
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <streamer>
  4.  
  5. #define FILTERSCRIPT
  6.  
  7. new c4[MAX_PLAYERS];
  8. new c4o[11][MAX_PLAYERS];
  9. new Float:c4posx[11][MAX_PLAYERS];
  10. new Float:c4posy[11][MAX_PLAYERS];
  11. new Float:c4posz[11][MAX_PLAYERS];
  12.  
  13. public OnFilterScriptInit()
  14. {
  15. print("\n--------------------------------------");
  16. print("C4 System by _Mohit_ Loaded");
  17. print("--------------------------------------\n");
  18. return 1;
  19. }
  20. public OnFilterScriptExit()
  21. {
  22. print("\n--------------------------------------");
  23. print("C4 System by _Mohit_ UnLoaded");
  24. print("--------------------------------------\n");
  25. return 1;
  26. }
  27. public OnPlayerConnect(playerid)
  28. {
  29. ApplyAnimation(playerid,"BOMBER","null",0,0,0,0,0,0,0); //This is to preload the animation Liberary
  30. for(new i;i < 11;i++)
  31. {
  32. c4posx[i][playerid] = 9999;
  33. c4posy[i][playerid] = 9999;
  34. c4posz[i][playerid] = 9999;
  35. }
  36. c4[playerid] = 0;
  37. return 1;
  38. }
  39. public OnPlayerDisconnect(playerid, reason)
  40. {
  41. for(new i;i < 11;i++)
  42. {
  43. c4posx[i][playerid] = 9999;
  44. c4posy[i][playerid] = 9999;
  45. c4posz[i][playerid] = 9999;
  46. DestroyDynamicObject(c4o[i][playerid]);
  47. }
  48. c4[playerid] = 0;
  49. return 1;
  50. }
  51. CMD:plantc4(playerid,params[])
  52. {
  53. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Error:- You cannot plant a C4 while in a vehicle!!");
  54. if(c4[playerid] == 10) return SendClientMessage(playerid,-1,"Error:- You can only plant 10 C4's at a time!");
  55. new i;
  56. c4[playerid] ++;
  57. i = c4[playerid];
  58. new Float:x,Float:y,Float:z;
  59. GetPlayerPos(playerid,x,y,z);
  60. c4posx[i][playerid] = x;
  61. c4posy[i][playerid] = y;
  62. c4posz[i][playerid] = z;
  63. ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.1,0,1,1,0,0,1);
  64. SendClientMessage(playerid,-1,"C4 has been succesfully planted.Press ` ~k~~SNEAK_ABOUT~ ` key to explode it.");
  65. c4o[i][playerid] = CreateDynamicObject(363,x,y,z-0.9,-90,0,0,-1,-1,-1,200);
  66. return 1;
  67. }
  68. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  69. {
  70. if(newkeys == KEY_WALK)
  71. {
  72. if(c4[playerid] != 0)
  73. {
  74. for(new i; i < 11;i++)
  75. {
  76. if(c4posx[i][playerid] != 9999 && c4posy[i][playerid] != 9999 && c4posz[i][playerid] != 9999)
  77. {
  78. CreateExplosion(c4posx[i][playerid],c4posy[i][playerid],c4posz[i][playerid],3,3);
  79. DestroyDynamicObject(c4o[i][playerid]);
  80. c4posx[i][playerid] = 9999;
  81. c4posy[i][playerid] = 9999;
  82. c4posz[i][playerid] = 9999;
  83. }
  84. }
  85. c4[playerid] = 0;
  86. }
  87. }
  88. return 1;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement