Help with sscanf. - 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: Help with sscanf. (
/showthread.php?tid=320441)
Help with sscanf. -
jessejanssen - 22.02.2012
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
Re: Help with sscanf. -
ArmyOps - 22.02.2012
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
Re: Help with sscanf. -
Madd Kat - 22.02.2012
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
Re: Help with sscanf. -
jessejanssen - 23.02.2012
Thanks all, I fixed it.
Best regards,
Jesse
Re: Help with sscanf. -
jessejanssen - 23.02.2012
Thanks all, I fixed it.
Best regards,
Jesse