error 035: argument type mismatch (argument 2)
#1

pawn Код:
CMD:buyveh(playerid, params[])
{
    for(new i = 0; i < MAX_BUYABLE_VEH; ++i)
    {
        if(strmatch(vInfo[i][vOwner], pName(playerid))) // error in this line
        {
            Total_Player_Vehicles[playerid] = Total_Player_Vehicles[playerid] + 1;
        }
    }

    if(Total_Player_Vehicles[playerid] >= MAX_OWNABLE_VEH) return SendClientMessage(playerid, -1, ""#CRED"You've reached the limit of "#CBLUE""#MAX_OWNABLE_VEH" "#CRED"ownable vehicles!!");

    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to be in a buyable vehicle to purchase it!");

    new
        ivID = GetPlayerVehicleID(playerid);

    if(OwnedVeh(ivID) != 0)
    {
        if(strmatch(vInfo[OwnedVeh(ivID)][vOwner], pName(playerid)))
        {
            SendClientMessage(playerid, COLOR_RED, "This vehicle already has an owner!");
            return 1;
        }
        if(strmatch(vInfo[OwnedVeh(ivID)][vOwner], "Unbought"))
        {
            if(vInfo[OwnedVeh(ivID)][vPrice] < GetPlayerMoney(playerid))
            {
                strmid(vInfo[OwnedVeh(ivID)][vOwner], pName(playerid), 0, 128, 128);

                new
                    Float:vPos[4];

                GetVehiclePos(ivID, vPos[0], vPos[1], vPos[2]);
                GetVehicleZAngle(ivID, vPos[3]);

                strmid(vInfo[OwnedVeh(ivID)][vPlate], pName(playerid), 0, 32, 32);
                vInfo[OwnedVeh(ivID)][vLocked] = 1;

                SetVehicleNumberPlate(ivID, pName(playerid));
                SetVehicleToRespawn(ivID);
                SetVehiclePos(ivID, vPos[0], vPos[1], vPos[2]);
                SetVehicleZAngle(ivID, vPos[3]);
                PutPlayerInVehicle(playerid, ivID, 0);

                GivePlayerMoney(playerid, - vInfo[OwnedVeh(ivID)][vPrice]);

                SendClientMessage(playerid, -1, ""#CYELLOW"Have fun with your private vehicle!");
                SendClientMessage(playerid, -1, ""#CBLUE"Your vehicle is "#CDGREEN"locked.");

                TogglePlayerControllable(playerid, true);

                SavePrivVeh(OwnedVeh(ivID));

                printf("=- Vehicle id: %i has been bought by: %s -=", OwnedVeh(ivID), pName(playerid));
                return 1;
            }
            else return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to purchase this vehicle!");
        }
        else return SendClientMessage(playerid, COLOR_RED, "This vehicle is not for sale!");
    }
    else return SendClientMessage(playerid, COLOR_RED, "This is not a buyable vehicle!");
}

Код:
(6621) : error 035: argument type mismatch (argument 2)
Reply
#2

Can you show your strmatch function?
Reply
#3

It should look like something like that, if I am correct
pawn Код:
stock strmatch(const String1[], const String2[])
{
    if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
    {
        return true;
    }
    else
    {
        return false;
    }
}
Reply
#4

Try to make a name parameter with GetPlayerName instead using pName.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)