Guest User

Untitled

a guest
Mar 19th, 2015
1,157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.87 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define Msg SendClientMessage
  5. #define COLOR_ERROR 0xAA3333AA
  6. #define COLOR_NOTIFICATION 0x33CCFFAA
  7.  
  8.  
  9. #define Bomb_Price 10000
  10. #define Max_Bombs 1
  11. #define Bomb_Radius 20
  12. #define Bomb_Time 15000
  13.  
  14. new
  15. PlantedBomb[MAX_PLAYERS],
  16. Float:BombX[MAX_PLAYERS],
  17. Float:BombY[MAX_PLAYERS],
  18. Float:BombZ[MAX_PLAYERS],
  19. PlayerBombs[MAX_PLAYERS],
  20. PlayerBombObject[MAX_PLAYERS],
  21. Text3D:PlayerBombText[MAX_PLAYERS],
  22. VehicleExplode[MAX_PLAYERS],
  23. RemoteVehicle[MAX_PLAYERS];
  24.  
  25.  
  26. forward Bombing(playerid);
  27. forward CarExplosion(playerid);
  28.  
  29. #define FILTERSCRIPT
  30.  
  31. #if defined FILTERSCRIPT
  32.  
  33. public OnFilterScriptInit()
  34. {
  35. print("\n--------------------------------------");
  36. print(" -TwinkiDaBoss bombing system!");
  37. print("--------------------------------------\n");
  38. return 1;
  39. }
  40.  
  41. public OnFilterScriptExit()
  42. {
  43. return 1;
  44. }
  45.  
  46. #else
  47.  
  48. main()
  49. {
  50. print("\n----------------------------------");
  51. print(" Blank Gamemode by your name here");
  52. print("----------------------------------\n");
  53. }
  54.  
  55. #endif
  56. CMD:plantremote(playerid,params[])
  57. {
  58. new string[128], vid = GetPlayerVehicleID(playerid);
  59. if(!IsPlayerInAnyVehicle(playerid))
  60. return Msg(playerid,COLOR_ERROR,"You are not inside any vehicle!");
  61.  
  62. if(PlayerBombs[playerid] == 0)
  63. return Msg(playerid,COLOR_ERROR,"You dont have any bombs to plant!");
  64.  
  65. if(PlantedBomb[playerid] >= 1)
  66. return Msg(playerid,COLOR_ERROR,"You have already planted a bomb! Wait for it to explode first!");
  67.  
  68. PlantedBomb[playerid] = 1;
  69. PlayerBombs[playerid] -= 1;
  70.  
  71. RemoteVehicle[playerid] = vid;
  72.  
  73. format(string,sizeof(string),"You have planted a remote bomb inside vehicle ID:%i.",vid);
  74. Msg(playerid,COLOR_NOTIFICATION,string);
  75. return true;
  76. }
  77.  
  78. CMD:explode(playerid,params[])
  79. {
  80. new string[128],Float:x,Float:y,Float:z;
  81. GetVehiclePos(RemoteVehicle[playerid],x,y,z);
  82.  
  83. if(PlantedBomb[playerid] == 0)
  84. return Msg(playerid,COLOR_ERROR,"You havent planted any bombs");
  85.  
  86. if(!IsPlayerInRangeOfPoint(playerid,50.0,x,y,z))
  87. return Msg(playerid,COLOR_ERROR,"You are not near the vehicle! You must be atleast 50 meters from it!");
  88.  
  89. PlantedBomb[playerid] -= 1;
  90.  
  91. CreateExplosion(x,y,z,10,Bomb_Radius);
  92.  
  93. format(string,sizeof(string),"You have successfully blew up vehicle ID:%i using your remote!",RemoteVehicle[playerid]);
  94. Msg(playerid,COLOR_NOTIFICATION,string);
  95. return true;
  96. }
  97.  
  98.  
  99. CMD:carbomb(playerid,params[])
  100. {
  101. new string[128], Calctime, vid = GetPlayerVehicleID(playerid);
  102. if(!IsPlayerInAnyVehicle(playerid))
  103. return Msg(playerid,COLOR_ERROR,"You are not inside any vehicle!");
  104.  
  105. if(PlayerBombs[playerid] == 0)
  106. return Msg(playerid,COLOR_ERROR,"You dont have any bombs to plant!");
  107.  
  108. if(PlantedBomb[playerid] >= 1)
  109. return Msg(playerid,COLOR_ERROR,"You have already planted a bomb! Wait for it to explode first!");
  110.  
  111. PlantedBomb[playerid] = 1;
  112. PlayerBombs[playerid] -= 1;
  113. Calctime = Bomb_Time/1000;
  114.  
  115. VehicleExplode[playerid] = vid;
  116. SetTimerEx("CarExplosion",Bomb_Time,false,"i",playerid);
  117.  
  118. format(string,sizeof(string),"You have placed a bomb inside vehicle ID: %i and it will explode in %i seconds",vid,Calctime);
  119. Msg(playerid,COLOR_NOTIFICATION,string);
  120.  
  121.  
  122. return true;
  123. }
  124.  
  125. public CarExplosion(playerid)
  126. {
  127. new Float:x,Float:y,Float:z,string[128];
  128. GetVehiclePos(VehicleExplode[playerid],x,y,z);
  129. CreateExplosion(x,y,z,10,Bomb_Radius);
  130. format(string,sizeof(string),"Your target vehicle ID: %i has exploded!",VehicleExplode[playerid]);
  131. Msg(playerid,COLOR_NOTIFICATION,string);
  132. PlantedBomb[playerid] = 0;
  133. return true;
  134. }
  135.  
  136. CMD:plantbomb(playerid,params[])
  137. {
  138. new Float:x,Float:y,Float:z,string[128], Calctime;
  139. if(IsPlayerInAnyVehicle(playerid))
  140. return Msg(playerid,COLOR_ERROR,"You must be on foot to do this!");
  141.  
  142. if(PlayerBombs[playerid] == 0)
  143. return Msg(playerid,COLOR_ERROR,"You dont have any bombs to plant!");
  144.  
  145. if(PlantedBomb[playerid] >= 1)
  146. return Msg(playerid,COLOR_ERROR,"You have already planted a bomb! Wait for it to explode first!");
  147.  
  148. GetPlayerPos(playerid,x,y,z);
  149. BombX[playerid] = x;
  150. BombY[playerid] = y;
  151. BombZ[playerid] = z;
  152. PlantedBomb[playerid] = 1;
  153. PlayerBombs[playerid] -= 1;
  154. SetTimerEx("Bombing",Bomb_Time,false,"i",playerid);
  155. PlayerBombObject[playerid] = CreateObject(1252,x,y,z,0,0,0,0);
  156. Calctime = Bomb_Time/1000;
  157. format(string,sizeof(string),"You have planted a bomb! It will explode in %i seconds!",Calctime);
  158. Msg(playerid,COLOR_NOTIFICATION,string);
  159.  
  160. format(string,sizeof(string),"%s's Bombs\nExplosion time: %i seconds",GetName(playerid),Calctime);
  161. PlayerBombText[playerid] = Create3DTextLabel(string, 0x008080FF, x,y,z, 40.0, 0, 0);
  162.  
  163. return true;
  164. }
  165.  
  166. public Bombing(playerid)
  167. {
  168. CreateExplosion(BombX[playerid],BombY[playerid],BombZ[playerid],10,Bomb_Radius);
  169. BombX[playerid] = 0;
  170. BombY[playerid] = 0;
  171. BombZ[playerid] = 0;
  172. PlantedBomb[playerid] = 0;
  173. DestroyObject(PlayerBombObject[playerid]);
  174. Delete3DTextLabel(PlayerBombText[playerid]);
  175. Msg(playerid,COLOR_NOTIFICATION,"Bomb has successfully exploded!");
  176. return true;
  177. }
  178.  
  179. CMD:buybomb(playerid,params[])
  180. {
  181. new string[128];
  182. format(string,sizeof(string),"You already have %i bombs. You can have maximum of %i bombs!",PlayerBombs[playerid],Max_Bombs);
  183.  
  184. if(PlayerBombs[playerid] >= Max_Bombs)
  185. return Msg(playerid,COLOR_ERROR,string);
  186.  
  187. format(string,sizeof(string),"You dont have enough money! You need %i$ to buy a bomb!", Bomb_Price);
  188. if(GetPlayerMoney(playerid) < Bomb_Price)
  189. return Msg(playerid,COLOR_ERROR,string);
  190.  
  191. PlayerBombs[playerid] += 1;
  192. format(string,sizeof(string),"You have purchased a bomb for %i$",Bomb_Price);
  193. Msg(playerid,COLOR_NOTIFICATION,string);
  194. GivePlayerMoney(playerid, -Bomb_Price);
  195. return true;
  196. }
  197.  
  198.  
  199. stock GetName(playerid)
  200. {
  201. new pName[MAX_PLAYER_NAME];
  202. GetPlayerName(playerid, pName, sizeof(pName));
  203. return pName;
  204. }
Advertisement
Add Comment
Please, Sign In to add comment