/drop command.
#1

Alright, I currently have this:

pawn Код:
command(drop, playerid, params[])

How could I make it so then I have this:



/drop [item]

Then, say I had "clothes", so it would be

'/drop clothes', if I got that, then I want to choose the slot, EG:

/drop clothes [slot]

if I did /drop clothes 1, it would drop slot one clothes?

I only need to know the basics of how to get into the second category of a command.

/drop clothes 1 = Dropping the clothes in slot 1.

Thanks!
Reply
#2

Ignore this, gimme 2 seconds
Reply
#3

pawn Код:
command(help, playerid, params[])
{
    new cat[128];
    new defaultinteger;
    if(sscanf(params, "s[128]D(default)", cat))
    {
        SendClientMessage(playerid, 0x66666666, "Usage: /drop [Category]");
        SendClientMessage(playerid, 0x66666666, "Categories: Clothes");
        return 1;
    }
    else
    {
        if(strfind("Clothes", cat, true) != -1)
        {
                  //
        }
    }
    return 1;
}
Reply
#4

Cheers mate. Not done one of these commands in ages.

Also, do you know how I can do this?

How to check what the "Value" is, I tried:

pawn Код:
if(Value == 1)
{
    //code
}
else if(Value == 2)
{
    //code
}
else if(Value == 3)
{
    //code
}
else SendClientMessage(playerid, WHITE, "Only 1 - 3.");
Cheers Ben
Reply
#5

Edit: Oops, didn't mean to post that.
Reply
#6

Quote:
Originally Posted by iGetty
Посмотреть сообщение
Cheers mate. Not done one of these commands in ages.

Also, do you know how I can do this?

How to check what the "Value" is, I tried:

pawn Код:
if(Value == 1)
{
    //code
}
else if(Value == 2)
{
    //code
}
else if(Value == 3)
{
    //code
}
else SendClientMessage(playerid, WHITE, "Only 1 - 3.");
Cheers Ben
You mean if they enter a value over 3 tell them or below 1 ?? If so try this

pawn Код:
if(Value < 1 || Value > 3) return SendClientMessage(playerid, COLOUR_PINK, "Error: THe command does not go below 1 or above 3.");
Reply
#7

pawn Код:
command(drop, playerid, params[])
{
    new
        item[20];
    if(isnull(params))
    {
        return SendClientMessage(playerid, -1, "USAGE: /drop [item]");
    }
    else if(!strcmp(item, "clothes", true)
    {
        new
            slot;
        if(sscanf(params, "s[20]d", item,  slot))
        {
            return SendClientMessage(playerid, -1, "USAGE: /drop clothes [slot]");
        }
        if(slot < 1 || slot > 3)
        {
            return SendClientMessage(playerid, -1, "Don't go below 1 or over 3.");
        }
        // code here
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)