Author Topic: Some script help  (Read 785 times)

0 Members and 1 Guest are viewing this topic.

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Some script help
« on: May 31, 2008, 03:12:20 am »
1.Hp Regeneration Script by Avkon
I used this scrpt for my server and my question is: How to use this script only for one team? For Exmaple: Only Alpha Regenerates HP(script is regenerating all teams)
P.S: I don't want second team regenerating(bots).
Source:
Quote
// Health Regeneration Script v1.2 by Avkon
// This script automatically replenishes lost health of all players at a specified pace.

// Declare a couple of essential values:
const
  MAX_HEALTH = 150; // Set to 150 for non-realistic mode, else set to 65.
  DROP_VALUE = 5;   // Value of each 'drop' of health, def: 5.

// Incorporate main health regen code into AppOnIdle procedure:
procedure AppOnIdle(Ticks: integer);
var i: byte;
begin
  if Ticks mod (60 * 1) = 0 then begin
  for  i := 1 to 32 do
    if (GetPlayerStat(i,'Health') < (MAX_HEALTH - (DROP_VALUE - 1))) then begin
      DoDamage(i,-DROP_VALUE);
    end else begin
      DoDamage(i,-(MAX_HEALTH - (GetPlayerStat(i,'Health'))));
    end;
  end;
end;

// Inform players of health regen modification:
procedure OnJoinTeam(ID, Team: byte);
begin
  SayToPlayer(ID, 'This server runs the following mod:');
  SayToPlayer(ID, '! Health Regeneration Script v1.2 (by Avkon)');

2. Team Mover Script:
I maked a little script for playres that they cannot join bravo.The problem is , that when someone joins the bravo , it makes a bravo player redirected to alpha and the player stands in bravo.(When player joins bravo, he joins it!)
Source:
Quote
procedure OnJoinTeam(ID, Team: byte);
begin
  if Team=2 then begin
    WriteConsole(ID, 'This is not your team!', $90C2A0);
    Command('/setteam1' +inttostr(ID));
  end;
end;

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Some script help
« Reply #1 on: May 31, 2008, 03:34:35 am »
This should work.
Code: [Select]
procedure AppOnIdle(Ticks: integer);
var i: byte;
begin
  for  i := 1 to 32 do
    if GetPlayerStat(i, 'Team') = 1 then
      if (GetPlayerStat(i,'Health') < (MAX_HEALTH - (DROP_VALUE - 1))) then
        DoDamage(i,-DROP_VALUE)
      else
        DoDamage(i,-(MAX_HEALTH - (GetPlayerStat(i,'Health'))));
end;

As for the team mover, I don't really understand the problem, but you need a space after /setteam1
Code: [Select]
procedure OnJoinTeam(ID, Team: byte);
begin
  if Team = 2 then begin
    WriteConsole(ID, 'This is not your team!', $90C2A0);
    Command('/setteam1 ' + inttostr(ID));
  end;
end;

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Some script help
« Reply #2 on: May 31, 2008, 03:52:05 am »
I'll try!

Date Posted: May 31, 2008, 04:43:55 am
Thx , it worked