Lost use of commands.
#1

Alright so I was doing some things, messing around with modules for a gamemode,
Loading code from one file to anther, along with a few other things.
However, when I finally did a restart I noticed I lost the use of commands.
Regardless of the command I used it wouldn't work.
It just does nothing.

What are some common errors made, that would cause this?
I was using Pawn.cmd plugin, however I switched to ZCMD to see if that solved the issue
No results. My commands were working fine but I tried removing the module from my script, that didn't work
So if It wasn't that I have no idea the cause.

I do have
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    return 
0;

Located under my commands.

So it looks like this:

PHP код:
CMD:somecmd(playeridparams[])
{
    return 
1;
}
CMD:somecmd2(playeridparams[])
{
    return 
1;
}
CMD:somecmd3(playeridparams[])
{
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    return 
0;

Reply
#2

FIXED:

How I resolved the issue:

PHP код:
CMD:somecmd(playeridparams[])
{
    if(
somevariable == true)
    {
         
//Do some stuff
    
}
    else
    {
        
SendClientMessage(playerid, -1"Error Message);
    }
    return 1;

Changed to:

PHP код:
CMD:somecmd(playeridparams[])
{
    if(
somevariable == true)
    {
         
//Do some stuff
    
}
    else
    {
        
SendClientMessage(playerid, -1"Error Message);
        return 1;
    }
    return 1;

Conclusion:

Commands didn't work due to a missing return value.
Don't forget to return values in your commands!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)