Author Topic: Invincibility for Cappers  (Read 2241 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Invincibility for Cappers
« on: August 25, 2007, 07:54:02 pm »
Script Name: Invincibility for Cappers
Script Description: Every time you capture the flag, you gain 1 more chance to use the invincibility command, which lasts for a specified amount of time.
Original Author: Curt
Core Version: 2.6.2
Code:
Code: [Select]
const
  Color = $FFFFFFFF;
  Time = 10;

var
  InvinCount, Invincable: array[1..32] of byte;

procedure AppOnIdle(Ticks: integer);
var
  i: byte;
begin
  for i := 1 to 32 do if Invincable[i] > 0 then begin
    Invincable[i] := Invincable[i] - 1;
    if Invincable[i] = 0 then WriteConsole(i,'You are no longer invincable.',Color);
  end;
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
  if (Text = '/inv') or (Text = '/invin') or (Text = '/invincible') or (Text = '/invincibility') then begin
    if Invincable[ID] = 0 then begin
      if InvinCount[ID] > 0 then begin
        InvinCount[ID] := InvinCount[ID] - 1;
        Invincable[ID] := Time;
        WriteConsole(ID,'You are now invincible for ' + InttoStr(Time) + ' second' + iif(Time = 1,'','s') + '.',Color);
      end else WriteConsole(ID,'You do not have enough remaining captures available.',Color);
    end else WriteConsole(ID,'You are already invincible.',Color);
  end;
end;

procedure OnFlagScore(ID, TeamFlag: byte);
begin
  InvinCount[ID] := InvinCount[ID] + 1;
end;

function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  if Invincable[Victim] = 0 then Result := Damage else Result := 0;
end;
In request from Ttil_Np.csWoW
« Last Edit: August 25, 2007, 09:03:44 pm by DorkeyDear »

Offline Ttil_Np.csWoW

  • Major
  • *
  • Posts: 55
  • The Berserkers Are Coming....
Re: Invincibility for Cappers
« Reply #1 on: August 25, 2007, 09:32:20 pm »
You are amazing!
I will be back to play soldat, just not now , but i will....... some day.

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Invincibility for Cappers
« Reply #2 on: August 25, 2007, 11:47:24 pm »
Err, again:

If you really want to have the player completely invincible you need to set the Result in OnPlayerDamage to a relatively big negative value; or else the player will die from explosives.

If you set Result to 0 the player can still die from direct hits from M79 shells and LAW rockets; -4000 works just fine.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Invincibility for Cappers
« Reply #3 on: August 26, 2007, 11:26:19 am »
I still use 0 sense doing -4000 would basically heal him, and if he was initially hurt, then the player would be healed, and sense this is for a climb server (i think), it would probably be better to have it 0 than -4000 or whatever sense there are no m79s or LAWs.

Offline miketh2005

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 668
  • What's the URL for www.microsoft.com?
Re: Invincibility for Cappers
« Reply #4 on: September 05, 2007, 08:29:57 am »
thanx, I'll implement this on my server now...
Quote from: 'Ando.' pid='12999178' dateline='1309046898'
My new password is secure as shit :)
Mate, I am not sure Shit is even secured nowadays.