Stuck with a CMD
#1

pawn Код:
CMD:inv(playerid, params[])
{
    new inv;
    if(sscanf(params, "i", inv)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /inv [drugs]");
   
    if(inv == drugs)
    {
        ShowDrugs(playerid,playerid);
        return 1;
    }
    return 1;
}
Such basic... but can someone tell me why it doesn't understand "drugs".

I'm trying to get a command so they can do /inv drugs, to show their drugs.
Reply
#2

pawn Код:
CMD:inv(playerid, params[])
{
    new inv[20];
    if(sscanf(params, "s[20]", inv)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /inv [drugs]");
    if(!strcmp(inv, "drugs", true))
    {
        ShowDrugs(playerid,playerid);
        return 1;
    }
    return 1;
}
Reply
#3

What you've got here is "/inv <Number>". You need to use specifier "s[value_here]" which is about strings.
pawn Код:
CMD:inv(playerid, params[])
{
    new inv[ 6 ];
    if(sscanf(params, "s[6]", inv)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /inv [drugs]");
    if(!strcmp(inv, "drugs", true)) return ShowDrugs(playerid,playerid);
    else return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /inv [drugs]");
}
Reply
#4

pawn Код:
CMD:inv(playerid, params[])
{
    new inv[6];
    if(sscanf(params, "s[6]", inv)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /inv [drugs]");
    if(!strcmp(inv, "drugs", true))
    {
        ShowDrugs(playerid,playerid);
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /inv [drugs]");
}
When I type /inv it dont work. Just jeeps saying inv drugs bit.
Reply
#5

When you type "/inv" with no parameters, you'll get the usage. Unless you use "/inv drugs" and then it will call the ShowDrugs function.
Reply
#6

FIXED.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)