Question

В моде есть бизнес "АЗС", и вот он не заправляет.

Код:

CMD:buyfuel(playerid)
{
    if(antiflood[playerid] > 0) return SendClientMessage(playerid, COLOR_WARNING,"Не флуди!");
    antiflood[playerid]++;
    if(PLAYER_DATA[playerid][data_LOGGED] == false) return SendClientMessage(playerid,COLOR_WARNING,"Вы не авторизованы на сервере!");
    for(new b = 0; b < TotalBusiness; b++)
    {
        if(PlayerToPoint(10.0, playerid, BUSINESS_DATA[b][data_BUYX],BUSINESS_DATA[b][data_BUYY], BUSINESS_DATA[b][data_BUYZ]))
        {
            if(BUSINESS_DATA[b][data_TYPE] == 1)
            {
			    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
				{
					new dtext[256];
					format(dtext,sizeof(dtext),"Бензин\nКанистра (10 л)\nЗапчасти");
				    ShowPlayerDialogFix(playerid, dialog_BUYFUEL, DIALOG_STYLE_LIST, "{FFCC00}АЗС", dtext, "Купить", "Отмена");
				    SetPVarInt(playerid, "business",b);
					return true;
				}
			}
		}
	}
	return true;
}
case dialog_BUYFUEL_1:
		{
			if(!response) return true;
			if(response)
			{
	  			if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
				{
				    new b = GetPVarInt(playerid,"business");
		   			new cena = BUSINESS_DATA[b][data_CENA]*strval(inputtext);
				    new car = GetPlayerVehicleID(playerid);
		   			if(strval(inputtext) <= 0) return SendClientMessage(playerid, COLOR_WARNING, "Недопустимое значение!");
					if(strval(inputtext)+CAR_DATA[car][data_FUEL] > 50) return SendClientMessage(playerid, COLOR_WARNING, "Допустимо максимум 50 литров в баке!");
                    if(strval(inputtext) > BUSINESS_DATA[b][data_PROD]  && BUSINESS_DATA[b][data_OWNED] == 1) return SendClientMessage(playerid,COLOR_WARNING,"Недостаточно топлива на складе!");
					if(get_player_money(playerid) < cena) return SendClientMessage(playerid,COLOR_WARNING,"У Вас недостаточно денег на руках!");

                    BUSINESS_DATA[b][data_PROD] -= strval(inputtext);
					BUSINESS_DATA[b][data_BANK] += cena;
					give_player_money(playerid,-cena,"#28");
					CAR_DATA[playerid][data_FUEL] += strval(inputtext);
					UpdateBusinessData(b);
					
					new ftext[15];
					format(ftext, sizeof(ftext),"fuel: %d", CAR_DATA[car][data_FUEL]);
					PlayerTextDrawSetString(playerid,SpeedometrFuel[playerid],ftext);
        
        
				}
			}
		}

 

Share this post


Link to post

2 answers to this question

  • 0
32 минуты назад, HAPKOMAH сказал:

CAR_DATA[playerid][data_FUEL] += strval(inputtext);

заменить на

CAR_DATA[GetPlayerVehicleID(playerid)][data_FUEL] += strval(inputtext); 

 

Share this post


Link to post
  • 0
19 минут назад, DEST сказал:

заменить на


CAR_DATA[GetPlayerVehicleID(playerid)][data_FUEL] += strval(inputtext); 

 

Больше спасибо! Тема закрыта.

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content