Command in module script not working: -
Twizted - 11.08.2014
I'll cut the slack. I'm creating a modular script (split in modules: callbacks, commands, functions, enums) and I ran across a problem that I cannot seem to figure out.
I have the following command in
Commands.pwn, in the directory
gamemodes\Folder\Players.
pawn Код:
CMD:island(playerid, params[])
{
SetPlayerPos(playerid, -699.1899,-7450.6929,37.9266);
return 1;
}
Then, my
Main.pwn file has the following (and much more, but I decided not to post everything):
pawn Код:
/*Zeex's command processor*/
#include <zcmd>
/* INIT PLAYER */
#include "../gamemodes/Folder/Players/Commands.pwn"
However, when I type the command /island in-game, the "Unknown command" error message is sent to me. What should I do to fix this?
Re: Command in module script not working: -
YanLanger - 11.08.2014
Код:
CMD:island(playerid,params[])
{
SetPlayerPos(playerid, -699.1899,-7450.6929,37.9266);
return 1;
}
Try Now.
Re: Command in module script not working: -
AzaMx - 11.08.2014
Well.. for me i don't use like that via the gamemodes folder. I'm using it via pawno/includes(put your .pwn file here) folder and then just put it like this.
pawn Код:
#include "scriptname.pwn"
Re: Command in module script not working: -
Twizted - 11.08.2014
Quote:
Originally Posted by YanLanger
Код:
CMD:island(playerid,params[])
{
SetPlayerPos(playerid, -699.1899,-7450.6929,37.9266);
return 1;
}
Try Now.
|
Removing a space didn't work, and the syntax is
CMD:command(playerid, params[]) (or COMMAND instead of CMD).
Re: Command in module script not working: -
GC - 11.08.2014
I had a similar issue when I started working in this way, because I was trying to compile it instead of saving.
Save the commands.pwn then compile the main.pwn and then try again.
Re: Command in module script not working: -
Twizted - 11.08.2014
Quote:
Originally Posted by GC
I had a similar issue when I started working in this way, because I was trying to compile it instead of saving.
Save the commands.pwn then compile the main.pwn and then try again.
|
I don't compile anything but the Main.pwn file, because that's what supposed to be compiled. Regardless, I did what you told me to and it still doesn't work: I'm given the 'unknown command' error.
Re: Command in module script not working: -
Stinged - 11.08.2014
Do you have OnPlayerCommandText in your script? (Even if it's empty)
If so, make sure you don't have return 0;
Re: Command in module script not working: -
Twizted - 11.08.2014
Quote:
Originally Posted by Stinged
Do you have OnPlayerCommandText in your script? (Even if it's empty)
If so, make sure you don't have return 0;
|
I usually remove that callback because I use zcmd, so I don't think that that callback is a problem. It's not in the gamemode. I added it now (returning 1, of course) and I still get the error.
Re: Command in module script not working: -
Stinged - 11.08.2014
Oh if you remove it, then there should be no problem.
Re: Command in module script not working: -
SKAzini - 11.08.2014
Use
Easy DeAMX (
https://sampforum.blast.hk/showthread.php?tid=349160) to see if your code actually gets included, if it does, it's not the include part that is the problem.