sscanf
#1

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]
Reply
#2

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?)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)