SA-MP Forums Archive
/drop 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: /drop command. (/showthread.php?tid=345409)



/drop command. - iGetty - 24.05.2012

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!


Re: /drop command. - vIBIENNYx - 24.05.2012

Ignore this, gimme 2 seconds


Re: /drop command. - vIBIENNYx - 24.05.2012

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



Re: /drop command. - iGetty - 24.05.2012

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


Re: /drop command. - iGetty - 24.05.2012

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


Re: /drop command. - IceCube! - 24.05.2012

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.");



Re: /drop command. - ReneG - 24.05.2012

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