Author Topic: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??  (Read 2189 times)

0 Members and 1 Guest are viewing this topic.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
[*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« on: April 17, 2010, 06:51:05 am »
What is wrong?
Please, Amend it!
This is a copy of the settings:
[Settings]
IP =
Port =
Text =
Commend =

Code: (pascal) [Select]
function LoadSettings(File: string): boolean;
begin
 try
    IP := ReadINI(File,'Settings','IP',' ');
    Port := StrtoInt(ReadINI(File,'Settings','Port',' '));
    Text := ReadINI(File,'Settings','Text',' ');
    Commend := ReadINI(File,'Settings','Commend',' '); 
 except
   Result := true;
   Exit;
 end;
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
if Text = Commend then begin
ForwardClient (GetPlayerStat(ID,'IP'),GetPlayerStat(ID,'Port'),IP,Port,Text); 
end
end;

procedure ActivateServer();
begin
  if LoadSettings('scripts/' + ScriptName + '/settings.ini') then WriteLn(' [*] ' + ScriptName + ' -> Error while loading settings') else WriteLn(' [*] ' + ScriptName + ' -> Settings loaded successfully');
end;
« Last Edit: June 15, 2010, 11:39:47 am by dominikkk26 »

DarkCrusade

  • Guest
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #1 on: April 17, 2010, 06:53:15 am »
You need to declare the variables before you can use them.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #2 on: April 17, 2010, 07:41:35 am »
Nie rozumiem ??
I do not understand?
In Polish pls!

DarkCrusade

  • Guest
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #3 on: April 17, 2010, 09:17:57 am »
/resign

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #4 on: April 17, 2010, 10:16:48 am »
This is an English forum, dominikkk26. It's actually against the rules of this forum to speak in anything other than English (http://forums.soldat.pl/index.php?action=help#english), so either you find your own ways to learn English better, or find a polish forum with polish speaking scripters that will help.

Because it's starting to get really annoying for us all who are trying to help you, and you're completely misunderstanding what we're saying (and vice versa).
When life hands you High Fructose Corn Syrup, Citric Acid, Ascorbic Acid, Maltodextrin, Sodium Acid Pyrophosphate,
Magnesium Oxide, Calcium Fumarate, Yellow 5, Tocopherol and Less Than 2% Natural Flavour... make Lemonade!

DarkCrusade

  • Guest
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #5 on: April 17, 2010, 10:25:50 am »
Code: [Select]
var IP,Port,Commend: String;

function LoadSettings(File: string): boolean; 
begin 
 try 
   IP := StrtoInt(ReadINI(File,'Settings','IP',' ')); 
   Port := StrtoInt(ReadINI(File,'Settings','Port',' ')); 
   Text := StrtoFloat(ReadINI(File,'Settings','Text',' ')); 
   Commend := StrtoFloat(ReadINI(File,'Settings','Commend',' ')); 
 except 
   Result := true; 
   Exit; 
 end; 
end; 
 
function OnPlayerCommand(ID: Byte; Text: string): boolean; 
begin 
  if GetPiece(PlayerCMD, ' ', 0) = Commend then begin 
  ForwardClient (GetPlayerStat(ID,'IP'),GetPlayerStat(ID,'Port'),'IP',Port,'Text'); 
  end 
end; 
 
procedure ActivateServer(); 
begin 
 if LoadSettings('scripts/'+ ScriptName + '/settings.ini') then WriteLn(' [*] '+ ScriptName + ' -> Error while loading settings') else WriteLn(' [*] '+ ScriptName + ' -> Settings loaded successfully'); 
end; 


I was too lazy to fix all of the code. You will need to fix all type mismatches yourself.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #6 on: April 17, 2010, 11:55:37 am »
pls Amend :(

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #7 on: April 17, 2010, 12:00:01 pm »

Offline Zapper

  • Major(1)
  • Posts: 31
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #8 on: April 17, 2010, 02:34:39 pm »
pls Amend :(
Join polish soldat Forums, 'tard.

DarkCrusade

  • Guest
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #9 on: April 17, 2010, 02:36:39 pm »
Afaik he did already, but I bet noone is understanding him there also

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #10 on: April 18, 2010, 03:27:49 am »
pls Amend :(
Join polish soldat Forums, 'tard.

Polish forum does not work for two days!


DarkCrusade

  • Guest
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #11 on: April 18, 2010, 03:35:59 am »
Go suicide or stuff then.

Offline Silnikos

  • Soldier
  • **
  • Posts: 129
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #12 on: April 18, 2010, 03:49:46 am »
Just like DarkCrusade said, you need to declare the variables before you use them. Add this into var section like this:
Jak napisał DrakCrusade, musisz zdeklarować zmienne zanim ich użyjesz. Dodaj na początku skryptu pod 'var' to:

Code: [Select]
var
IP, Text, Commend: String;
Port: Integer;

You need to watch what kind of variable it is.
Musisz uważać jaki rodzaj zmiennej jest użyty.

So, in this part:
W tej części:
Code: [Select]
    IP := ReadINI(File,'Settings','IP',' ');
    Port := StrtoInt(ReadINI(File,'Settings','Port',' ')); 
    Text := ReadINI(File,'Settings','Text',' '); 
    Commend := ReadINI(File,'Settings','Commend',' '); 
(everything is read as a string from ReadIni and only Port should be transformed into integer)
(wszystko jest odczytywane z pliku jako string [ciąg, tekst], tylko Port trzeba więc zamienić na wartość liczbową [integer])

Forwarding part should be:
Fragment z przekierowaniem powinien wyglądać tak:
Code: [Select]
ForwardClient (GetPlayerStat(ID,'IP'),GetPlayerStat(ID,'Port'),IP,Port,Text); 
Also, the OnPlayerCommand trigger looks weird. If you want to run the script on 'Commend', you should do it like this:
Jeśli chcesz, żeby skrypt działał po wpisaniu komendy zapisanej w 'Commend', powinno to wyglądać tak (w onPlayerCommand):

Code: [Select]
if Text = Commend then begin
« Last Edit: April 18, 2010, 03:51:38 am by Silnikos »

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: [*] 1 -> [Error] (5:5): Unknown identifier 'IP' ??
« Reply #13 on: April 18, 2010, 04:38:03 am »
Many thanks!
Let me add a few things I can and if it provides it!