PDA

View Full Version : sscanf warnings!


RLGaming
05/10/2012, 09:14 PM
I have these;
[17:24:00] sscanf warning: Format specifier does not match parameter count.
[17:24:00] sscanf warning: Format specifier does not match parameter count.
[17:24:00] sscanf warning: Format specifier does not match parameter count.
[17:24:00] sscanf warning: Format specifier does not match parameter count.

And I think its because I updated my sscanf to sscanf 2 or something and one of the CMD's thats causing one of these is:

CMD:givetokens(playerid, params[])
{
new string[128], amount, giveplayerid;
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givetokens [playerid] [amount]");

if(IsPlayerConnected(giveplayerid))
{
format(string, sizeof(string), "AdmCmd: %s has just given %s %i VIP Tokens.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), amount);
ABroadCast(COLOR_LIGHTRED, string, 1);
PlayerInfo[playerid][pVIPTokens] +=amount;
}
}
else SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use this command!");
return 1;
}

+rep if you can help ;/

Red_Dragon.
05/10/2012, 09:15 PM
Your sscanf specifier is wrong

RLGaming
05/10/2012, 09:16 PM
and what is that?

Mean
05/10/2012, 09:16 PM
you sure it's that cmd causing the warning?

also: using latest include/plugin?

RLGaming
05/10/2012, 09:19 PM
Yes it is

and yes

Red_Dragon.
05/10/2012, 09:36 PM
It is only a warning i think you may ignore it ? BTW... is the cmd working ? if yes, ignore warning if no, tell me

ikbenremco
06/10/2012, 06:27 AM
Change :

if(sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givetokens [playerid] [amount]");



into :


if(sscanf(params, "us[60]", giveplayerid, amount))
return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/givetokens[playerid] [amount]");

gtakillerIV
06/10/2012, 06:30 AM
Ah?? Amount = Numbers mate. d = Integer.

Edit: Here is the list.

All specifiers

For quick reference, here is a list of ALL the specifiers and their use:


Code:
Format Use
L(true/false) Optional logical truthity
l Logical truthity
K<callback>(default text) Optional custom operator
k<callback> Custom operator
B(binary) Optional binary number
b Binary number
N(any format number) Optional number
n Number
C(character) Optional character
c Character
I(integer) Optional integer
i Integer
D(integer) Optional integer
d Integer
H(hex value) Optional hex number
h Hex number
O(octal value) Optional octal value
o Octal value
F(float) Optional floating point number
f Floating point number
G(float/INFINITY/-INFINITY/NAN/NAN_E) Optional float with IEEE definitions
g Float with IEEE definitions
{ Open quiet section
} Close quiet section
P<delimiter> Invalid delimiter change
p<delimiter> Delimiter change
Z(string)[length] Invalid optional string
z(string)[length] Deprecated optional string
S(string)[length] Optional string
s[length] String
U(name/id) Optional user (bot/player)
u User (bot/player)
Q(name/id) Optional bot (bot)
q Bot (bot)
R(name/id) Optional player (player)
r Player (player)
A<type>(default)[length] Optional array of given type
a<type>[length] Array of given type
E<specification>(default) Optional enumeration of given layout
e<specification> Enumeration of given layout
'string' Search string
% Deprecated optional specifier prefix

Taken from here (http://forum.sa-mp.com/showthread.php?t=120356)