04.12.2014, 17:34
You need to clear the string whenever the outermost for-loop runs.
pawn Код:
CMD:importloads(playerid, params[])
{
new string[512];
for(new i; i < 1000; i++)
{
string[0] = 0; // Clear the string (just clear the first character)
// 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;
}