Unknown Command
#1

Hello,
I got this issue everytime i type any commands it sends me "Unknown Command" text but the command still works.
Help me out here.
Reply
#2

Did u checked returns?
Reply
#3

Lack of information. What are you using for commands? Can you post an example? Do you use any callback from a command processor such as those ZCMD and y_commands use?

For example, let's say you use ZCMD. Returning 0 at the end of the command, will give you the unknown command and the command will work.
Reply
#4

I use YCMD such as this command
pawn Код:
YCMD:defammo(playerid, params[], help) {
    new id;
    new ammo;
    new msg[128];
    if(!sscanf(params, "dD(0)", id,ammo)) {
        if(id < 0 || id > sizeof(DefaultAmmo)) id = 0;
        if(ammo != 0) {
            if(ammo == -1) ammo = INFINITE_AMMO;
            DefaultAmmo[id] = ammo;
        }
        format(msg, sizeof(msg), "* %d: %d",id,DefaultAmmo[id]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
    } else {
        SendClientMessage(playerid, X11_WHITE, "USAGE: /defammo [gunid] (ammo)");
    }
    return 1;
}
Reply
#5

So the issue is because a command got a return value 0?
Reply
#6

Anything?
Reply
#7

Quote:
Originally Posted by Tony$$
Посмотреть сообщение
So the issue is because a command got a return value 0?
Yes, That usually happens when it returns zero... But apparently you don't..
Reply
#8

Quote:
Originally Posted by Tony$$
Посмотреть сообщение
So the issue is because a command got a return value 0?
If there is a command that returns 0 will only give the output of "unknown command" for that command and not the rest.

The last time I used y_commands (in 2012 maybe), I had similar problem and I think it was because of y_master but not sure though.
Reply
#9

Okay i disabled 2 systems and one of them are the reason to it gives that Unknown Command.
And those were these i could find with return 0
pawn Код:
isPlayerWounded(damagedid) {
    if(GetPVarType(damagedid, "DownOnGround") != PLAYER_VARTYPE_NONE) {
        return 1;
    }
    return 0;
}
and this
pawn Код:
isPlayerOnGround(damagedid) {
    if(GetPVarType(damagedid, "DownOnGround") != PLAYER_VARTYPE_NONE) {
        return 1;
    }
    return 0;
}
and this
pawn Код:
getPlayerTimesShot(damagedid) {
    if(GetPVarType(damagedid, "TimesShot") != PLAYER_VARTYPE_NONE) {
        new TimesShot = GetPVarInt(damagedid, "TimesShot");
        return TimesShot;
    } else {
        return 0;
    }
}
and the last one in this system
pawn Код:
isValidShootingDistance(damagedid, shooterid) {
    new Float: X, Float: Y, Float: Z;
    GetPlayerPos(damagedid, X, Y, Z);
    new Float: SDistance = GetPlayerDistanceFromPoint(shooterid, X, Y, Z);
    //printf("%f",SDistance);
    if(SDistance > 1.0) {
        return 1;
    }
    return 0;
}
then i found this one in the other system.
pawn Код:
getEvidencePVarIndex(playerid) {
    if(GetPVarType(playerid, "EvidenceIndex") != PLAYER_VARTYPE_NONE) {
        new evidenceindex = GetPVarInt(playerid, "EvidenceIndex");
        return evidenceindex;
    }
    return 0;
}
Reply
#10

Could be an out of bounds error with an array index.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)