Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: DorkeyDear on August 04, 2007, 04:21:21 pm

Title: Admin Invincibility
Post by: DorkeyDear on August 04, 2007, 04:21:21 pm
Script Name: Admin Invincibility
Script Description: When an admin does '/invin', he / she becomes invincible. Repeat the command to turn invincibility off.
Original Author: Curt (DorkeyDear)
Core Version: 2.6.1b
Code:
Code: [Select]
var
  Invincible: array[1..32] of boolean;

function OnCommand(ID: Byte; Text: string): boolean;
begin
  Result := false;
  if Text = '/invin' then if Invincible[ID] then begin
    WriteConsole(ID,'Invincibility has been disabled.',$FFFFFFFF);
    Invincible[ID] := false;
  end else begin
    WriteConsole(ID,'Invincibility has been enabled.',$FFFFFFFF);
    Invincible[ID] := true;
  end;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
  Invincible[ID] := false;
end;

function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
begin
  if Invincible[Victim] then Result := 0 else Result := Damage;
end;
In request from miketh2005.
Title: Re: Admin Invincibility
Post by: Toumaz on August 04, 2007, 04:35:54 pm
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.

Changing
Code: [Select]
if Invincible[Victim] then Result := 0 else Result := Damage;into
Code: [Select]
if Invincible[Victim] then Result := -9999 else Result := Damage;would do just fine.
Title: Re: Admin Invincibility
Post by: miketh2005 on August 04, 2007, 05:03:31 pm
thanx

but on my server were do you put the var in the begining?
Title: Re: Admin Invincibility
Post by: ghg on August 04, 2007, 05:54:37 pm
At the beginning.
Title: Re: Admin Invincibility
Post by: Freedom on August 16, 2007, 04:35:22 am
It doesn't work :/
But it makes me immortal xD
Title: Re: Admin Invincibility
Post by: Iq Unlimited on August 16, 2007, 07:57:54 am
It doesn't work :/
But it makes me immortal xD
uhh...isn't that the point of the script?
Title: Re: Admin Invincibility
Post by: Freedom on August 16, 2007, 08:22:02 am
Quote
uhh...isn't that the point of the script?

My mistake :D
Title: Re: Admin Invincibility
Post by: JoeCool on August 16, 2007, 11:43:34 am
where do i put this in, possibly a screen if possible, i suxorz at scripting.
Title: Re: Admin Invincibility
Post by: DorkeyDear on August 16, 2007, 12:12:16 pm
Hopefully I'll get around to creating a zip with contents of the script for all my scripts, but that may be a few days.
For now, I'll tell you just to create a sub-directory in the scripts folder, and in there, have an Includes.txt with some file name in there, then create the "some file name" in the sub-directory (.pas is good extension) and paste the code in there, and save.
Title: Re: Admin Invincibility
Post by: Dr. Zombi3 on August 16, 2007, 01:04:27 pm
Cool... but isint it unfair to the other players?
Title: Re: Admin Invincibility
Post by: danmer on August 16, 2007, 01:08:59 pm
Cool... but isint it unfair to the other players?
O RLY
If you're the admin, you know what you're doing, duh?
Especially when it says that it was created "In request from miketh2005."
Title: Re: Admin Invincibility
Post by: DorkeyDear on August 16, 2007, 01:11:17 pm
I post pretty much everything people request from me, if I remember to or if I don't lose the script. :)
I would never put this script on any server hosted that I have access to and permission to do stuff in.
Title: Re: Admin Invincibility
Post by: miketh2005 on December 18, 2007, 09:18:07 pm
thanx

Date Posted: September 23, 2007, 07:30:14 pm
can u put this in a .zip plz?