Author Topic: Help with basic script  (Read 7804 times)

0 Members and 1 Guest are viewing this topic.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Help with basic script
« Reply #60 on: June 10, 2010, 03:02:28 am »
wth im getting a crapload of errors with that code

im geting a syntax error and Begin expected error on line [2:2] to start with
check out my server! click here

If at first you don't succeed, Improvise! :D

DarkCrusade

  • Guest
Re: Help with basic script
« Reply #61 on: June 10, 2010, 06:38:19 am »
I just acknowledged that there are random invisible chars that mess everything up. I'll post the corrected code in some minutes :3

EDIT: This should be working now..

Code: (pascal) [Select]
const
  ClBad  = $FFFF44;
  ClGood = $EE00FF;

Type
  Stats = Record
  LongTime: Boolean;
  TSec,Tmin,BTSec,BTMin: Integer;
end;

var
  Player: Array[1..32] of Stats;
LongestTime: Array[1..2] of Integer;

Procedure ResetStats(ID:Byte);
  begin
 Player[ID].LongTime := false;
end;

Procedure CheckTime(ID:Byte);  
begin
    if Player[ID].BTMin > LongestTime[1] then begin
  LongestTime[1] := Player[ID].BTMin;
    LongestTime[2] := Player[ID].BTSec;
    Player[ID].LongTime := true;
WriteConsole(0,IDToName(ID) + ' beats the record! His surviving time is ' + inttostr(Player[ID].BTMin) + ' minutes and ' + inttostr(Player[ID].BTSec) + ' seconds!', ClGood);
end else begin
      if Player[ID].BTMin = LongestTime[1] then
  if Player[ID].BTSec > LongestTime[2] then begin
      LongestTime[1] := Player[ID].BTMin;
    LongestTime[2] := Player[ID].BTSec;
    Player[ID].LongTime := true;
WriteConsole(0,IDToName(ID) + ' beats the record! His surviving time is ' + inttostr(Player[ID].BTMin) + ' minutes and ' + inttostr(Player[ID].BTSec) + ' seconds!', ClGood);
end;
      end;
  end;

Procedure OnJoinGame(ID,Team:Byte);
  begin
  ResetStats(ID);
end;

Procedure AppOnIdle(Ticks: integer);
var
  i:Byte;
begin
 for i:= 1 to 32 do if (GetPlayerStat(i,'Active') = true) AND (GetPlayerStat(i,'Alive') = true) then begin
if GetPlayerStat(i,'Human') = true then begin
    TSec[i]:= TSec[i] + 1;
    if TSec[i] = 60 then begin
      TMin[i]:= TMin[i] + 1;
      TSec[i]:= 0;
end;
    end else begin
      if TSec[i] > 0 then BTSec[i] := TSec[i];
      TSec[i] := 0;
      if TMin[i] > 0 then BTMin[i]:= TMin[i];
      TMin[i] := 0;
CheckTime(i);
      end;
end;
end;
« Last Edit: June 10, 2010, 06:45:01 am by DarkCrusade »

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Help with basic script
« Reply #62 on: June 11, 2010, 12:46:40 am »
(49:13): Unknown identifier 'TSec'

wtf?
i have had a look at the code but i dont get why its unknown since its defined in the Type
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Help with basic script
« Reply #63 on: June 11, 2010, 01:31:31 am »
There is no array called TSec tho. Dark, didnt declare it.


DarkCrusade

  • Guest
Re: Help with basic script
« Reply #64 on: June 11, 2010, 02:01:28 am »
I didn't test the code, I kind of rushed through it due to school stuff waiting for me and I actually thought you were able to debug a script yourself, Frosty :3

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: Help with basic script
« Reply #65 on: June 11, 2010, 02:01:58 am »
i can :3 but im still having same issue

still showing 0:0

i declared them in vars hacktank now it compiles

hers the full code: (see attachment)

From: June 12, 2010, 11:24:39 pm
Bump! still not working, someone help plz, this is irritating
« Last Edit: June 12, 2010, 11:24:39 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D