A command with parameters.
#1

Hey people, I'm just wondering, how could I make a command with double parameters? Let me explain what i want exactly:

I want a /vehicle command, followed by more parameters ... like: park, get, sell, scrap, etc etc ..

So, here's what i got at the moment:
pawn Код:
YCMD:vehicle(playerid[], params, help)
{
       if(strcmp(params, "list", false) == 0)
    {
                // BLA BLA
        }
        if(strcmp(params, "get", false) == 0)
    {
                // BLA BLA
        }
        if(strcmp(params, "sell", false) == 0)
    {
                // BLA BLA
        }
Now, in the 'sell' parameter, how can I make two more parameters, for [playerid] and [price]:
/v sell [PlayerID] [Price] ??

I tried with sscanf, like:
pawn Код:
YCMD:vehicle(playerid, params, help)
{
       else if(strcmp(params, "sell", false) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid))
            return SendClientMessage(playerid, -1, ""You're not in a vehicle.");

        pvID = GetPlayerVehicleID(playerid);
        if(sscanf(params, "ui", pID, price))
            return SendClientMessage(playerid, -1, "Use: /vehicle sell [playerid] [ price]");
}
And it doesn't work ...
Reply


Messages In This Thread
A command with parameters. - by antonio112 - 29.11.2011, 20:20
Re: A command with parameters. - by antonio112 - 29.11.2011, 20:44
Re: A command with parameters. - by antonio112 - 29.11.2011, 20:51
Re: A command with parameters. - by antonio112 - 03.12.2011, 05:20
Re: A command with parameters. - by fordawinzz - 03.12.2011, 10:18
Re: A command with parameters. - by antonio112 - 05.12.2011, 02:37

Forum Jump:


Users browsing this thread: 1 Guest(s)