Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: freestyler on June 05, 2009, 03:03:26 pm

Title: IRC Bomb v1.01
Post by: freestyler on June 05, 2009, 03:03:26 pm
Script Name: IRC Bomb
Script Description: Plant a bomb on someone and watch him trying to defuse it
Author: fri (http://soldatcentral.com/index.php?page=profile&u=24)
Compile Test: Passed
Core Version: 2.6.5

Full Description:
If you have planted a bomb on someone on IRC at least once then you know what it is. Given limited amount of time, you have to cut a wire to defuse the bomb. If you cut the wrong one or you don't make it in time, then you explode.
However, if you manage to defuse the bomb, player who had bombed you gets a nice pack of explosives.

I saw another IRC Bomb here on the forums, but this one is more configurable and 'random'.

Commands:
(admin) /bomb - plants a bomb on randomly selected player (except you, unless you're the only one on the server)
(admin) /bomb ID - plants a bomb on player with that ID
/cut 1, /cut 2, ... - cut wire 1/2/...

(http://oko.im/img/ircbomb.png)

(procedure 'nova' by Avarax)

Edit - version 1.01:
- fixed resetting values of wireactive (it looped from 1 to 0)
- changed all bomb-specific values to one type (idea by y0uRd34th)
- slight texts changes



(http://oko.im/script/dl.png) (http://oko.im/script/dl.php?s=ircbomb)


Title: Re: IRC Bomb
Post by: Google [Bot] on June 05, 2009, 03:08:32 pm
Nice script
very hot ;o
Title: Re: IRC Bomb
Post by: demoniac93 on June 05, 2009, 04:12:25 pm
This one seems even better, the bomb looks huge, and I like the wire deal...
Title: Re: IRC Bomb
Post by: VinceBros on June 05, 2009, 06:00:29 pm
It looks damnly nice :O
Does the wires are randoms to defuse them ?
Good work and ideaz d00d! :)
Title: Re: IRC Bomb
Post by: freestyler on June 05, 2009, 06:22:40 pm
Yes, the bomb timer, number of wires and their 'functions' are all random. If there are more than two wires then one is the defusing one, one doing nothing at all (blank) and the rest make the bomb explode when cut.
Title: Re: IRC Bomb
Post by: jrgp on June 05, 2009, 07:39:12 pm
Wow, the random wire to cut thing within a certain time period is an amazingly unique idea! I'm starting to like the direction server scripts are going! :)
Title: Re: IRC Bomb
Post by: Furai on June 05, 2009, 08:10:58 pm
Question here. Can you setup amount of max/min wires? It would be nice if that possibility was there.
Only admins can start the procedure?
Title: Re: IRC Bomb
Post by: DorkeyDear on June 05, 2009, 10:17:09 pm
Lol I didn't expect to see defusable ones for scripting. Nice job.
Title: Re: IRC Bomb
Post by: freestyler on June 06, 2009, 03:27:13 am
Question here. Can you setup amount of max/min wires? It would be nice if that possibility was there.
Yes, you just have to edit const values in ircbomb.pas:
Code: [Select]
const
  maxnum  = 16; // maximum playerID possible on server, set it higher than number of slots (suggested: slots + 2)
  penalty = 5; // how many points (kills) is taken from the player who survives explosion
  bombtimermin = 15; // minimum possible bomb timer
  bombtimermax = 30; // max
  wiremin = 3; // minimum number of wires sticking out of the bomb
  wiremax = 5; // max
The script forces 'extreme' values if they are too low or too high:
- bombtimermin: minimum 5 seconds
- bombtimermax: maximum 180 seconds (3 minutes)
- wiremin: 2 wires
- wiremax: 10 wires


Only admins can start the procedure?

Yes. If you want to allow everyone to use it, delete whole OnCommand and replace OnPlayerCommand with this:
Code: [Select]
function onplayercommand(id: byte; text: string): boolean;
  var whichtocut, target, timer: byte;
  begin
    if lowercase(copy(text, 1, 5)) = '/bomb' then if id <> 255 then begin
      if length(text) <= 6 then target := randomplayer(id) // if player can't decide then (randomly) make someone happy
        else target := strtoint(getpiece(text, ' ', 1));
      if getplayerstat(target, 'active') = false then begin
        writeconsole(id, 'No such player.', cbad);
        exit;
      end;
      if bombtimer[target] > 0 then begin // if target is already happy then don't put a new bomb on him
        writeconsole(id, idtoname(target) + ' has a bomb on him already...', cmid);
        exit;
      end;
      timer := xrandom(minimumtimer, maximumtimer);
      plantbomb(target, timer); // harrr.
      terrorist[target] := id; // terrorist - player who planted a bomb on someone
      writeconsole(id, inttostr(timer) + '-second bomb planted on ' + idtoname(target) + '!', cgood);
    end;
    if lowercase(getpiece(text, ' ', 0)) = '/cut' then begin
      if bombtimer[id] < 0 then exit else begin
        try whichtocut := strtoint(getpiece(text, ' ', 1));
        except
          writeconsole(id, 'This is not a number. Use /cut 1-' + inttostr(wirenum[id]) + ', i.e. /cut 1', cmid);
          exit;
        end;
        if (whichtocut >= 1) and (whichtocut <= wirenum[id]) then begin
          writeconsole(terrorist[id], idtoname(id) + ' is cutting wire no. ' + inttostr(whichtocut) + '...', cmid);
          defuse(id, whichtocut);
        end else writeconsole(id, 'Wrong wire number. Remaining wires: [ ' + remainingwires(id) + ']', cmid);
      end; 
    end;
    result := false;
  end;
Title: Re: IRC Bomb
Post by: y0uRd34th on June 06, 2009, 05:09:09 am
Well done, when im looking into the older bomb scripts i see u put work into this :D
You may put all these arrays into one type, if you know how to use it.
Title: Re: IRC Bomb
Post by: DarkCrusade on June 06, 2009, 07:12:53 am
HOT :o wanna see this on some servers :)