27.11.2013, 10:07
Hello,
i making fuel stations with randomize price of fuel as you can see.
So for example
etc..
And my question is: How to make e.g. GetActuallyFuelPrice() - return fuel price where player is(maybe by fStations?).
Edit: I trying something like that, is that correct? >
i making fuel stations with randomize price of fuel as you can see.
pawn Код:
#define MAX_FUEL_STATIONS 10
new fStations = 0;
enum FuelStations
{
Float:f_X,
Float:f_Y,
Float:f_Z,
Price
}
new fuel[MAX_FUEL_STATIONS][FuelStations];
pawn Код:
stock AddFuelStation(Float:x, Float:y, Float:z)
{
fStations++;
if(fStations > MAX_FUEL_STATIONS) return print("MAX_FUEL_STATIONS > 10 !");
fuel[fStations][f_X] = x;
fuel[fStations][f_Y] = y;
fuel[fStations][f_Z] = z;
fuel[fStations][Price] = RandomEx(15, 30);
printf("Fuel station id %i have price %i $", fStations, fuel[fStations][Price]);
return 1;
}
Код:
Fuel station id 1 have price 22 $
Код:
Fuel station id 2 have price 25 $
And my question is: How to make e.g. GetActuallyFuelPrice() - return fuel price where player is(maybe by fStations?).
Edit: I trying something like that, is that correct? >
pawn Код:
stock GetActuallyFuelPrice() return fuel[fStations][Price];