sscanf split problem - 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: sscanf split problem (
/showthread.php?tid=496964)
sscanf split problem -
Dj_maryo1993 - 24.02.2014
Ok so i have the following DB
id|Name|Password|Admin|Money|LastLogin|Banned|BanT ime|MotivBan
and this code
pawn Код:
enum PlayerInfo
{
id, // integer
Name[24],
Password[24],
Admin,
Money,
LastLogin[24],
Banned, // integer 1 or 0
BanTime, // string , as day/month/year/hour/minute
MotivBan, // reason for ban , string
}
new PInfo[MAX_PLAYERS][PlayerInfo];
and the spliting
pawn Код:
format(Query, sizeof(Query), "SELECT * FROM `Users` WHERE `Name` = '%s' ", pName);
mysql_query(1,Query);
mysql_store_result();
mysql_fetch_row_format(Query, "|");
sscanf(Query, "e<p<|>is[24]s[24]iis[24]is[24]s[24]>", PInfo[playerid]);
printf("%s",PInfo[playerid][MotivBan]);
Strangely it outputs me
Код:
[07:17:46] 5/2/2015/5/3
Here is the data in the DB
Re: sscanf split problem -
Konstantinos - 24.02.2014
You said
BanTime and
MotivBan are strings, even though they're not arrays in your enum but integers.
Re: sscanf split problem -
Dj_maryo1993 - 24.02.2014
Ty very much mate .
Lack of sleep certanly makes you miss the little stuff