Advertisement
Inshal

iBomb by inshal

Mar 21st, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.19 KB | None | 0 0
  1.  
  2.  
  3. #include <a_samp>
  4. #include <sscanf2>
  5.  
  6. new BombAttached[MAX_PLAYERS];
  7.  
  8. forward Explosion();
  9. forward Float:GetDistanceBetweenPlayers(p1,p2);
  10.  
  11. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  12.  
  13. #define RED 0xFF0000AA
  14. #define LIGHTGREEN 0x33AA33AA
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.     print("\n--------------------------------------");
  19.     print(" iBomb Filterscript v1.0 loaded!");
  20.     print("--------------------------------------\n");
  21.     return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26.     print("\n----------------------------------");
  27.     print(" iBomb Filterscript v1.0 unloaded!");
  28.     print("----------------------------------\n");
  29.     return 1;
  30. }
  31.  
  32. public OnPlayerConnect(playerid)
  33. {
  34.     return 1;
  35. }
  36.  
  37. public OnPlayerDisconnect(playerid, reason)
  38. {
  39.     return 1;
  40. }
  41.  
  42. public OnPlayerSpawn(playerid)
  43. {
  44.     return 1;
  45. }
  46.  
  47. public OnPlayerDeath(playerid, killerid, reason)
  48. {
  49.     return 1;
  50. }
  51.  
  52. public OnVehicleSpawn(vehicleid)
  53. {
  54.     return 1;
  55. }
  56.  
  57. public OnVehicleDeath(vehicleid, killerid)
  58. {
  59.     return 1;
  60. }
  61.  
  62. public OnPlayerText(playerid, text[])
  63. {
  64.     return 1;
  65. }
  66.  
  67. public OnPlayerCommandText(playerid, cmdtext[])
  68. {
  69.  
  70.     dcmd(bomb,4,cmdtext);
  71.     return 1;
  72. }
  73.  
  74.  
  75.  
  76. dcmd_bomb(playerid,params[])
  77. {
  78.     new targetid;
  79.     new crand = random(100);
  80.     if(GetDistanceBetweenPlayers(playerid, targetid) > 4) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} Player is too far away.");
  81.     if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, RED, "[USAGE]{FFFFFF} /rob [name/id]");
  82.     if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} Player not found.");
  83.     if(BombAttached[targetid] == 1) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} A bomb is already attached to the player.");
  84.     if(playerid == targetid) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} You cannot attach bomb on yourself!");
  85.     if(IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid, RED, "[ERROR]{FFFFFF} The player should not be in a vehicle!");
  86.     if(crand <= 30) return SendClientMessage(playerid, RED, "[FAIL]{FFFFFF} You have failed to attach the bomb on the player.");
  87.     if(crand > 30)
  88.     {
  89.         SendClientMessage(playerid, LIGHTGREEN, "[SUCCESSFUL]{FFFFFF} You have attached the bomb on the player and will explode in 10 seconds");
  90.         SendClientMessage(targetid, RED, "[DANGER]{FFFFFF} A bomb has been attached on you and will explode in 10 seconds!");
  91.         SetTimer("Explosion", 10000, false);
  92.         BombAttached[targetid] =1;
  93.     }
  94.     return 1;
  95. }
  96.  
  97.  
  98. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  99. {
  100.     return 1;
  101. }
  102.  
  103. public OnPlayerExitVehicle(playerid, vehicleid)
  104. {
  105.     return 1;
  106. }
  107.  
  108. public OnPlayerStateChange(playerid, newstate, oldstate)
  109. {
  110.     return 1;
  111. }
  112.  
  113. public OnPlayerEnterCheckpoint(playerid)
  114. {
  115.     return 1;
  116. }
  117.  
  118. public OnPlayerLeaveCheckpoint(playerid)
  119. {
  120.     return 1;
  121. }
  122.  
  123. public OnPlayerEnterRaceCheckpoint(playerid)
  124. {
  125.     return 1;
  126. }
  127.  
  128. public OnPlayerLeaveRaceCheckpoint(playerid)
  129. {
  130.     return 1;
  131. }
  132.  
  133. public OnRconCommand(cmd[])
  134. {
  135.     return 1;
  136. }
  137.  
  138. public OnPlayerRequestSpawn(playerid)
  139. {
  140.     return 1;
  141. }
  142.  
  143. public OnObjectMoved(objectid)
  144. {
  145.     return 1;
  146. }
  147.  
  148. public OnPlayerObjectMoved(playerid, objectid)
  149. {
  150.     return 1;
  151. }
  152.  
  153. public OnPlayerPickUpPickup(playerid, pickupid)
  154. {
  155.     return 1;
  156. }
  157.  
  158. public OnVehicleMod(playerid, vehicleid, componentid)
  159. {
  160.     return 1;
  161. }
  162.  
  163. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  164. {
  165.     return 1;
  166. }
  167.  
  168. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  169. {
  170.     return 1;
  171. }
  172.  
  173. public OnPlayerSelectedMenuRow(playerid, row)
  174. {
  175.     return 1;
  176. }
  177.  
  178. public OnPlayerExitedMenu(playerid)
  179. {
  180.     return 1;
  181. }
  182.  
  183. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  184. {
  185.     return 1;
  186. }
  187.  
  188. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  189. {
  190.     return 1;
  191. }
  192.  
  193. public OnRconLoginAttempt(ip[], password[], success)
  194. {
  195.     return 1;
  196. }
  197.  
  198. public OnPlayerUpdate(playerid)
  199. {
  200.     return 1;
  201. }
  202.  
  203. public OnPlayerStreamIn(playerid, forplayerid)
  204. {
  205.     return 1;
  206. }
  207.  
  208. public OnPlayerStreamOut(playerid, forplayerid)
  209. {
  210.     return 1;
  211. }
  212.  
  213. public OnVehicleStreamIn(vehicleid, forplayerid)
  214. {
  215.     return 1;
  216. }
  217.  
  218. public OnVehicleStreamOut(vehicleid, forplayerid)
  219. {
  220.     return 1;
  221. }
  222.  
  223. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  224. {
  225.     return 1;
  226. }
  227.  
  228. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  229. {
  230.     return 1;
  231. }
  232.  
  233. public Explosion()
  234. {
  235.     for(new i=0; i<MAX_PLAYERS; i++)
  236.     {
  237.         if(IsPlayerConnected(i))
  238.         {
  239.             if(BombAttached[i] == 1)
  240.             {
  241.             new Float:x, Float:y, Float:z;
  242.  
  243.             GetPlayerPos(i, x, y, z);
  244.             CreateExplosion(x,y,z,6,10.0);
  245.             SetPlayerHealth(i, 0);
  246.             BombAttached[i] =0;
  247.  
  248.             }
  249.         }
  250.     }
  251. }
  252.  
  253. public Float:GetDistanceBetweenPlayers(p1,p2)
  254. {
  255.     new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  256.     if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
  257.     {
  258.         return -1.00;
  259.     }
  260.     GetPlayerPos(p1,x1,y1,z1);
  261.     GetPlayerPos(p2,x2,y2,z2);
  262.     return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  263. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement