sscanf error -
dusk - 18.02.2013
pawn Код:
[10:56:15] sscanf error: String/array must include a length, please add a destination size.
[10:56:32] sscanf error: String/array must include a length, please add a destination size.
I get this in my server console if I use command plant,here it is:
pawn Код:
CMD:plant(playerid,params[])
{
if(PlayerItems[playerid][Mseeds]>=1)
{
new Float:x,Float:y,Float:z,string[126];
GetPlayerPos(playerid,x,y,z);
PlantOwner[Plants]=playerid;
PlantObjectID[Plants]=CreateObject(19473,x,y,z-1,4,0,0,0);
Plants++;
PlayerItems[playerid][Mseeds]=PlayerItems[playerid][Mseeds]-1;
SaveStats(playerid);
format(string,sizeof(string),"Liko seklu: %d",PlayerItems[playerid][Mseeds]);
SendClientMessage(playerid,0xFBFB00FF,string);
}
else SendClientMessage(playerid,0xFF0000FF,"You don't have any seeds");
return 1;
}
Can someone tell my what is the problem?
Re: sscanf error -
electrux - 18.02.2013
You must be using sscanf somewhere. As it is not here, i would recommend u to use -> sscanf(params,"s[the_size_of_string_var]",string_var) <-
instead of -> sscanf(params,"s",string_var) <-
Re: sscanf error -
dusk - 18.02.2013
That didn't help.... I noticed i get
pawn Код:
[18:59:09] sscanf error: String/array must include a length, please add a destination size.
this,when i enter the server.
Re: sscanf error -
Boooth - 18.02.2013
Can you put your SaveStats function up aswell, might be a problem in there.
Re: sscanf error -
dusk - 18.02.2013
pawn Код:
stock SaveStats(playerid)
{
new query[512];
format(query,sizeof(query),"UPDATE `users` SET alevel = '%d', Items = '%s', Money = '%d', level = '%d', Job = '%d', Mechanic = '%d', SkinID = '%d', Hours = '%d',\
Police = '%d', Medic = '%d' WHERE `username` = '%s'",
PlayerInfo[playerid][alevel],PlayerInfo[playerid][items],
PlayerInfo[playerid][money],PlayerInfo[playerid][level],PlayerInfo[playerid][Job],
PlayerInfo[playerid][Mechanic],PlayerInfo[playerid][SkinID],PlayerInfo[playerid][Hours],
PlayerInfo[playerid][Police],PlayerInfo[playerid][Medic],Name);
mysql_query(query);
return 1;
}
Re: sscanf error -
Boooth - 18.02.2013
Why is the SaveStats function in that command?
As far as I can see you aren't saving any of the variables within that code.
But from what I can gather from the message, you need to CTRL+F and type sscanf.
Where you see an "s" without [32] or other size next to it in between the quotation marks, find the strings size and add it in next to the "s"
Example:
pawn Код:
new string[64];
if(sscanf(params, "s", string)) ...
Would then become:
pawn Код:
new string[64];
if(sscanf(params, "s[64]", string))...
Do you understand?
Re: sscanf error -
dusk - 18.02.2013
I do. I thought i did that before. But I found one! I think my problem is gone! Thankyou!