Something wrong with my command
#1

Hey,
I don't know what's wrong, but every time I type wrong command (which doesn't exist) server do this command:
pawn Код:
if(strcmp(cmdtext,"/jetpack",true)==0)
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        CreatePickup(370,4,x,y,z);
        return 1;
    }
If I remove this command, everything is ok, on wrong command server says "Server: Unknown command"
Reply
#2

show the whole code.
Reply
#3

I'm not goint to show my whole GM code
Only this cause problem, cause if I comment this code, everything ok.
Reply
#4

Quote:
Originally Posted by Justas [SiJ
]
Hey,
I don't know what's wrong, but every time I type wrong command (which doesn't exist) server do this command:
pawn Код:
if(strcmp(cmdtext,"/jetpack",true)==0)
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        AddStaticPickup(370,4,x,y,z);
        return 1;
    }
If I remove this command, everything is ok, on wrong command server says "Server: Unknown command"
Shouldn't it be CreatePickup?
Reply
#5

Quote:
Originally Posted by Miokie*
Quote:
Originally Posted by Justas [SiJ
]
Hey,
I don't know what's wrong, but every time I type wrong command (which doesn't exist) server do this command:
pawn Код:
if(strcmp(cmdtext,"/jetpack",true)==0)
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        AddStaticPickup(370,4,x,y,z);
        return 1;
    }
If I remove this command, everything is ok, on wrong command server says "Server: Unknown command"
Shouldn't it be CreatePickup?
oops.. Changed.. But that didn't fixed the problem :P
Reply
#6

are you returning 1 for all your other commands?
also, you need to have a return 0 at the end of OnPlayerCommandText.
Reply
#7

Quote:
Originally Posted by [B2K
Hustler ]
are you returning 1 for all your other commands?
also, you need to have a return 0 at the end of OnPlayerCommandText.
Yes, all other commands returns 1,
But OnPlayerCommandText I changed return 0 to
pawn Код:
return SendClientMessage(playerid,COLOR_RED,"Unknown command. Please check /commands list and try again.");
Do I still need to return 0 here?
EDIT: changing this to return 0; doesn't help...
Reply
#8

There are so many scripters here, and nobody can help me... Strange.......
If everything is ok with the code I posted in the first post, why when I remove it, everything is ok?
I can time any non-existing command and it shows my defined server message "Unknown command. Please check /commands list and try again", but with that code, I type non-existing command and it creates me a jetpack...
Reply
#9

Just because the rest of the code doesn't create errors doesn't mean it isn't the problem.
Reply
#10

Can i have these two lines on each commands? Or do I have to leave only one of them:
pawn Код:
if(.......)
    {
        //command
    }
    else return ErrorMsg(playerid,"Unknown command. Please check /commands list and try again.");
    return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)