Рекомендованные сообщения



8 posts in this topic

Когда создаю машину и сажусь в неё, то там ноль литров, но я могу ехать. 

Спойлер

	if(PRESSED(KEY_ACTION))
	{
		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;

		new vehicleid = GetPlayerVehicleID(playerid);

		new engine, lights, alarm, doors, bonnet, boot, objective;
		GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);

		GetVehicleHealth(vehicleid, veh_health);

		if(vehicle[vehicleid-1][veh_fuel] == 0.0)
		{
			SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
            UpdatePlayerSpeedTD(playerid);
		}
		UpdatePlayerSpeedTD(playerid);
		SetVehicleParamsEx(vehicleid, engine == 1 ? 0 : 1, lights, alarm, doors, bonnet, boot, objective);
		return 1;
	}
	return 1;
}
CMD:veh(playerid, params[])
{
    if(GetPVarInt(playerid, "logged") == 0) return 1;
	if(player_info[playerid][ADMIN] < 3)
		return invalid_command(playerid);

	extract params -> new model_id, color_1, color_2; else return Send(playerid, 0xFFCC00AA, "•[Подсказка] {ffffff}Введите: /veh [model] [color_1] [color_2]");
	if(!(400 <= model_id <= 611)) return Send(playerid, -1, "от 400 до 611");

	new Float: x, Float: y, Float: z;
	GetPlayerPos(playerid, x, y, z);

	new vehicleid = CreateVehicle(model_id, x + 2, y + 3, z, 0, color_1, color_2, -1);
	
	vehicle[vehicleid][veh_fuel] = 100.0;
	vehicle[vehicleid][veh_crete_adm] = 1;
	
	new engine, lights, alarm, doors, bonnet, boot, objective;
	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	SetVehicleParamsEx(vehicleid, 0, lights, alarm, 0, bonnet, boot, objective);
	
	new fmt_msg[128];
	format(fmt_msg, sizeof fmt_msg, "[A] %s[%d] создал временный транспорт (%d, %s [%d|%d])", player_info[playerid][NAME], playerid, vehicleid, 		           GetCarName(GetVehicleModel(vehicleid)), color_1, color_2);
	SendMessageToAdmins(fmt_msg, COLOR_GREY);
	
	return 1;
}
forward update_speedometer(playerid);
public update_speedometer(playerid)
{
		if(engine == 1)
		{
			if(vehicle[vehicleid-1][veh_fuel] > 0.0)
			{
				vehicle[vehicleid-1][veh_fuel] -= 0.008;
				if(vehicle[vehicleid-1][veh_fuel] < 0.008)
				{
                    vehicle[vehicleid-1][veh_fuel] = 0.0;
					SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
				}
			}
		}
		if(vehicle[vehicleid-1][veh_fuel] == 0.0)
		{
			GameTextForPlayer(playerid, "~b~NO FUEL", 1000, 1);
		}
		return 1;
}

 

 

Edited by Gaiduk

Share this post


Link to post
Share on other sites

Замени. cmd:veh на это : 

Спойлер

CMD:veh(playerid, params[])
{
    if(GetPVarInt(playerid, "logged") == 0) return 1;
	if(player_info[playerid][ADMIN] < 3)
		return invalid_command(playerid);

	extract params -> new model_id, color_1, color_2; else return Send(playerid, 0xFFCC00AA, "•[Подсказка] {ffffff}Введите: /veh [model] [color_1] [color_2]");
	if(!(400 <= model_id <= 611)) return Send(playerid, -1, "от 400 до 611");

	new Float: x, Float: y, Float: z;
	GetPlayerPos(playerid, x, y, z);

	new vehicleid = CreateVehicle(model_id, x + 2, y + 3, z, 0, color_1, color_2, -1);
	
	vehicle[vehicleid-1][veh_fuel] = 100.0;
	vehicle[vehicleid-1][veh_crete_adm] = 1;
	
	new engine, lights, alarm, doors, bonnet, boot, objective;
	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	SetVehicleParamsEx(vehicleid, 0, lights, alarm, 0, bonnet, boot, objective);
	
	new fmt_msg[128];
	format(fmt_msg, sizeof fmt_msg, "[A] %s[%d] создал временный транспорт (%d, %s [%d|%d])", player_info[playerid][NAME], playerid, vehicleid, 		           GetCarName(GetVehicleModel(vehicleid)), color_1, color_2);
	SendMessageToAdmins(fmt_msg, COLOR_GREY);
	
	return 1;
}

 

 

Edited by odosenok
Причина: Взял код в тег "спойлер".

Заметка от odosenok , создано

Код больше четырех строк следует выкладывать с помощью тега "спойлер". Как это сделать?

Share this post


Link to post
Share on other sites

@Покемон проблема с командой /veh решина, но когда у меня ноль литров я могу ехать.

Share this post


Link to post
Share on other sites
Спойлер

forward update_speedometer(playerid);
public update_speedometer(playerid)
{
		new vehicleid = GetPlayerVehicleID(playerid);
		if(engine == 1)
		{
			if(vehicle[vehicleid-1][veh_fuel] > 0.0)
			{
				vehicle[vehicleid-1][veh_fuel] -= 0.008;
				if(vehicle[vehicleid-1][veh_fuel] < 1)
				{
                    vehicle[vehicleid-1][veh_fuel] = 0.0;
					SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
				}
			}
		}
		if(vehicle[vehicleid-1][veh_fuel] == 0.0)
		{
			GameTextForPlayer(playerid, "~b~NO FUEL", 1000, 1);
		}
		return 1;
}

 

 

Share this post


Link to post
Share on other sites

@Покемон ничего не получилось тоже самое.

Share this post


Link to post
Share on other sites

Помогите пожалуйста, когда у меня ноль бензина я могу ездить. 

Share this post


Link to post
Share on other sites

Помогите пожалуйста найти проблему с литрами

Share this post


Link to post
Share on other sites
Спойлер

if(PRESSED(KEY_ACTION))
	{
		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;

		new vehicleid = GetPlayerVehicleID(playerid);

		new engine, lights, alarm, doors, bonnet, boot, objective;
		GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);

		GetVehicleHealth(vehicleid, veh_health);

		if(vehicle[vehicleid-1][veh_fuel] == 0.0)
		{
			SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
            UpdatePlayerSpeedTD(playerid);
			return 1;
		}
		UpdatePlayerSpeedTD(playerid);
		SetVehicleParamsEx(vehicleid, engine == 1 ? 0 : 1, lights, alarm, doors, bonnet, boot, objective);
		return 1;
	}
	return 1;
}

 

Попробуйте так.
Так-же каждый код помещайте в отдельный спойлер, не понятно что и где за что отвечает.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • F0urdeuces
      By F0urdeuces
      Всем привет , как сделать чтобы в парковку только мог человек с определяемой фракцией