04.12.2014, 14:38
Hello, i am having trouble getting data from an array into a query. When i dont use the format it perfectly outputs everything i need. But when i format that into a string it starts running every load id through there. Here is the code:
And this is the log:
But i just want it to put the from locations in, not all the from locations. just the ones for that load.
Anyone knows?
pawn Код:
CMD:importloads(playerid, params[])
{
new string[512];
for(new i; i < 1000; i++)
{
// LoadName, MafiaLoad, PayPerUnit, VehicleNeeded, From-Locations, To-Locations
printf("%s", ALoads[i][LoadName]);
printf("%f", ALoads[i][PayPerUnit]);
printf("%i", ALoads[i][PCV_Required]);
for(new a; a < 10; a++)
{
if(ALoads[i][FromLocations][a] != 0)
{
printf("From: %i", ALoads[i][FromLocations][a]);
format(string, sizeof(string), "%s, %i", string, ALoads[i][FromLocations][a]);
}
if(ALoads[i][ToLocations][a] != 0)
{
printf("To: %i", ALoads[i][ToLocations][a]);
}
}
print(string);
}
return 1;
}
Код:
[16:21:24] Wounded person [16:21:24] 1.000000 [16:21:24] 9 [16:21:24] From: 1 [16:21:24] To: 147 [16:21:24] From: 2 [16:21:24] To: 148 [16:21:24] From: 3 [16:21:24] To: 149 [16:21:24] From: 4 [16:21:24] To: 150 [16:21:24] From: 5 [16:21:24] From: 6 [16:21:24] From: 7 [16:21:24] From: 8 [16:21:24] From: 9 [16:21:24] From: 10 [16:21:24] , 11, 12, 11, 12, 12, 13, 10, 6, 15, 16, 17, 19, 21, 22, 21, 22, 8, 25, 26, 8, 25, 26, 153, 8, 25, 26, 8, 25, 26, 37, 38, 37, 153, 37, 8, 25, 37, 38, 143, 21, 22, 41, 37, 41, 136, 144, 15, 15, 37, 47, 63, 6, 7, 44, 47, 48, 15, 54, 55, 56, 24, 55, 7, 24, 48, 47, 48, 10, 4, 154, 21, 22, 157, 43, 14, 63, 6, 43, 12, 7, 44, 47, 48, 15, 54, 55, 56, 24, 55, 7, 24, 48, 47, 48, 10, 4, 21, 22, 43, 14, 121, 122, 125, 126, 130, 131, 134, 123, 124, 127, 128, 129, 132, 133, 135, 121, 122, 125, 126, 130, 131, 134, 7, 44,
Anyone knows?