@k3nw00d_kri5ty
There are a number of things to keep in mind:
'return 1;' at the end of the command if-statement
'return 0;' at the end of 'OnPlayerCommandText'
Make sure there isn't any invalid code such as accessing a cell in an array that doesn't exist
To find the line with the problem on:
In between each line put a message that sends to the player, if a piece of code doesn't work then the message after it will not send, therefore that is the line that stops the code:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/mycommand"))
{
SendClientMessage(playerid, 0xFFFFFFFF, "1");
somecode();
SendClientMessage(playerid, 0xFFFFFFFF, "2");
somecode();
SendClientMessage(playerid, 0xFFFFFFFF, "3");
somecodeFunctionThatFails(); // this is the line that doesn't execute in my example
SendClientMessage(playerid, 0xFFFFFFFF, "4"); // this will never be executed because the faulty line above
return 1;
}
}
On the player's screen it should read:
Код:
1
2
3
SERVER: Unknown Command
Now you know that whatever function is between the message 3 and 4 is the one that doesn't work, so look in your code at that line and you'll be one step closer to solving the problem
This is my method of debugging code, hope it helps