[Help] sscanf warning [Strings]
#1

Sscanf warning: Strings without a length are deprecated, please add a destionation size.
I got this warnings when i use this cmds:

pawn Код:
CMD:addv(playerid, params[])
{
    if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_GREY, "You are not admin!");
    if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Ti nemas prava koristi ovu komandu!");
    new model[32], modelid, dealerid, color1, color2, price;
    if(sscanf(params, "dsddd", dealerid, model, color1, color2, price))
        return SendClientMessage(playerid, COLOR_GREY, "INFO: /addv [dealerid] [model] [color1] [color2] [price]");
    if(!IsValidDealership(dealerid)) return SendClientMessage(playerid, COLOR_GREY, "Nevalidan autoshop ID!");
    if(IsNumeric(model)) modelid = strval(model);
    else modelid = GetVehicleModelIDFromName(model);
    if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, COLOR_GREY, "Nevalidan auto model ID!");
    if(color1 < 0 || color2 < 0) return SendClientMessage(playerid, COLOR_GREY, "Nevalidan ID boja!");
    if(price < 0) return SendClientMessage(playerid, COLOR_GREY, "Nevalidna cjena!");
    new Float:X, Float:Y, Float:Z, Float:angle;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, angle);
    X += floatmul(floatsin(-angle, degrees), 4.0);
    Y += floatmul(floatcos(-angle, degrees), 4.0);
    for(new i=1; i < MAX_DVEHICLES; i++)
    {
        if(!VehicleCreated[i])
        {
            new msg[128];
            VehicleCreated[i] = VEHICLE_DEALERSHIP;
            VehicleModel[i] = modelid;
            VehiclePos[i][0] = X;
            VehiclePos[i][1] = Y;
            VehiclePos[i][2] = Z;
            VehiclePos[i][3] = angle+90.0;
            VehicleColor[i][0] = color1;
            VehicleColor[i][1] = color2;
            VehicleInterior[i] = GetPlayerInterior(playerid);
            VehicleWorld[i] = GetPlayerVirtualWorld(playerid);
            VehicleValue[i] = price;
            valstr(VehicleOwner[i], dealerid);
            VehicleNumberPlate[i] = DEFAULT_NUMBER_PLATE;
            for(new d=0; d < sizeof(VehicleTrunk[]); d++)
            {
                VehicleTrunk[i][d][0] = 0;
                VehicleTrunk[i][d][1] = 0;
            }
            for(new d=0; d < sizeof(VehicleMods[]); d++)
            {
                VehicleMods[i][d] = 0;
            }
            VehiclePaintjob[i] = 255;
            VehicleLock[i] = 0;
            VehicleAlarm[i] = 0;
            UpdateVehicle(i, 0);
            SaveVehicle(i);
            format(msg, sizeof(msg), "Dodano vozilo %d vo autoshop %d", i, dealerid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
            return 1;
        }
    }
    SendClientMessage(playerid, COLOR_GREY, "Nemozes dodati vise vozila!");
    return 1;
}
CMD:editv(playerid, params[])
{
    if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_GREY, "Ti nisi admin!");
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new id = GetVehicleID(GetPlayerVehicleID(playerid));
        if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_GREY, "Ovo nije dunamicno vozilo!");
        SetPVarInt(playerid, "DialogValue1", id);
        ShowDialog(playerid, DIALOG_EDITVEHICLE);
        return 1;
    }
    new vehicleid;
    if(sscanf(params, "u", vehicleid)) return SendClientMessage(playerid, COLOR_GREY, "INFO: /editv [vozilo]");
    if(!IsValidVehicle(vehicleid)) return SendClientMessage(playerid, COLOR_GREY, "Nevalidno vozilo ID!");
    SetPVarInt(playerid, "DialogValue1", vehicleid);
    ShowDialog(playerid, DIALOG_EDITVEHICLE);
    return 1;
}

CMD:adddealership(playerid, params[])
{
    if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_GREY, "Ti nisi admin!");
    if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Ti nemozes koristi ovu komandu sad!");
    for(new i=1; i < MAX_DEALERSHIPS; i++)
    {
        if(!DealershipCreated[i])
        {
            new msg[128];
            DealershipCreated[i] = 1;
            GetPlayerPos(playerid, DealershipPos[i][0], DealershipPos[i][1], DealershipPos[i][2]);
            UpdateDealership(i, 0);
            SaveDealership(i);
            format(msg, sizeof(msg), "Dodan Auto Shop sa ID: %d", i);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
            return 1;
        }
    }
    SendClientMessage(playerid, COLOR_GREY, "Nemozes dodati vise Auto Shopa!");
    return 1;
}

CMD:deletedealership(playerid, params[])
{
    if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_GREY, "Ti nisi Admin!");
    new dealerid, msg[128];
    if(sscanf(params, "u", dealerid)) return SendClientMessage(playerid, COLOR_GREY, "INFO: /deletedealership [ID]");
    if(!IsValidDealership(dealerid)) return SendClientMessage(playerid, COLOR_GREY, "Nevalidan ID!");
    for(new i=1; i < MAX_DVEHICLES; i++)
    {
        if(VehicleCreated[i] == VEHICLE_DEALERSHIP && strval(VehicleOwner[i]) == dealerid)
        {
            DestroyVehicle(VehicleID[i]);
            Delete3DTextLabel(VehicleLabel[i]);
            VehicleCreated[i] = 0;
        }
    }
    DealershipCreated[dealerid] = 0;
    Delete3DTextLabel(DealershipLabel[dealerid]);
    SaveDealership(dealerid);
    format(msg, sizeof(msg), "Izbrisan Auto Shop %d", dealerid);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
    return 1;
}

CMD:movedealership(playerid, params[])
{
    if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_GREY, "Ti nisi Admin!");
    new dealerid, msg[128];
    if(sscanf(params, "u", dealerid)) return SendClientMessage(playerid, COLOR_GREY, "INFO: /movedealership [dealerid]");
    if(!IsValidDealership(dealerid)) return SendClientMessage(playerid, COLOR_GREY, "Nevalidan Auto Shop ID!");
    GetPlayerPos(playerid, DealershipPos[dealerid][0], DealershipPos[dealerid][1], DealershipPos[dealerid][2]);
    UpdateDealership(dealerid, 1);
    SaveDealership(dealerid);
    format(msg, sizeof(msg), "Premjesten Auto Shop %d tuka", dealerid);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
    return 1;
}
CMD:agorivo(playerid, params[])
{
    if(!IsAdmin(playerid, 1)) return SendClientMessage(playerid, COLOR_GREY, "Ti nemas prava koristi ovu komandu!");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Ti nisi u vozilo!");
    new amount, msg[128];
    if(sscanf(params, "u", amount)) return SendClientMessage(playerid, COLOR_GREY, "INFO: /agorivo [iznos]");
    if(amount < 0 || amount > 100) return SendClientMessage(playerid, COLOR_GREY, "Nevalidan iznos! (0-100)");
    Fuel[GetPlayerVehicleID(playerid)] = amount;
    format(msg, sizeof(msg), "Ti si postavio gorivo na ovo vozilo %d", amount);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)