HELP !
#1

pawn Код:
error 035: argument type mismatch (argument 1)
pawn Код:
CMD:v(playerid, params[])
{
    if (sscanf(params, "u", Vehicle)) return SendClientMessage(playerid, 0xF81414FF, "USAGE: /v [ID/name].");

    vehicleid = GetVehicleModelIDFromName(Vehicle);

    if(Vehicle < 400 || Vehicle > 611) return SendClientMessage(playerid, 0xF81414FF, "ERROR: Invalid vehicle name/ID.");

    GetPlayerPos(playerid, X, Y, Z);

    new PlayersVehicle = CreateVehicle(vehicleid, X, Y, Z, 0.0, -1, -1, -1);
    LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));

    format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicleid - 400]);
    SendClientMessage(playerid, 0x33AA33FF, String);
    return 1;
}
Reply
#2

pawn Код:
CMD:v(playerid, params[])
{
    if (sscanf(params, "u", Vehicle)) return SendClientMessage(playerid, 0xF81414FF, "USAGE: /v [ID/name].");
    vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid < 400 || vehicleid > 611) return SendClientMessage(playerid, 0xF81414FF, "ERROR: Invalid vehicle name/ID.");
    GetPlayerPos(playerid, X, Y, Z);
    CreateVehicle(vehicleid, X, Y, Z, 0.0, -1, -1, -1);
    format(String, sizeof(String), "You have spawned a %s", vehicleid);
    SendClientMessage(playerid, 0x33AA33FF, String);
    return 1;
}
Reply
#3

Код:
if (sscanf(params, "u", Vehicle)) return SendClientMessage(playerid, 0xF81414FF, "USAGE: /v [ID/name].");
The specifier "u" is reserved just for the users, so put "i" or "d", or create a function which recognize the name of vehicle and return his ID
Reply
#4

I made it and it works now, here's the code:

pawn Код:
COMMAND:v(playerid, params[])
{
        if(sscanf(params, "s", Vehicle)) return SendClientMessage(playerid, 0xF81414FF, "USAGE: /v [name].");


               
                GetPlayerPos(playerid, X, Y, Z);
               
                new veh = GetVehicleModelIDFromName(Vehicle);
               
                if(veh < 400 || veh > 611) return SendClientMessage(playerid, 0xFFFFFFFF, "This is not a valid vehicle name! Please try again ");


                new PVeh = CreateVehicle(veh, X, Y, Z, 0.0, 0, 0, 200);
               
                format(String, sizeof String, "You spawned a %s. ID: %i. ", aVehicleNames[veh - 400], veh);
                SendClientMessage(playerid, 0xFFFFFFFF, String);

        return 1;
}
but thank you both for the reply anyways!
Reply
#5

Код:
if(sscanf(params, "d", Vehicle)) return SendClientMessage(playerid, 0xF81414FF, "USAGE: /v [ID Vehicle].");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)