17.01.2012, 17:31
Take for instance that I want to create say 5 gas stations, How would I check if the person is in range of any of them without having to use || each time in an if statement?
enum GasStationEnum
{
Float:gas_x,
Float:gas_y,
Float:gas_z,
}
// Each gas station will have 3 arguments: the x, y, and z positions.
new gGasStations[][GasStationEnum] =
{
{1381.866699, 459.125488, 20.345203},
{-1328.8250,2677.2173,49.7665},
{656.4265,-559.8610,16.5015}
};
// ^ You can add your own
CMD:fill( playerid, params[] ) // example command
{
for( new i = 0; i < sizeof( GasStationEnum ); i++ ) // We loop all the possible elements in the array
{
if ( IsPlayerInRangeOfPoint( playerid, 5.0, gGasStations[i][gas_x], gGasStations[i][gas_y], gGasStations[i][gas_z] ) )
{
// do something
}
}
return 1;
}