SA-MP Forums Archive
sscanf - 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 (/showthread.php?tid=491886)



sscanf - Yako - 01.02.2014

Hello, I want to ask help with sscanf when loading mysql data.

Here is the sscanf:
Код:
p<|>s[34]ddddddfffddddddddds[24]dddddddddddddddddds[32]s[32]ddds[32]s[32]dds[32]
The mysql field is varchar and it looks like this:
Код:
0,0,0,0,0,0,0,0,0
How to read that field to these?
Код:
PlayerInfo[playerid][pDrugs][0], PlayerInfo[playerid][pDrugs][1], PlayerInfo[playerid][pDrugs][2], PlayerInfo[playerid][pDrugs][3], PlayerInfo[playerid][pDrugs][4], PlayerInfo[playerid][pDrugs][5], PlayerInfo[playerid][pDrugs][6],
PlayerInfo[playerid][pDrugs][7], PlayerInfo[playerid][pDrugs][8]



Re: sscanf - Misiur - 01.02.2014

Use another sscanf on that string with pattern "p<,>a<i>[9]" (9 integers in an array, separated with commas).

For future reference, that's not a good datatable design (how yould you search for sepcific player with pDrugs at index 6 with value of X?)