SA-MP Forums Archive
[HELP]sscanf console error - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]sscanf console error (/showthread.php?tid=123493)



[HELP]sscanf console error - Zafire2008 - 26.01.2010

I se this code for my server..

Код:
LoadData(playerid)
{
  new
    pName[24],
    query[61],
    line[100];

  GetPlayerName(playerid, pName, 24);
  mysql_real_escape_string(pName, pName);
  format(query, sizeof(query), "SELECT * FROM jugadores WHERE nombre='%s'", pName); // we check and get the gata from that name
  mysql_query(query);
  mysql_store_result(); // we store the result.
  mysql_fetch_row_format(line, "."); // we set a delimiter
  sscanf(line, "p.issiii", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]); // this will get the first 3 fields into pinfo[playerid][playeri]
  mysql_free_result();
  new textto[128];
  SendClientMessage(playerid, COLOR_LIGHTBLUE, textto);
  return 1;
}
When i am in the servers.. works perfectly the code but i dont know this error... apperas in my server console.. i dont understand it



Any help?




Re: [HELP]sscanf console error - Zafire2008 - 26.01.2010

I fix the p<.> error but i dont fix the otherr


Re: [HELP]sscanf console error - Zafire2008 - 26.01.2010

I need to fix that error the warning pls help here is the line

Код:
sscanf(line, "p<.>issiii", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]); // this will get the first 3 fields into pinfo[playerid][playeri][/code{



Re: [HELP]sscanf console error - bogeymanEST - 27.01.2010

You must specify the string's size. http://forum.sa-mp.com/index.php?topic=145539.0 read the "Strings" section


Re: [HELP]sscanf console error - Zafire2008 - 27.01.2010

Thx for help but i dont know where put the size?.. i need tu usea sizeof


Re: [HELP]sscanf console error - bogeymanEST - 29.01.2010

The size of the string goes right behind the specifier.
Example:
pawn Код:
new str[20];
sscanf("hello there", "s[20]", str);



Re: [HELP]sscanf console error - Zafire2008 - 29.01.2010

Quote:
Originally Posted by bogeyman_EST
The size of the string goes right behind the specifier.
Example:
pawn Код:
new str[20];
sscanf("hello there", "s[20]", str);
dont understand in this line where i need to put the size

sscanf(line, "p<.>issiiiiiiiifffiii", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][nivel], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin], pinfo[playerid][online], pinfo[playerid][phone], pinfo[playerid][banco], pinfo[playerid][skin], pinfo[playerid][px], pinfo[playerid][py], pinfo[playerid][pz], pinfo[playerid][hp], pinfo[playerid][armor], pinfo[playerid][sp]);


Re: [HELP]sscanf console error - bogeymanEST - 30.01.2010

pawn Код:
sscanf(line, "p<.>is[/*insert size of pinfo[playerid][nombre] here */]s[/*insert size of pinfo[playerid][pass] here*/]iiiiiiiifffiii", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][nivel], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin], pinfo[playerid][online], pinfo[playerid][phone], pinfo[playerid][banco], pinfo[playerid][skin], pinfo[playerid][px], pinfo[playerid][py], pinfo[playerid][pz], pinfo[playerid][hp], pinfo[playerid][armor], pinfo[playerid][sp]);