Portal SAMP
[Ajuda] sscanf warning: Strings without a length are deprecated, please add a destination siz - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] sscanf warning: Strings without a length are deprecated, please add a destination siz (/showthread.php?tid=3304)



sscanf warning: Strings without a length are deprecated, please add a destination siz - AllanSG - 07/02/2023

Estou recebendo um aviso do sscanf no console quando uso o comando abaixo, porém nao consegui identificar ele, uso outro comando bem parecido com esse e ele não apresenta nada no console.

O comando compila e funciona tudo certo, apenas esse aviso no console q eu nao sei de onde é

Citar:sscanf warning: Strings without a length are deprecated, please add a destination size.
Citar:CMD:liberarv2(playerid, params[])

{
if(Player[playerid][Pika] == 0) return SendClientMessage(playerid, vermelho, NaoPode);
new id, motivo[128], texto[256], pasta[100], pPlayer[64];
if(sscanf(params, "ds", id, motivo)) return SendClientMessage(playerid, vermelho, "| COMANDO | Use /liberarv2 [ id v2 ][ motivo ]");
format(pasta, sizeof(pasta), Carros, id);
format(pPlayer, sizeof(pPlayer), Contas, V2[id][nDono]);
if(!DOF2_FileExists(pasta)) return SendClientMessage(playerid, vermelho, "| ERRO | id inválido!");
if(!strcmp(V2[id][nDono], "Ninguém", true) && V2[id][tDono] == false) return SendClientMessage(playerid, vermelho, "| ERRO | Esse v2 já está liberado.");
format(Log, sizeof(Log), "%s liberou o v2 id %i que era de %s!", GetPlayerNameEx(playerid), id, V2[id][nDono]);
format(texto, sizeof(texto), "| ADM | %s liberou o V2 id %i que era de %s (motivo: %s)", GetPlayerNameEx(playerid), id, V2[id][nDono], motivo);

DOF2_SetBool(pasta, "tDono", false), V2[id][tDono] = false;
DOF2_SetString(pasta, "nDono", "Ninguém"), format(V2[id][nDono], 24, "Ninguém");
DOF2_SetFloat(pasta, "SalvoX", V2[id][ConceX]), V2[id][SalvoX] = V2[id][ConceX];
DOF2_SetFloat(pasta, "SalvoY", V2[id][ConceY]), V2[id][SalvoY] = V2[id][ConceY];
DOF2_SetFloat(pasta, "SalvoZ", V2[id][ConceZ]), V2[id][SalvoZ] = V2[id][ConceZ];
DOF2_SetFloat(pasta, "SalvoA", V2[id][ConceA]), V2[id][SalvoA] = V2[id][ConceA];
DOF2_SetInt(pasta, "vCor1", 157), V2[id][vCor1] = 157;
DOF2_SetInt(pasta, "vCor2", 157), V2[id][vCor2] = 157;
DOF2_SetInt(pasta, "vContas", 0), V2[id][vContas] = 0;
DOF2_SetBool(pasta, "vPortas", false), V2[id][vPortas] = false;
DOF2_SetInt(pasta, "vDano", 0), V2[id][vDano] = 0;
DOF2_SetHex(pasta, "CorNick", 0xFFFFFFFF), V2[id][CorNick] = 0xFFFFFFFF;
DOF2_SetString(pasta, "vPlaca", "BDV"), format(V2[id][vPlaca], 15, "BDV");

DOF2_SetInt(pPlayer, "tV2", DOF2_GetInt(pPlayer, "tV2")-1);

for(new p; p < MAX_PLAYERS; p++)
{
    if(TaLogado[p])
    {
        if(strcmp(V2[id][nDono], GetPlayerNameEx(p), false))
        {
Player[p][tV2] -= 1;
  }
    }
}

DOF2_SaveFile();

Delete3DTextLabel(V2[id][v3DText]);
DestroyVehicle(id);
V2[id][v3DText] = Create3DTextLabel(V2[id][nDono], 0xFFFFFFFF, 0, 0, 0, 20.0, 0);
id = CreateVehicle(V2[id][vModelo], V2[id][ConceX], V2[id][ConceY], V2[id][ConceZ], V2[id][ConceA], 157, 157, 0);
Attach3DTextLabelToVehicle(V2[id][v3DText], id, -0.1286, -1.4873, 0.2334);
SetVehicleNumberPlate(id, V2[id][vPlaca]);
SendClientMessageToAll(azulado, texto);

    fileLog("LiberarV2", Log);

return 1;
}



RE: sscanf warning: Strings without a length are deprecated, please add a destination siz - xbruno1000x - 07/02/2023

Código:
if(sscanf(params, "ds[128]", id, motivo))



RE: sscanf warning: Strings without a length are deprecated, please add a destination siz - AllanSG - 07/02/2023

(07/02/2023 20:51)xbruno1000x Escreveu:
Código:
if(sscanf(params, "ds[128]", id, motivo))

é necessario sempre colocar o tamanho no sscanf? tenho dezenas de comandos com string sem o tamanho e esse é o primeiro q da aviso no console


RE: sscanf warning: Strings without a length are deprecated, please add a destination siz - k2bi_YT - 07/02/2023

Para evitar problemas, sim é o ideal definir o tamanho em caso de strings