[Tutorial] "Server:Unknown Command" using ZCMD
#7

@Greentarch : This one looks clearer :

PHP Code:

public OnPlayerCommandPerformedplayeridcmdtext[ ], success )
{
      return 
success SendClientMessage(playerid, -1">> That command doesn't exist! (/cmds)");

The wiki says that "SendClientMessage" returns 1 if the function executes successful. This way, returning 1 just after that would be a bit useless.

@Author : Some parts of your "COMMON ERRORS" are very bad coded.

I take this code as an example :


pawn Code:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( success == 0 )
    {
       
     }
     return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
     return 0;
}
It won't work as a solution ! You'll even get an error during the compilation !

This one would work :

pawn Code:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if(!success) return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
    return 1;
}

Because as Zeex said :

Quote:
Originally Posted by Zeex
pawn Code:
OnPlayerCommandPerformed(playerid, cmdtext[], success)
And this one gets called after command execution, here if you do "return 0" the player will see standard "Unknown command" message. The "success" parameter is equal to value returned by command function returns (if it doesn't exist success will be 0).
Correct your whole tutorial please.
Reply


Messages In This Thread
"Server:Unknown Command" using ZCMD - by Timeless - 04.07.2014, 01:26
Re: "Server:Unknown Command" using ZCMD - by KayJ - 04.07.2014, 08:09
Re: "Server:Unknown Command" using ZCMD - by Timeless - 04.07.2014, 09:51
Re: "Server:Unknown Command" using ZCMD - by sammp - 04.07.2014, 12:25
Re: "Server:Unknown Command" using ZCMD - by rockhopper - 04.07.2014, 14:42
Re: "Server:Unknown Command" using ZCMD - by greentarch - 04.07.2014, 14:49
Re : "Server:Unknown Command" using ZCMD - by S4t3K - 04.07.2014, 14:57
Re: Re : "Server:Unknown Command" using ZCMD - by Timeless - 04.07.2014, 19:16
Re : "Server:Unknown Command" using ZCMD - by S4t3K - 04.07.2014, 20:07
Re: Re : "Server:Unknown Command" using ZCMD - by Timeless - 04.07.2014, 21:50

Forum Jump:


Users browsing this thread: 2 Guest(s)