Fuel - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Fuel (
/showthread.php?tid=406175)
Fuel -
erorche - 09.01.2013
How to create for cars a FUEL Like this
Infernius: deasel
Sultan: gas tank
etc.
Re: Fuel -
Fabio11 - 09.01.2013
Make a variable like
pawn Код:
#define DIESEL 1
#define GAS_TANK 2
new FuelType[MAX_VEHICLES];
stock SetFuelTypes()
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(i == 411) return FuelType[i] = DIESEL; // Infernus
if(i == 560) return FuelType[i] = GAS_TANK; // Sultan
}
return 1;
}
public OnGameModeInit()
{
// Rest of your code
SetFuelTypes();
return 1;
}
And then use it as you wish in commands, dialogs, messages...
Re: Fuel -
erorche - 09.01.2013
thanks for variables,and but how to make a /fill cmd like,/fill in dialog what tank and if the car isn't that tank how to make it ?
+REP for variable
Re: Fuel -
Fabio11 - 09.01.2013
Well that depends on your fuel systems, I suggest you take an existing one and edit it with the code I gave to you before. To check the car fuel type is easy like:
pawn Код:
new carid = GetPlayerVehicleID(playerid);
if(FuelType[carid] == DIESEL) // This is for a Diesel station
{
// Do things
}
else
{
SendClientMessage(playerid, 0xFF0000C8, "This station is only for Diesel cars!");
return 1;
}