Refueling vehicles
#1

Hello everyone.
I ask this question: How to make so that you can refuel vehicles when the engine is turned off?

That's the team I have to refuel:
Код HTML:
if(strcmp(cmd, "/fuel", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
			if(IsAtGasStation(playerid))
			{
				ShowPlayerDialog(playerid,291,DIALOG_STYLE_LIST,"Äîáðî ïîæàëîâàòü íà çàïðàâêó!Âûáåðèòå òèï òîïëèâà:","Äèçåëü\nAÈ 90\nAÈ 93\nAÈ 95","Âûáðàòü","Îòìåíà");
			}
			else
			{
				SendClientMessage(playerid,COLOR_GREY,"[Ñåðâåð]: Âû íå íà ÀÇÑ!");
			}
		}
		return true;
	}
And this is how the gamemode I have shown the engine running:
Код HTML:
VehicleInfo[vid][pEngineStatus] = 1;
Thanks in advance!
Reply
#2

pawn Код:
if(strcmp(cmd, "/fuel", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new vid = GetPlayerVehicleID(playerid);
            if(IsAtGasStation(playerid) && VehicleInfo[vid][pEngineStatus] == 0)
            {
                ShowPlayerDialog(playerid,291,DIALOG_STYLE_LIST,"Добро пожаловать на заправку!Выберите тип топлива:","Дизель\nAИ 90\nAИ 93\nAИ 95","Выбрать","Отмена");
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"[Сервер]: Вы не на АЗС!");
            }
        }
        return true;
    }
So, if
pawn Код:
VehicleInfo[vid][pEngineStatus] = 1;
the function that says it's off must be/probably is
pawn Код:
VehicleInfo[vid][pEngineStatus] = 0;
so you only have to add it in the function that's limiting the use of the cmd, which in this case is
pawn Код:
f(IsAtGasStation(playerid)
That way, you must add the function that says the engine is turned off together with the one that says if the player is in a gas station, so you use
pawn Код:
if(IsAtGasStation(playerid) && VehicleInfo[vid][pEngineStatus] == 0)
&& = and

you'll probably have to get the vehicle's id, so use
pawn Код:
new vid = GetPlayerVehicleID(playerid);
Reply
#3

thx man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)