SA-MP Forums Archive
Major PM truncation - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Major PM truncation (/showthread.php?tid=497530)



Major PM truncation - PrivatioBoni - 27.02.2014

My code:

pawn Код:
CMD:pm(playerid, params[])
{
    new str[144];
    new str2[144];
    new id;
    if(sscanf(params, "us", id, str2)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /pm [name/playerid] [message]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid ID/player name.");
    {

        format(str, sizeof(str), "%s(ID %d): %s", GetName(id), id, str2);
        SendClientMessage(playerid, COLOR_YELLOW, str);
        format(str, sizeof(str), "%s(ID %d): %s", GetName(playerid), playerid, str2);
        SendClientMessage(id, COLOR_ORANGE, str);
    }
    return 1;
}
To me, the script looks fine but it majorly truncates. Here is an example:



(NOTE: This happens to some other commands too, but any help I receive with this, I can apply to the other commands. )

Thanks in advance.


Re: Major PM truncation - Vince - 27.02.2014

You should have warnings in your console/server log from sscanf about "destination size". If no size is supplied sscanf will truncate data, likely at a cap of 32 characters.


Re: Major PM truncation - PrivatioBoni - 27.02.2014

Thanks, fixed. Rep will be given.