SA-MP Forums Archive
why doesn't compile this code - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: why doesn't compile this code (/showthread.php?tid=108604)



why doesn't compile this code - Sfinx_17 - 14.11.2009

why i get errors when compile this code?

Код:
public OnGameModeInit()
{
  print("my gamemode");
  ConnectNPC("MyFirstNPC","mynpc");
  return 1;
}
this is my error
Код:
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\Sfinx_17.pwn(159) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.



Re: why doesn't compile this code - miokie - 14.11.2009

Whats line 157,158 and 159?


Re: why doesn't compile this code - Sfinx_17 - 14.11.2009

you mean what line is putted the code in my script?


Re: why doesn't compile this code - Benne - 14.11.2009

In which line are the error?
Ex:

Which of these lines are the error on?

pawn Код:
public OnGameModeInit() //On this?
{ //Or this?
  print("my gamemode"); //Or this?
  ConnectNPC("MyFirstNPC","mynpc"); //Or this?
  return 1; //Or this?
} //Or this?



Re: why doesn't compile this code - Sfinx_17 - 14.11.2009

lol i allready post the error code but how to know wich is the line what have error i don't understand
explain better plz

how to find what line is the error? lol


Re: why doesn't compile this code - Benne - 14.11.2009

The numbers marked with black are the line numbers:

[img width=1024 height=575]http://i37.tinypic.com/2zizxbn.jpg[/img]


Re: why doesn't compile this code - Sfinx_17 - 14.11.2009

that's more better

this is the lines 154, 155, 156, 157


Re: why doesn't compile this code - Benne - 14.11.2009

Quote:
Originally Posted by Sfinx_17
why i get errors when compile this code?

Код:
public OnGameModeInit()
{
  print("my gamemode");
  ConnectNPC("MyFirstNPC","mynpc");
  return 1;
}
this is my error
Код:
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\Sfinx_17.pwn(159) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Then you don't even show line 159 in your picture, then we can't see what the error is.


Re: why doesn't compile this code - iLinx - 14.11.2009

Код:
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\Sfinx_17.pwn(159) : warning 225: unreachable code
means that the code directly below ongamemodeinit isnt accessible by the compiler. im not sure as to why this is since i cant see your whole script and only 4 lines, but i would try changing the return 1; to a return 0; or something


Re: why doesn't compile this code - Correlli - 14.11.2009

Quote:
Originally Posted by iLinx
but i would try changing the return 1; to a return 0; or something
There is no sense in that.

Quote:
Originally Posted by pawn-lang.pdf
error 225 - unreachable code:
The indicated code will never run, because an instruction before (above) it causes a jump out of the function, out of a loop or elsewhere. Look for return, break, continue and goto instructions above the indicated line. Unreachable code can also be caused by an endless loop above the indicated line.