wiki is not heaving right code's?
#1

this code i copy pasted from wiki
Код:
new 
 a = 5;
if(a == 5)
 print("a is 5");
now why i get this error at "if(a == 5)"?
Код:
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\TESTE_~1.PWN(3) : error 010: invalid function or declaration
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\TESTE_~1.PWN(6) : error 054: unmatched closing brace ("}")
C:\Programas\Rockstar Games\server administration 0.3a R2\pawno\include\a_samp.inc(53) : error 025: function heading differs from prototype
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\TESTE_~1.PWN(32) : warning 202: number of arguments does not match definition
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\TESTE_~1.PWN(33) : warning 202: number of arguments does not match definition
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\TESTE_~1.PWN(34) : warning 202: number of arguments does not match definition
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\TESTE_~1.PWN(239) : warning 203: symbol is never used: "a"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
please help
Reply
#2

I guess you put it in the wrong place because it MUST work. Since you can't have any expressions outside your functions and callbacks (you can only declare variables and define constants/macros) it should be like:
pawn Код:
SomeFunction()
{
    new
     a = 5; // local variable
    if(a == 5)
     print("a is 5");
}
or
pawn Код:
new
 a = 5; // global variable
SomeFunction()
{
    if(a == 5)
     print("a is 5");
}
If you've already done it like that then you have unmatched braces or something... and you need give us more code.
Reply
#3

Quote:

C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\TESTE_~ 1.PWN(6) : error 054: unmatched closing brace ("}")

You missed a bracket somewhere i guess?
Reply
#4

ok but if i forgot to put that SomeFunction() than why didn't say in tutorial wikipedia?
Reply
#5

i putted in OnPlayerCommandText this code now why i have now error what means that error what is saying?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/Dai bataie", cmdtext, true, 10) == 0)
	{
  new
 a = 5;
if(a == 5)
 print("a is 5");
		return 1;
this is my error
Код:
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\TESTE_~1.PWN(95) : warning 217: loose indentation
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\TESTE_~1.PWN(97) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
plz help me somewone i will apreciate
Reply
#6

loose your indentations

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/Dai bataie", cmdtext, true, 10) == 0)
{
new
a = 5;
if(a == 5)
print("a is 5");
return 1;

something like that ^
Reply
#7

Wiki dose have right code, just it may not allways be indented right,

Offtopic: Why copy and paste, thats just lazy...
You learn nothing that way because you are doing nothing
Reply
#8

ok then if i want to make myself a code in my script than wtf to put there?
this for ex
pawn Код:
new
 OnePlayerConnect = 5;
if(OnePlayerConnect == 5)
 print("OnePlayerConnect is really 5")

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)