Author Topic: Doubledamage Problems (still not working)  (Read 749 times)

0 Members and 1 Guest are viewing this topic.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Doubledamage Problems (still not working)
« on: November 05, 2008, 08:56:07 pm »
I am trying to make a doubledamage script so I can have a powered down beserk that stacks with normal beserk, pred, and flamer. I have made code that should work but i dunno what the problem is. Here is my script, I use it for many other things also, on a side note does anyone know why the /kaz part doesnt work?

Type Player = Record
  Active:     Boolean;
  Countdown:  Integer;
End;

var
  Players: Array[1 .. 32] Of Player;

function OnCommand(ID: byte; text: string): boolean;
var l: integer;
begin
begin
  if text = '/kaz' then begin
    for l := 1 to 12 do begin
      DoDamage(l,9000);
    end;
  end;
end;

begin
    if text = '/flamer' then begin
  ForceWeapon(ID,11,15,0);
  end;
    if text = '/bow' then begin
  ForceWeapon(ID,12,13,0);
  end;
    if text = '/nade' then begin
  GiveBonus(ID,4);
  end;
    if text = '/ivs' then begin
  GiveBonus(ID,1);
  end;
end;
end;

procedure AppOnIdle(Ticks: integer);
var
i: Byte;
begin
For i := 1 To 32 Do Begin
   If Players.Active Then Begin
   If Players.Countdown > 0 Then Begin
      DrawText(i,'Double Damage!      ' + IntToStr(Players.Countdown),60,$FFFF0000);
   Players.Countdown := Players.Countdown - 1;   
   end;
   end;
   end;
   end;


   
function OnPlayerDamage(Victim, Shooter: Byte; Damage: Integer) : Integer;
      Begin
      if Players[Shooter].Active = 1 then begin
       Result := Damage+Damage;
       end;
       end;

   
procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
if text = '!rules' then begin
      WriteConsole(ID,'*********************',$99222222);
      WriteConsole(ID,'Server Guidelines',$ff5555ff);
      WriteConsole(ID,'No Pushing',$ffff0000);
      WriteConsole(ID,'No Flaming',$ffff0000);
     WriteConsole(ID,'No Hacking',$ffff0000);
     WriteConsole(ID,'Have Fun',$ffff0000);
     WriteConsole(ID,'*********************',$99222222);
end;
end;

procedure OnFlagReturn(ID, TeamFlag: byte);
begin
if Teamflag = 1 then begin
SetScore(ID,GetPlayerStat(ID,'KILLS')+2);
Players[ID].Countdown := Playeres[ID].Countdown+15;
Players[ID].Active := True;

end;
end;

procedure OnFlagScore(ID, TeamFlag: byte);
begin
if Teamflag = 2 then begin
GiveBonus(ID,1);
GiveBonus(ID,3);
GiveBonus(ID,5);
Players[ID].Countdown := Playeres[ID].Countdown+30;
Players[ID].Active := True;

end;
end;
« Last Edit: November 06, 2008, 06:35:51 pm by Hacktank »


Offline Rampage_Terranius

  • Major
  • *
  • Posts: 69
  • The Strategist
    • Soldat Noob Servers
Re: Doubledamage Problems
« Reply #1 on: November 05, 2008, 11:17:36 pm »
if /kaz is meant to dodamage to people you might want to check if they are active doing damage to an inactive id isnt the best of ideas it causes out of range errors

heres a quick fix for that

Code: [Select]
begin
  if text = '/kaz' then begin
    for l := 1 to 12 do begin
      If GetPlayerStat(l, 'Active') = True Then DoDamage(l,9000);
    end;
  end;
end;

i didnt test that but it should work fine

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Doubledamage Problems
« Reply #2 on: November 05, 2008, 11:26:33 pm »
Well you spelled players wrong for the a couple of the variables.
Hint: They are in here:
Quote
procedure OnFlagReturn(ID, TeamFlag: byte);
begin
if Teamflag = 1 then begin
SetScore(ID,GetPlayerStat(ID,'KILLS')+2);
Players[ID].Countdown := Playeres[ID].Countdown+15;
Players[ID].Active := True;
end;
end;

procedure OnFlagScore(ID, TeamFlag: byte);
begin
if Teamflag = 2 then begin
GiveBonus(ID,1);
GiveBonus(ID,3);
GiveBonus(ID,5);
Players[ID].Countdown := Playeres[ID].Countdown+30;
Players[ID].Active := True;
end;
end;
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Doubledamage Problems
« Reply #3 on: November 06, 2008, 12:40:23 am »
Thanks Chutem it doesnt give me any more compile errors, i cant believe i didnt notice that... lol And Rampage it is a zombie server and players 1-12 are bots. Now I get an error with the specialbots script: ([Error] SpecialBots -> (OnPlayerRespawn): Access violation at address 0049484D in module 'soldatserver.exe'. Read of address 00F52D7E)
EDIT I rewrote the double damage part of the script and it gives me errors about assignment - (16:29:19) textcmd -> [Error] (60:23): Assignment expected

I think I may have gotten rid of 1 or 2 lines since that error but it still doesent work :( ty for the help

Code: [Select]
Type Player = Record
  Active:     Boolean;
  Countdown:  Byte;
End;

var
  Players: Array[1 .. 32] Of Player;
  i, l : Byte;
 
 procedure ActivateServer();
begin
Command('/addbot2 Slicer Zombie');
Command('/addbot2 Slicer Zombie');
Command('/addbot2 Vortex');
Command('/addbot2 Elite Zombie');
Command('/addbot2 Elite Zombie');
Command('/addbot2 Kamakazi');
Command('/addbot2 Zombie');
Command('/addbot2 Zombie');
Command('/addbot2 Zombie');
Command('/addbot2 Zombie');
Command('/addbot2 Zombie');
Command('/addbot2 Zombie');
end;

function OnCommand(ID: byte; text: string): boolean;
begin
begin
  if text = '/kaz' then begin
    for l := 1 to 12 do begin
      DoDamage(l,90000);
    end;
  end;
end;
    if text = '/flamer' then begin
  ForceWeapon(ID,11,15,0);
  end;
    if text = '/bow' then begin
  ForceWeapon(ID,12,13,0);
  end;
    if text = '/nade' then begin
  GiveBonus(ID,4);
  end;
    if text = '/ivs' then begin
  GiveBonus(ID,1);
  end;
end;

procedure AppOnIdle(Ticks: integer);
begin
For i := 1 To 32 Do Begin
if GetPlayerStat(i,'Active') = True Then begin
If Players[i].Active Then Begin
If Players[i].Countdown > 0 Then Begin
DrawText(i,'Double Damage!        ' + IntToStr(Players[i].Countdown),60,$ffff0000,0.20,40,450);
Players[i].Countdown = Players[i].Countdown - 1;
end;
end;
end;
end;
end;

function OnPlayerDamage(Victim, Shooter: Byte; Damage: Integer) : Integer;
Begin
if Players[Shooter].Active = 1 then begin
Result = Damage+Damage;
end;
end;

procedure OnJoinGame(ID, Team: byte);
begin
      WriteConsole(ID,'*********************',$77FF00FF);
      WriteConsole(ID,'Server By |FA| Hacktank',$ff5555ff);
      WriteConsole(ID,'Type !rules for rules',$ffff0000);
      WriteConsole(ID,'Type !nextmap for nextmap voting',$ffff0000);
  WriteConsole(ID,'All Bravo are bots',$ffff0000);
  WriteConsole(ID,'HTTP://forums.blitwise.com',$ffffffff);
  WriteConsole(ID,'*********************',$77FF00FF);
  end;

procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
if text = '!rules' then begin
      WriteConsole(ID,'*********************',$99222222);
      WriteConsole(ID,'Server Guidelines',$ff5555ff);
      WriteConsole(ID,'No Pushing',$ffff0000);
      WriteConsole(ID,'No Flaming',$ffff0000);
  WriteConsole(ID,'No Hacking',$ffff0000);
  WriteConsole(ID,'Have Fun',$ffff0000);
  WriteConsole(ID,'*********************',$99222222);
end;
end;

procedure OnFlagReturn(ID, TeamFlag: byte);
begin
if Teamflag = 1 then begin
SetScore(ID,GetPlayerStat(ID,'KILLS')+2);
Players[ID].Countdown = Players[ID].Countdown+15;
Players[ID].Active := True;
end;
end;

procedure OnFlagScore(ID, TeamFlag: byte);
begin
if Teamflag = 2 then begin
GiveBonus(ID,1);
GiveBonus(ID,3);
GiveBonus(ID,5);
Players[ID].Countdown = Players[ID].Countdown+30;
Players[ID].Active = True;
end;
end;
« Last Edit: November 06, 2008, 06:35:34 pm by Hacktank »


Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Doubledamage Problems (still not working)
« Reply #4 on: November 08, 2008, 06:45:02 pm »
Whenever you want to set a value for a variable, you need to use Variable := 10
Note it is not Variable = 10, you need the little colon

There is 5 places where you made this mistake, although in one place you did put the colon, so that makes me confused as to why you only did it once.

And BTW when using 'for' loops you will need the colon.
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs