A command with parameters.
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
Can I see your current attempt?
pawn Код:
YCMD:vehicle(PARAMS)
{
    #pragma unused help
    else if(strcmp(params, "sell", false) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid))
            return SendClientMessage(playerid, -1, ""CRE"Eroare"CWH": Trebuie sa fii intr-o masina sa o poti vinde.");

        pvID = GetPlayerVehicleID(playerid);

        if(!strmatch(V_DATA[pvID][vOwner], pName(playerid)))
            return SendClientMessage(playerid, -1, ""CRE"Eroare"CWH": Masina nu iti apartine, nu o poti vinde.");

        #if USE_PLAYER_SSCANF
        if(sscanf(params[4], "ui", "sell", pID, price))
            return SendClientMessage(playerid, -1, ""CRE"Utilizare"CWH": /vehicle sell [PlayerID / Nume] [Pretul]");

        #else
        if(sscanf(params[4], "ii", pID, price))
            return SendClientMessage(playerid, -1, ""CRE"Utilizare"CWH": /vehicle sell  [PlayerID / Nume] [Pretul]");
        #endif

        if(!IsPlayerConnected(pID))
            return SendClientMessage(playerid, -1, ""CRE"Eroare"CWH": Playerul selectat nu este conectat.");

        GetPlayerPos(pID, Pos[0], Pos[1], Pos[2]);
        if(!IsPlayerInRangeOfPoint(playerid, 3.0, Pos[0], Pos[1], Pos[2]))
            return SendClientMessage(playerid, -1, "Nu esti destul de aproape de playerul selectat.");

        if(price < 0)
            return SendClientMessage(playerid, -1, ""CRE"Eroare"CWH": Nu poti introduce valori negative.");

        SetPVarInt(pID, "BuyingCar", pvID);
        SetPVarInt(pID, "BuyingPrice", price);
        SetPVarInt(pID, "Seller", playerid + 1);
        format(str, sizeof str, "%s a oferit sa-ti vanda %s pentru %i$.", pName(playerid), VehicleNames[GetVehicleModel(pvID) - 400], price);
        SendClientMessage(pID, -1, str);
        format(str, sizeof str, "Ai oferit spre vanzare %s pentru %i$ lui %s.", VehicleNames[GetVehicleModel(pvID) - 400], price, pName(pID));
        SendClientMessage(playerid, -1, str);
        return 1;
    }

Here it is. Sorry for responding so late ...

There's the "USE_PLAYER_SSCANF" define, because sscanf is bugged for 0.3d linux ... so when it'll be fixed, I don't want to rewrite all the commands.
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)