Author Topic: help T_T (plz)  (Read 1048 times)

0 Members and 1 Guest are viewing this topic.

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
help T_T (plz)
« on: September 27, 2007, 08:15:46 pm »
ok, I have NO IDEA what's wrong with this script, but something apparently is

Code: [Select]
var
  Disabled: boolean;
  Weap, Inv: array[1..32] of boolean;
  timem, timel, timef, timeg, invs, invt: array[1..32] of integer;

procedure AppOnIdle(Ticks:integer);
var
  i:integer;
begin
  for i:=1 to 32 do begin
    if timem[i] > 0 then timem[i]:=timem[i]-1;
    if timel[i] > 0 then timel[i]:=timel[i]-1;
    if timef[i] > 0 then timef[i]:=timef[i]-1;
    if timeg[i] > 0 then timeg[i]:=timeg[i]-1;
    if invt[i] > 0 then invt[i]:=invt[i]-1;
  end;
end;

function OnCommand(ID:Byte;Text:string):boolean;
var
  i:byte;
  Temp1, Temp2: string;
begin
  Result:=false;
  Temp1:=GetPiece(LowerCase(Text), ' ', 0);
  Temp2:=GetPiece(LowerCase(Text), ' ', 1);
//-----Disable+Enable-----
  if (Temp1 = '/pcom') then begin
    if (Temp2 = 'off') then begin
      Disabled:=true;
      Command('/say PlayerCommands script disabled by '+GetPlayerStat(ID,'Name'));
      for i:=1 to 32 do begin
        Weap[i]:=false;
        ForceWeapon(i,255,255,0);
      end;
    end;
    if (Temp2 = 'on') then begin
      Disabled:=false;
      Command('/say PlayerCommands script enabled by '+GetPlayerStat(ID,'Name'));
    end;
  end;
end;

function OnPlayerCommand(ID:Byte;Text:string):boolean;
begin
  Result:=false;
  if (Text = '/inv') {or (Text = '/invin') or (Text = '/invince') }then begin
    if (Inv[ID] = false) and (invs[ID] > 0) and (invt[ID] = 0) then begin
      SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),18);
      ForceWeapon(ID,255,255,0);
      invt[ID]:=70;
      Inv[ID]:=true;
      invs[ID]:=invs[ID]-1;
    end;
    if (Inv[ID]) then SayToPlayer(ID,'Cannot use, already invincible.');
    if (invs[ID] = 0) then SayToPlayer(ID,'Cannot use, not enough flag captures.');
    if (invt[ID] > 0) then SayToPlayer(ID,'Cannot use, must wait '+inttostr(invt[ID])+' seconds.');
    if (invt[ID] = 60) then Inv[ID]:=false;
  end;
  if (Text = '/save') and (Weap[ID]) then Result:=true;
  if (Text = '/load') and (Weap[ID]) then Result:=true;
end;

procedure OnPlayerSpeak(ID: byte; Text: string);
var
  chunk1, chunk2: integer;
  force1, force2: byte;
  works1, works2: boolean;
begin
  if (Disabled = false) then begin
  if (Text = '!heal') then begin
  DoDamage(ID,-(150-GetPlayerStat(ID,'Health')));
  end;
//-----!minigun-----
  if (Text = '!mng') or (Text = '!mini') or (Text = '!minigun') then begin
    if (timem[ID] = 0) then begin
      ForceWeapon(ID,10,GetPlayerStat(ID,'Secondary'),0);
      Weap[ID]:=true;
      timem[ID]:=120;
    end;
    if (timem[ID] > 0) then SayToPlayer(ID,'Cannot use for '+inttostr(timem[ID])+' seconds.');
  end;
//-----!law-----
  if (Text = '!law') then begin
    if (timel[ID] = 0) then begin
      ForceWeapon(ID,16,GetPlayerStat(ID,'Secondary'),0);
      Weap[ID]:=true;
      timel[ID]:=120;
    end;
    if (timel[ID] > 0) then SayToPlayer(ID,'Cannot use for '+inttostr(timel[ID])+' seconds.');
  end;
//-----!flamer-----
  if (Text = '!flm') or (Text = '!flame') or (Text = '!flamer') then begin
    if (timef[ID] = 0) then begin
      ForceWeapon(ID,11,GetPlayerStat(ID,'Secondary'),0);
      Weap[ID]:=true;
      timef[ID]:=120;
    end;
    if (timef[ID] > 0) then SayToPlayer(ID,'Cannot use for '+inttostr(timef[ID])+' seconds.');
  end;
//-----Fly gears-----
  if GetPiece(LowerCase(Text), ' ', 0) = '!gear' then begin
  chunk1:=strtoint(GetPiece((Text), ' ', 1));
  chunk2:=strtoint(GetPiece((Text), ' ', 2));
    if (timeg[ID] = 0) then begin
//-----Set chunk1-----
      if (chunk1 < 1) or (chunk1 > 3) then works1:=false;
      if (chunk1 > 0) and (chunk1 < 4) then works1:=true;
      if (chunk1 = 1) then force1:=10;
      if (chunk1 = 2) then force1:=16;
      if (chunk1 = 3) then force1:=11;
//-----Set chunk2-----
      if (chunk2 < 1) or (chunk2 > 3) then works2:=false;
      if (chunk2 > 0) and (chunk2 < 4) then works2:=true;
      if (chunk2 = 1) then force2:=10;
      if (chunk2 = 2) then force2:=16;
      if (chunk2 = 3) then force2:=11;
//-----Force-----
      if (works1) and (works2) then ForceWeapon(ID,force1,force2,0);
      if (works1 = false) then SayToPlayer(ID,'Gear 1 is over or under limit (1 to 3)');
      if (works2 = false) then SayToPlayer(ID,'Gear 2 is over or under limit (1 to 3)');
      if (works1) and (works2) then Weap[ID]:=true;
      if (works1) and (works2) then timeg[ID]:=120;
    if (timeg[ID] > 0) then SayToPlayer(ID,'Cannot use for '+inttostr(timeg[ID])+' seconds.');
  end;
  end;
end;

procedure OnFlagGrab(ID, TeamFlag: Byte; GrabbedInBase: boolean);
begin
  if Weap[ID] then DoDamage(ID,4444);
end;

procedure OnFlagScore(ID,TeamFlag:byte);
var
  success: array[1..32] of boolean;
begin
  if Weap[ID] then begin
    DoDamage(ID,4444);
    success[ID]:=false;
  end;
  if (Weap[ID] = false) and (success[ID] <> false) then invs[ID]:=invs[ID]+1;
end;

procedure OnMapChange(NewMap: string);
var
  i: byte;
begin
  for i:=1 to 32 do Weap[i]:=false;
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
  Weap[Victim]:=false;
end;

procedure OnJoinGame(ID, Team: byte);
begin
  if Weap[ID] then Weap[ID]:=false;
end;

procedure OnJoinTeam(ID, Team: byte);
begin
  if Weap[ID] then Weap[ID]:=false;
end;

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

it says Identifier expected for almost every function/procedure line in it

what hell IS this!!!???

Date Posted: September 27, 2007, 09:14:09 pm
OnCommand, OnPlayerCommand, AppOnIdle, and OnPlayerSpeak are fine, but when I comment out the rest, it says something about line 170 needing an identifyer even if there isn't 170+ lines
« Last Edit: September 27, 2007, 09:50:08 pm by Kavukamari »
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: help T_T (plz)
« Reply #1 on: September 27, 2007, 11:25:20 pm »
You've messed stuff up in this part, or you've missed placing an end somewhere. It compiles fine if you remove the if Text='!heal' line, or if you add another end;. I don't have time to thoroughly debug it though, so good luck with that.

Code: [Select]
  if Disabled=false then begin
  if Text='!heal' then begin
  DoDamage(ID,-(150-GetPlayerStat(ID,'Health')));
  end;

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: help T_T (plz)
« Reply #2 on: September 28, 2007, 09:27:36 pm »
wow... that's it?... *feels very VERY stupid* O.o

sorry to take away from your life because of a missed end;
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."