SA-MP Forums Archive
Unknown Command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Unknown Command (/showthread.php?tid=573002)



Unknown Command - Tony$$ - 03.05.2015

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.


Re: Unknown Command - Razturach - 03.05.2015

Did u checked returns?


Re: Unknown Command - Konstantinos - 03.05.2015

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.


Re: Unknown Command - Tony$$ - 03.05.2015

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;
}



Re: Unknown Command - Tony$$ - 03.05.2015

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


Re: Unknown Command - Tony$$ - 04.05.2015

Anything?


Re: Unknown Command - Ahmad45123 - 04.05.2015

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..


Re: Unknown Command - Konstantinos - 04.05.2015

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.


Re: Unknown Command - Tony$$ - 04.05.2015

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;
}



Re: Unknown Command - MP2 - 04.05.2015

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