Author Topic: RS round timer  (Read 1648 times)

0 Members and 1 Guest are viewing this topic.

Offline Zabijaka

  • Soldier
  • **
  • Posts: 201
  • Soldat Fan, Hitman Fan
RS round timer
« on: July 07, 2009, 11:38:21 am »
Hello, this is My first script xD
I plan upgrade this script.

Script Name:  RS Round Timer
Script Description:  this script add timer to survival mode, works good only in survival mode! Default round time is 120sec, if You kill enemy before time is over You survive without death :) . If time is over all alive player go to hell xD and team score = draw!
Original Author(s):  help topics ;]
Core Version:  2.6.5
Code:
Code: [Select]
//use this script only i ctf survival mode

const
roundtime=120;    //Set round time here
color = $FFFFFF; //Set color of msg

var
Timer: integer;
scriptOn: byte;
i: integer;


procedure ActivateServer();
begin
scriptOn:=1;
WriteLn('Round Timer is On');
end;

procedure AppOnIdle(Ticks: integer);
begin
     if Timer > 0  then
          Timer := Timer - 1;
     if Timer =  90 then begin
WriteConsole(0, '90 sec left!', color);
end;
     if Timer =  60 then begin
WriteConsole(0, '60 sec left!', color);
end;
     if Timer = 30 then begin
WriteConsole(0, '30 sec left!', color);
end;
     if Timer = 15 then begin
WriteConsole(0, '15 sec left!', color);
end;
     if (Timer <= 10) and (Timer >= 1) then begin
    WriteConsole(0,IntToStr(Timer) + ' sec left!', color);
end;
     if (Timer = 0)  then begin
          for i := 1 to 32 do
                if ( NumPlayers < 2 ) or (GetPlayerStat(i,'Alive') = false) then begin
exit end;
WriteConsole(0, 'Round Time Over!', color);
for i := 1 to 32 do
if (GetPlayerStat(i,'Team') = 1) and (GetPlayerStat(i,'Alive') = true) then begin
DoDamage(i, 4000);
end;
for i := 1 to 32 do
if (GetPlayerStat(i,'Team') = 2) and (GetPlayerStat(i,'Alive') = true) then begin
DoDamage(i, 4000);
if ( NumPlayers >=2 ) and (GetPlayerStat(i,'Health') < 0) then begin
SetTeamScore(2, BravoScore - 1);
Timer := -1;
end;
end;
end;
end;



procedure OnPlayerRespawn(ID: Byte);
begin
     if scriptOn = 1  then begin
          Timer := roundtime;
     end;
end;
« Last Edit: July 09, 2009, 09:37:39 am by Zabijaka »

Offline Mittsu

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 617
Re: RS round timer
« Reply #1 on: July 07, 2009, 12:28:16 pm »
will this result with a draw when the time is over (no points given to any team)?

also, it gives you +1 in Deaths, right?
Realistic-Soldat.net
<+elerok> soldat is dead
<+AThousandD> shit happens

Offline Polifen

  • Soldier
  • **
  • Posts: 127
Re: RS round timer
« Reply #2 on: July 07, 2009, 12:47:56 pm »
1. No.
FIX : Look who is last player, in witch team he is and decrease team's point by one.

2. Yes.
FIX : I think none :<.

3. Idea : Use DoDamage(i, 4000) instead of /kill to remove spam.
« Last Edit: July 07, 2009, 12:51:17 pm by Polifen »

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: RS round timer
« Reply #3 on: July 07, 2009, 01:59:58 pm »
For your first script well done, but here a few changes you should make :D

add a const time = XXX; so every guy can easy edit the round time ;)

Code: [Select]
     if Timer = 5 then begin
WriteConsole(0, '5 sec left!', $FFFFFF);
end;
     if Timer = 4 then begin
WriteConsole(0, '4 sec left!', $FFFFFF);
end;
     if Timer = 3 then begin
WriteConsole(0, '3 sec left!', $FFFFFF);
end;
     if Timer = 2 then begin
WriteConsole(0, '2 sec left!', $FFFFFF);
end;
     if Timer = 1 then begin
WriteConsole(0, '1 sec left!', $FFFFFF);
end;
do this instead:

Code: [Select]
if (Timer <= 5) and (Timer >= 1) then begin
   WriteConsole(0,IntToStr(Timer) + ' sec left!',$FFFFFF);
end;

You can delete the begin & end, it's just for better overview :D
Hope I helped you^^

Offline Zabijaka

  • Soldier
  • **
  • Posts: 201
  • Soldat Fan, Hitman Fan
Re: RS round timer
« Reply #4 on: July 07, 2009, 02:09:49 pm »
Thx  for better overview xD

Hope I fix some bugs... anyway round time is limited xD

Offline Mittsu

  • Soldat Beta Team
  • Flagrunner
  • ******
  • Posts: 617
Re: RS round timer
« Reply #5 on: July 07, 2009, 02:43:08 pm »
1. No.

oh, then it doesnt make much sense :|
Realistic-Soldat.net
<+elerok> soldat is dead
<+AThousandD> shit happens

Offline Zabijaka

  • Soldier
  • **
  • Posts: 201
  • Soldat Fan, Hitman Fan
Re: RS round timer
« Reply #6 on: July 08, 2009, 06:29:41 pm »
OK, I fix script