Author Topic: Keep getting a compile error... (new prob)  (Read 1082 times)

0 Members and 1 Guest are viewing this topic.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Keep getting a compile error... (new prob)
« on: October 18, 2008, 01:28:16 am »
Ok im still getting the hang of Pascal and I am making a general command and gameplay enhancment script, but when I try to compile I get this error (in arsse)

Code: [Select]
[Error] (43:4) Unknown identifier 'ID'
I have been using ID on my previous commands (bottom ones are given me trouble).

IDs 1-12 are zombies ID 6 is the Kamakazi (i know its spelled wrong, it is purposfull)

Here is my script:
Code: [Select]
function OnCommand(ID: byte; text: string): boolean;
begin
  if text = '/kaz' then begin
      DoDamage(1,9000);
  DoDamage(2,9000);
  DoDamage(3,9000);
  DoDamage(4,9000);
  DoDamage(5,9000);
  DoDamage(6,9000);
  DoDamage(7,9000);
  DoDamage(8,9000);
  DoDamage(9,9000);
  DoDamage(10,9000);
  DoDamage(11,9000);
  DoDamage(12,9000);
  end;
    if text = '/flamer' then begin
  ForceWeapon(ID,15,255,0);
  end;
    if text = '/bow' then begin
  ForceWeapon(ID,16,255,0);
  end;
    if text = '/nade' then begin
  GiveBonus(ID,5);
  end;
    if text = '/ivs' then begin
  GiveBonus(ID,1);
  end;
end;

procedure OnPlayerSpeak(ID: Byte; Text: string);
begin
if text = '!rules' then begin
      WriteConsole(ID,'No Pushing',$ffff0000);
      WriteConsole(ID,'No Flaming',$ffff0000);
  WriteConsole(ID,'No Hacking',$ffff0000);
  WriteConsole(ID,'Have Fun',$ffff0000);
end;
end;
function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer) : integer;
begin
if ID = 6 then begin
DoDamage(6,9000);
Result:= Damage;
end;
end;
procedure OnFlagScore(ID, TeamFlag: byte);
begin
SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),19);
SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),16);
SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),17);
end;

Thank You!
« Last Edit: October 18, 2008, 03:17:27 pm by Hacktank »


Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Keep getting a compile error...
« Reply #1 on: October 18, 2008, 01:31:56 am »
ID should be either Victim or Shooter in OnPlayerDamage, depending on what you're trying to achieve. And on a slightly unrelated note, I suggest you to read up on for loops as well.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Keep getting a compile error...
« Reply #2 on: October 18, 2008, 01:46:16 am »
Thanks! Also what are the weapon ids for the flamer and the rambo bow?


Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Keep getting a compile error...
« Reply #3 on: October 18, 2008, 01:55:53 am »
Have a look at the top of core.pas:

FLAMER = 11;
BOW = 12;
FLAMEBOW = 13;

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Keep getting a compile error... (new prob)
« Reply #4 on: October 18, 2008, 03:18:59 pm »
Ok I dont get anymore errors but now my /kaz dosent work, I have tried getting rid of all the things in the script other than the /kaz part but it still does noting when I put it in...


Offline Norbo

  • Camper
  • ***
  • Posts: 338
Re: Keep getting a compile error... (new prob)
« Reply #5 on: October 18, 2008, 06:09:06 pm »
Ok I dont get anymore errors but now my /kaz dosent work, I have tried getting rid of all the things in the script other than the /kaz part but it still does noting when I put it in...
make sure u are an admin because u used OnCommand
OnCommand = only for admin use
OnPlayerCommand = for everyone

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Keep getting a compile error... (new prob)
« Reply #6 on: October 18, 2008, 11:57:25 pm »
It still lets me use /bow and /flamer, and when I try to use /kaz it may kill 1 or 2 zombies then not work again... wtf.
EDIT:
Ok I know it is the SpecialBots script. Works without it not with it. It USED to work together but something fkd it up so here is the (modified) specialbots.pas. Thank You.
« Last Edit: October 19, 2008, 12:42:28 am by Hacktank »


Offline Norbo

  • Camper
  • ***
  • Posts: 338
Re: Keep getting a compile error... (new prob)
« Reply #7 on: October 20, 2008, 01:14:56 pm »
hmm, i think /kaz dosent work because u didint use a loop and it might feck things up
use this

Code: [Select]
function OnCommand(ID: byte; text: string): boolean;
i: integer;
begin
  if text = '/kaz' then begin
    for i := 1 to 32 do begin
      DoDamage(i,9000)
    end;
  end;
 
  ...

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Keep getting a compile error... (new prob)
« Reply #8 on: October 20, 2008, 04:19:39 pm »
It gives an unknown identifier i error when I try to compile... Even when I put it in a standalone script.


Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
Re: Keep getting a compile error... (new prob)
« Reply #9 on: October 20, 2008, 04:59:52 pm »
Code: [Select]
function OnCommand(ID: byte; text: string): boolean;
var i: integer;
begin
  if text = '/kaz' then begin
    for i := 1 to 32 do begin
      DoDamage(i,9000)
    end;
  end;
end;

..... ....                ....... :|
Its called basic scripting ya know..


Oh and edit. That is kinda standalone, i think you can put it in the script :)
« Last Edit: October 20, 2008, 05:02:45 pm by shantec »
Also Known As REIMA


Lol Happles (happy apples)

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Keep getting a compile error... (new prob)
« Reply #10 on: October 20, 2008, 10:37:48 pm »
Thanks, I learned pascal a week ago, I think that I was able to make what i did is pretty good. But anyway I am gettign alot of conflictions with other scripts using DoDamage so ill just spawn a nade on them. Ok it kinda works but if the zombie is moving it just spawns on them and drops to the ground. I am getting conflictions with other scripts that have a godmode setting (OnPlayerDamage) Thanks for all the help so far.
« Last Edit: October 21, 2008, 04:03:47 pm by Hacktank »