Question: quite simple.
#5

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

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;
}
The only limit is a slower code once you have an extreme ammount of gas stations!
Reply


Messages In This Thread
Question: quite simple. - by Dokins - 17.01.2012, 17:31
Re: Question: quite simple. - by T0pAz - 17.01.2012, 18:02
Re: Question: quite simple. - by Dokins - 17.01.2012, 18:04
Re: Question: quite simple. - by Gh05t_ - 17.01.2012, 18:10
Respuesta: Question: quite simple. - by admantis - 17.01.2012, 18:17

Forum Jump:


Users browsing this thread: 1 Guest(s)