Help with sscanf.
#1

Hello reader,

my problem is that in game the stuff works fine but in my server console sscanf shows warnings, I hope someone can help me get rid of them.

The warning:


My code:
pawn Код:
// /pm command.
CMD:pm(playerid, params[110])
{
    if (spot == 1) return SendClientMessage(playerid, KLEUR_AROOD, "You are on Administrator duty.");
    if (isnull(params)) return SendClientMessage(playerid, KLEUR_VOORB, "USAGE: /pm [ID] [text]");
    else if (strlen(params) >= 62) return 1;
        else if(!sscanf(params, "us", playerid, params))
        {
        new pmontvang[110];
        format(pmontvang, sizeof(pmontvang), "(( PM To %s [ %d ]: %s ))", pNaam(playerid), playerid, params);
        SendClientMessage(senderid, KLEUR_PM, pmontvang);
        new pmverstuur[110];
        format(pmverstuur, sizeof(pmverstuur), "(( PM From %s [ %d ]: %s ))", pNaam(playerid), playerid, params);
        SendClientMessage(playerid, KLEUR_PM, pmverstuur);
        }
    return 1;
}
Best regards,
Jesse
Reply
#2

The problem might not be on it. U have filterscipts? Or have u done anything else before adding this cmd?

There is like missing sring lenght... Example "New string;" -WRONG "New string[128];" -CORRECT
Reply
#3

You must iclud the string size. Like

%s[32]

the actual size is left up to you
Make sure it can hold the data is all


This is explained very clearly like ****** said

Hths
Reply
#4

Thanks all, I fixed it.

Best regards,
Jesse
Reply
#5

Thanks all, I fixed it.

Best regards,
Jesse
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)