31.12.2011, 15:25
Quote:
Actually, the output value is correct if i do printf("%d", carscounted); after the carscounted = CountVehicles();. And this is what makes me think that the value is defined incorrectly at the start of the script.
Код:
stock CountVehicles(){new cars; for(new i = 0; i < 500; i++){ if(GetVehicleModel(i)!=0){ cars++;}}return cars;} |
pawn Код:
#define macro CountVehicles()+1
stock CountVehicles()
{
new cars;
for(new i = 0; i < 500; i++) if(GetVehicleModel(i)!=0) cars++;
return cars;
}
public OnGameModeInit()
{
CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60);
printf("%d",CountVehicles());
printf("%d",macro);
return 1;
}
Код:
Output: 1 2