SA-MP Forums Archive
Invalid Function - 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: Invalid Function (/showthread.php?tid=256958)



Invalid Function - berz - 23.05.2011

: warning 217: loose indentation // Error line // army = CreateObject(987,-1525.733,482.001,6.203,0.0,0.0,-180.000); //Army Gate

: warning 217: loose indentation // CreateObject(987,-1690.11291504,259.89843750,6.18750000,0.00000000,0 .00000000,0.00000000);

: error 010: invalid function or declaration // if(strcmp(cmdtext, "/sfarmy1", true) == 0)
: error 010: invalid function or declaration // if(strcmp(cmdtext, "/sfarmy", true)== 0)

2 Errors.


Guys help me please, idk how to fix that


Re: Invalid Function - Mean - 23.05.2011

Post the FULL functions perhaps... Also use [ pawn ] [ /pawn ].
About the loose indentation, the problem is that your code isn't placed right ( to left or right ), for example:
pawn Код:
//Wrong
if( !strcmp( cmdtext, "/lol", true ) )
{
  if( !strcmp( cmdtext[ 4 ], "rofl", true ) )
    {
  SendClientMessage( playerid, -1, "Your param is 'rofl'." );
  }
return 1;
}
pawn Код:
//Correct
if( !strcmp( cmdtext, "/lol", true ) )
{
    if( !strcmp( cmdtext[ 4 ], "rofl", true ) )
    {
        SendClientMessage( playerid, -1, "Your param is 'rofl'." );
    }
    return 1;
}
So you must indent your code using the TAB key. 1 tab = 4 spaces.

EDIT:
You can review this tutorial I just wrote.