SA-MP Forums Archive
[HELP] Usins sscanf and mysql.. dont understand - 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] Usins sscanf and mysql.. dont understand (/showthread.php?tid=123460)



[HELP] Usins sscanf and mysql.. dont understand - Zafire2008 - 25.01.2010

hey... someone give me this code for get data from a mysql database

Код:
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, ".", 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];
  format(textto, sizeof(textto), "Your pass is: %s", pinfo[playerid][pass]);
  SendClientMessage(playerid, COLOR_LIGHTBLUE, textto);
  return 1;
}
Wheell this saids "Your pass is:" but no saids the PASS .. example "Your pass is: 515gf6h5fh" like that :/ ...

so i dont understand the code and this part is rare... here

Код:
sscanf(line, "p.sdd", 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]
i dont understand "sscanf(line, "p.sdd"," what is the "p.sdd"

Any one can help me? plss


Re: [HELP] Usins sscanf and mysql.. dont understand - Zafire2008 - 25.01.2010

please help me. i dont understand the code dont take data from sql


Re: [HELP] Usins sscanf and mysql.. dont understand - Daren_Jacobson - 26.01.2010

pawn Код:
sscanf(line, ".", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]);
needs to be
pawn Код:
sscanf(line, "p.issiii", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]);



Re: [HELP] Usins sscanf and mysql.. dont understand - Zafire2008 - 26.01.2010

Quote:
Originally Posted by Daren_Jacobson
pawn Код:
sscanf(line, ".", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]);
needs to be
pawn Код:
sscanf(line, "p.issiii", pinfo[playerid][id], pinfo[playerid][nombre], pinfo[playerid][pass], pinfo[playerid][dinero], pinfo[playerid][trabajo], pinfo[playerid][admin]);
OHH THx a looooot!! workss its workss!! jeje i love you :$ XD