17.01.2012, 18:17
You can make an array with all the possible gas stations and then loop all over them, checking if you are near any of these gas stations this way:
This is an example of ****** idea
The only limit is a slower code once you have an extreme ammount of gas stations!
This is an example of ****** idea
pawn Код:
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;
}