Suicide Bomber

Description

Lets an ingame player make themselves explode in a certain amount of seconds, killing them and whoever's near.

Download

Source Code

  1. //config
  2. const Seconds = 5;
  3. const TextColor = $ffff00001;
  4. const armCMD = '/arm';
  5. const disarmCMD = '/disarm';
  6. const NadeSpeed = 5;
  7.  
  8. //no touchy
  9. var PlayerX,PlayerY: Single;
  10. var PlayersPending: array[1..32] of integer;
  11. var PlayersIteration: integer;
  12.  
  13. //explode playa
  14. //"mother do you think they'll drop da bomb?"
  15. procedure BlowMe (PlayerID: Integer);
  16. var i: integer;
  17. begin
  18. //mock me
  19. WriteConsole(PlayerID,'Ignition!', TextColor);
  20. //where I am
  21. GetPlayerXY(PlayerID,PlayerX,PlayerY);
  22. //kill me first
  23. //"Cannot the kindgome of salvation take me home?"
  24. DoDamage(PlayerID, 4000);
  25. //be a badass and shoot nades in all directions, credits for iDante for making this
  26. for i := 1 to 360 do
  27. CreateBullet(PlayerX, PlayerY, NadeSpeed*cos(i), NadeSpeed*sin(i),100, 2, PlayerID);
  28. //be a pussy and shit 100 grenades out
  29. {
  30. for i := 1 to 100 do
  31. CreateBullet(PlayerX, PlayerY, 0, 0,100, 2, PlayerID);
  32. }
  33. end;
  34.  
  35. //every second...
  36. procedure AppOnIdle(Ticks: integer);
  37. begin
  38. for PlayersIteration := 1 to 32 do
  39. begin
  40. //is this person's time over?
  41. if PlayersPending[PlayersIteration] = 1 then
  42. begin
  43. BlowMe(PlayersIteration);
  44. dec(PlayersPending[PlayersIteration],1);
  45. Continue;
  46. end;
  47.  
  48. //ok, is it almost over?
  49. if PlayersPending[PlayersIteration] > 1 then
  50. begin
  51. dec(PlayersPending[PlayersIteration],1);
  52. WriteConsole(PlayersIteration,'You have '+inttostr(PlayersPending[PlayersIteration])+' seconds of life out of hell left', TextColor);
  53. end;
  54. end;
  55. end;
  56.  
  57. function OnPlayerCommand(PlayerID: Byte; PlayerCMD: String): boolean;
  58. begin
  59. //do we want to arm the bomb?
  60. if PlayerCMD = armCMD then
  61. begin
  62. //set timer to the number of seconds..
  63. PlayersPending[PlayerID] := Seconds;
  64. //tell me how to abort
  65. WriteConsole(PlayerID,'You have '+inttostr(Seconds)+' seconds to live. Press '+disarmCMD+' to cancel.', TextColor);
  66. end;
  67.  
  68. //ah fuck it. I'd rather live than be blown to bits. Wait, I'd like to be blown...
  69. if PlayerCMD = disarmCMD then
  70. begin
  71. //save me!
  72. if PlayersPending[PlayerID] > 0 then
  73. begin
  74. //take away my countdown
  75. PlayersPending[PlayerID] := 0;
  76. //tell me
  77. WriteConsole(PlayerID,'Bomb disarmed.', TextColor);
  78. end;
  79. end;
  80. end;