Error in compiler - 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)
+--- Thread: Error in compiler (
/showthread.php?tid=394886)
Error in compiler -
Goldino - 24.11.2012
Hey guys, I'm adding a weapon spawner for my script, I added this:
Код:
dcmd(wp,2,cmdtext);
return 1;
}
return 0;
}
And in the compiler I get this error:
Код:
C:\Documents and Settings\Danny.YOUR-E6F02835AE\My Documents\GTA SA Server\gamemodes\cnr.pwn(2222) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Please help
Re: Error in compiler -
jakejohnsonusa - 24.11.2012
Which line is that? Also it works better if you put you code in pawn /pawn brackets.
Re: Error in compiler -
Glad2BeHere - 24.11.2012
dcmd(wp,2,cmdtext);
{
return 1;
}
Re: Error in compiler -
YoYo123 - 24.11.2012
To use dcmd you need to first define it at the top of your script:
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Then, type in OnPlayerCommandText callback:
pawn Код:
dcmd(command, 3, cmdtext);
Where 'command' is the command you want to have, the second parameter '3' is the length of the command without the slash. Leave 'cmdtext' like it is.
Then to make the actual command contents make this function anywhere outside callbacks:
pawn Код:
dcmd_command(playerid, params[])
{
//code
return 1;
}
Just wanted to make sure you know how dcmd works cause it looks like you put that function in some different place.