// The array contains this: "0,5,5,0,3".
new a[5];
sscanf(PlayerInfo[playerid][Inventory], "p<,>a<i>[5]", a);
for (new s; s < 5; ++s)
{
if (a[s]) SendClientMessage(playerid, -1, a[s]);
}
|
I don't have my pc now but it should be a<i>[5] only without the p..
|
new panels, doors, lights, wheels; sscanf(Vehicle[id][VisualDamage], "p<|>dddd", panels, doors, lights, wheels); // VisualDamage is a string that contains 0|3|4|2 and I recive: panels = 0 doors = 3 lights = 4 wheels = 2
a[6];
I want to retrieve the data spaced by commas (,) and insert the data in the "a" array:
// PlayerInfo[playerid][Inventory] is a String that contains "0,5,5,0,3,"
sscanf(PlayerInfo[playerid][Inventory], "p<,>a<i>[6]", a);
for (new s; s < 6; ++s)
{
if (a[s]) SendClientMessage(playerid, -1, a[s]);
}
[13:38:23] HidroDF says: 5
[13:38:23] HidroDF says: 5 [13:38:23] HidroDF says: 5 [13:38:23] HidroDF says: 3
sscanf("0,5,5,0,3","p<,>ccccc" ,a[0],a[1],a[2],a[3],a[4]);
main()
{
new a[] = "2,1,3,4", b[5];
printf("-----");
if(sscanf(a, "p<,>a<i>[5]", b))
print("debug");
for (new s; s < 5; ++s)
{
printf("%i & %i", a[s], b[s]);
}
}