Unknown Command
#1

I;ve implemented this code:

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if(
IsPlayerAdmin(playerid))
    {
        if(!
strcmp("/gotomb"cmdtexttrue))
        {
            
SetPlayerPos(playeridMoneyBagPos[0], MoneyBagPos[1] +3MoneyBagPos[2]);
            return 
SendClientMessage(playerid, -1"You have been {FF0000}teleported {FFFFFF}to the {33FF66}money bag");
        }
        if(!
strcmp("/startmb"cmdtexttrue)) return MoneyBag();
        if(!
strcmp("/togglemb"cmdtexttrue))
        {
            if(
Timer[0] == 0)
            {
                
KillTimer(Timer[1]);
                
Timer[0] = 1;
                
SendClientMessage(playerid, -1"Money bag turned {FF0000} off!");
                return 
1;
            }
            if(
Timer[0] == 1)
            {
                
Timer[1] = SetTimer("MoneyBag"MB_DELAYtrue);
                
Timer[0] = 0;
                
SendClientMessage(playerid, -1"Money bag turned {33FF66} on!");
                return 
1;
            }
            return 
1;
        }
    }
    if(!
strcmp("/moneybag"cmdtexttrue))
    {
        new 
string[150];
        if(!
MoneyBagFoundformat(stringsizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!"MoneyBagLocation);
        if(
MoneyBagFoundformat(stringsizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
        return 
SendClientMessage(playerid, -1string);
    }
    if(!
strcmp("/mb"cmdtexttrue))
    {
        new 
string[150];
        if(!
MoneyBagFoundformat(stringsizeof(string), "**The {33FF66}Money Bag has been {FF0000}hidden in {FFFF66}%s!"MoneyBagLocation);
        if(
MoneyBagFoundformat(stringsizeof(string), "**The {33FF66}Money Bag is {FF0000} not running!");
        return 
SendClientMessage(playerid, -1string);
    }
    if(!
strcmp("/teleport"cmdtexttrue))
    {
         
SetPlayerPos(playerid, -1967.83652956.982312.9375);
         return 
1;
    }
    return 
0;

But when i run the game ,i type one of the command it says Server: Unknown Command ?,i got no error while compiling....

Where is the problem?
Reply
#2

Besides the fact you're still using slower and obsolete methods for processing commands, returning 0 at the end results in the invalid command message showing if nothing above it returned 1.
Reply
#3

Use ZCMD.
Reply
#4

Same method was in samp.wiki !! What to use then ?
Reply
#5

To code, you don't need to follow the "road". Open your mind! Create new a "road" or search how to do it and use the better tools for it.

The Wiki is only to you get the "North".

Here, in wiki you can find ZCMD too.
https://sampwiki.blast.hk/wiki/Fast_Commands
Reply
#6

use ZCMD
Reply
#7

You can't suggest for him to use ZCMD as a solution when he only has 6 commands... this method would probably actually be faster than ZCMD at this point.

Which command are you trying to use? You have 3 commands, "/gotomb, /startmb, /togglemb", that require you to be logged into RCON, otherwise it will give you an 'Unknown Command' error.
Reply
#8

Quote:
Originally Posted by Astralis
Посмотреть сообщение
Use ZCMD.
get on my level
pawncmd

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)