Error in compiler
#1

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
Reply
#2

Which line is that? Also it works better if you put you code in pawn /pawn brackets.
Reply
#3

dcmd(wp,2,cmdtext);
{

return 1;
}
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)