SA-MP Forums Archive
wiki is not heaving right code's? - 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: wiki is not heaving right code's? (/showthread.php?tid=109405)



wiki is not heaving right code's? - Sfinx_17 - 19.11.2009

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


Re: wiki is not heaving right code's? - Zeex - 20.11.2009

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.



Re: wiki is not heaving right code's? - hipy - 20.11.2009

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?


Re: wiki is not heaving right code's? - Sfinx_17 - 20.11.2009

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


Re: wiki is not heaving right code's? - Sfinx_17 - 20.11.2009

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


Re: wiki is not heaving right code's? - Sharpace - 20.11.2009

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 ^


Re: wiki is not heaving right code's? - denbo1 - 21.11.2009

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


Re: wiki is not heaving right code's? - Sfinx_17 - 21.11.2009

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")