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



Не найдено.

8 posts in this topic

Спойлер

stock IsABike(vehicleid)
{
    switch(GetVehicleModel(vehicleid))
    {
        case 481, 509, 510:
        {
            return 1;
        }
    }
    return 0;
}

stock IsAVel(vehicleid)
{
    switch(GetVehicleModel(vehicleid))
    {
        case 481,509,510: return 1;
    }
    return 0;
} 

 

 

Edited by Gaiduk

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

@Gaiduk, код показывайте, где спидометр "включается" (появляется у игроков).

Share this post


Link to post
Share on other sites

@odosenok 

Спойлер

forward update_speedometer(playerid);
public update_speedometer(playerid)
{
	if(IsPlayerDriver(playerid))
	{
		new vehicleid = GetPlayerVehicleID(playerid);
		new speed = speed = GetVehicleSpeed(vehicleid);

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

		new fmt_td_text[85];

		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);
		}

		format(fmt_td_text, sizeof fmt_td_text, "%d km/h", speed);
		PlayerTextDrawSetString(playerid, speedometer_td[playerid][6], fmt_td_text);

		format(fmt_td_text, sizeof fmt_td_text, "%.0f L.", vehicle[vehicleid-1][veh_fuel]);
		PlayerTextDrawSetString(playerid, speedometer_td[playerid][4], fmt_td_text);

		if(player_ownable_car[playerid] == vehicleid)
		{
			new index = vehicleid - ownable_car_id[0];
		    ownable_car[index][oc_mileage] += speed / (2*3600.0);

			format(fmt_td_text, sizeof fmt_td_text, "%.1f KM", ownable_car[index][oc_mileage]);
			PlayerTextDrawSetString(playerid, speedometer_td[playerid][2], fmt_td_text);
		}
		else
		{
			vehicle[vehicleid-1][veh_mileage] += speed / (2*3600.0);
			format(fmt_td_text, sizeof fmt_td_text, "%.1f KM", vehicle[vehicleid-1][veh_mileage]);
			PlayerTextDrawSetString(playerid, speedometer_td[playerid][2], fmt_td_text);
		}

		UpdatePlayerSpeedTD(playerid);
		SetTimerEx("update_speedometer", 1000, false, "i", playerid);
	}
	return 1;
}

 

 

Share this post


Link to post
Share on other sites

Покажи OnPlayerStateChange, именно там где включается таймер спидометра, включается textdraw спидометра и т.д... 

Edited by Покемон

Share this post


Link to post
Share on other sites

@Покемон 

Спойлер

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vehicleid = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_ONFOOT)
	{
	}
	if(newstate == PLAYER_STATE_DRIVER)
	{
		CheckEnterCar(playerid);
		if(player_job_vehicle_created[playerid] != -1)
		{
			if(player_end_job_timer[playerid] != 0 && vehicleid == player_job_vehicle_created[playerid] || vehicleid == player_job_vehicle_arend[playerid])
			{
				KillTimer(player_end_job_timer[playerid]);
			}
			
			if(vehicleid == player_job_vehicle_created[playerid] && player_info[playerid][WORK] == 3)
			{
                if(GetPVarInt(playerid, "get_in_the_car_trucker") == 1)
                {
					DisablePlayerCheckpoint(playerid);
					SetPlayerCheckpoint(playerid, 2738.3975,-2271.2632,17.9269, 5.0, CP_ACTION_TYPE_TRUCKER_TAKE);
					SendClientMessage(playerid, COLOR_BLUE, "Вы взяли грузовик, отправляйтесь на загрузку.");
					player_job_timer[playerid] = 0;
					SetPVarInt(playerid, "get_in_the_car_trucker",0);
				}
				SetPVarInt(playerid,"trucker_id", vehicleid);
			}
			if(vehicleid == player_job_vehicle_created[playerid] && player_info[playerid][JOB] == 4)
			{
				DisablePlayerRaceCheckpoint(playerid);
			    SetPlayerRaceCheckpoint(playerid,0, 1827.5311,2236.0811,15.6289,0.0,0.0,0.0, 5.0, RCP_ACTION_TYPE_CLEANER);
				player_job_timer[playerid] = 0;
			}
		}
		
		if(vehicleid >= CategoryB[0] && vehicleid <= CategoryB[1])
		{
			if(GetPVarInt(playerid, "lesson_b") == 1)
			{
				SetPlayerVirtualWorld(playerid, 1);
				SetVehicleVirtualWorld(vehicleid, 1);
				Send(playerid, COLOR_BLUE, "Вы начали практическую часть сдачи на права категории B!");
				SetPlayerRaceCheckpoint(playerid,0,1899.6517,2246.5349,15.9095,1887.0807,2201.9712,16.0329,5.0, RCP_ACTION_TYPE_DRIVING_TEST);
				Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
				pPressed[playerid] = 0;
			}
			else Send(playerid, COLOR_GREY, "Этот транспорт для сдачи на права категории B."), RemovePlayerFromVehicle(playerid);
		}
		
		if(vehicleid >= CategoryA[0] && vehicleid <= CategoryA[1])
		{
			if(GetPVarInt(playerid, "lesson_a") == 1)
			{
				SetPlayerVirtualWorld(playerid, 1);
				SetVehicleVirtualWorld(vehicleid, 1);
				Send(playerid, COLOR_BLUE, "Вы начали практическую часть сдачи на права категории A!");
				SetPlayerRaceCheckpoint(playerid,0,1899.6517,2246.5349,15.9095,1887.0807,2201.9712,16.0329,5.0, RCP_ACTION_TYPE_DRIVING_TEST);
				Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
				pPressed[playerid] = 0;
			}
			else Send(playerid, COLOR_GREY, "Этот транспорт для сдачи на права категории A."), RemovePlayerFromVehicle(playerid);
		}
		if(vehicleid >= CategoryC[0] && vehicleid <= CategoryC[1])
		{
			if(GetPVarInt(playerid, "lesson_c") == 1)
			{
				SetPlayerVirtualWorld(playerid, 1);
				SetVehicleVirtualWorld(vehicleid, 1);
				Send(playerid, COLOR_BLUE, "Вы начали практическую часть сдачи на права категории C!");
				SetPlayerRaceCheckpoint(playerid,0,1899.6517,2246.5349,15.9095,1887.0807,2201.9712,16.0329,5.0, RCP_ACTION_TYPE_DRIVING_TEST);
				Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
				pPressed[playerid] = 0;
			}
			else Send(playerid, COLOR_GREY, "Этот транспорт для сдачи на права категории C."), RemovePlayerFromVehicle(playerid);
		}
		if(vehicleid == CategoryD)
		{
			if(GetPVarInt(playerid, "lesson_d") == 1)
			{
				SetPlayerVirtualWorld(playerid, 1);
				SetVehicleVirtualWorld(vehicleid, 1);
				Send(playerid, COLOR_BLUE, "Вы начали практическую часть сдачи на права категории D!");
				SetPlayerRaceCheckpoint(playerid,0,1899.6517,2246.5349,15.9095,1887.0807,2201.9712,16.0329,5.0, RCP_ACTION_TYPE_DRIVING_TEST);
				Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
				pPressed[playerid] = 0;
			}
			else Send(playerid, COLOR_GREY, "Этот транспорт для сдачи на права категории D."), RemovePlayerFromVehicle(playerid);
		}
		
		SpeedometrShowForPlayer(playerid);
		SetTimerEx("update_speedometer", 1000, false, "i", playerid);
		
		new engine, lights, alarm, doors, bonnet, boot, objective;
		GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);

		PlayerTextDrawColor(playerid, speedometer_td[playerid][12], lights == 0 ? COLOR_GREEN : COLOR_WHITE);
		
		if(engine == 0)
		{
			if(player_buy_car[playerid] != -1) 
				return 1;
			
			Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
		}
		else
		{
			SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
		}	 
	}
	else if(oldstate == PLAYER_STATE_DRIVER)
	{
		if(player_job_vehicle_arend[playerid] != -1)
		{
			player_end_job_timer[playerid] = SetTimerEx("EndJobEndJob", 15_000, false, "i", playerid);

			Send(playerid, 0xFF6600FF, "У Вас есть 15 секунд чтобы вернуться в транспорт");
		}
		if(GetPVarInt(playerid, "trucker_id") == player_job_vehicle_created[playerid] && player_info[playerid][WORK] == 3)
		{
			player_end_job_timer[playerid] = SetTimerEx("TakeTruck", 15_000, false, "i", playerid);

			Send(playerid, 0xFF6600FF, "У Вас есть 15 секунд чтобы вернуться в транспорт");
		}
		SpeedometrHideForPlayer(playerid);
	}
	else if(newstate == PLAYER_STATE_PASSENGER)
	{
	}
	else if(oldstate == PLAYER_STATE_PASSENGER)
	{
	}
	
	return 1;
}

 

 

Share this post


Link to post
Share on other sites

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	new vehicleid = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_ONFOOT)
	{
	}
	if(newstate == PLAYER_STATE_DRIVER)
	{
		CheckEnterCar(playerid);
		if(player_job_vehicle_created[playerid] != -1)
		{
			if(player_end_job_timer[playerid] != 0 && vehicleid == player_job_vehicle_created[playerid] || vehicleid == player_job_vehicle_arend[playerid])
			{
				KillTimer(player_end_job_timer[playerid]);
			}
			
			if(vehicleid == player_job_vehicle_created[playerid] && player_info[playerid][WORK] == 3)
			{
                if(GetPVarInt(playerid, "get_in_the_car_trucker") == 1)
                {
					DisablePlayerCheckpoint(playerid);
					SetPlayerCheckpoint(playerid, 2738.3975,-2271.2632,17.9269, 5.0, CP_ACTION_TYPE_TRUCKER_TAKE);
					SendClientMessage(playerid, COLOR_BLUE, "Вы взяли грузовик, отправляйтесь на загрузку.");
					player_job_timer[playerid] = 0;
					SetPVarInt(playerid, "get_in_the_car_trucker",0);
				}
				SetPVarInt(playerid,"trucker_id", vehicleid);
			}
			if(vehicleid == player_job_vehicle_created[playerid] && player_info[playerid][JOB] == 4)
			{
				DisablePlayerRaceCheckpoint(playerid);
			    SetPlayerRaceCheckpoint(playerid,0, 1827.5311,2236.0811,15.6289,0.0,0.0,0.0, 5.0, RCP_ACTION_TYPE_CLEANER);
				player_job_timer[playerid] = 0;
			}
		}
		if(vehicleid >= CategoryB[0] && vehicleid <= CategoryB[1])
		{
			if(GetPVarInt(playerid, "lesson_b") == 1)
			{
				SetPlayerVirtualWorld(playerid, 1);
				SetVehicleVirtualWorld(vehicleid, 1);
				Send(playerid, COLOR_BLUE, "Вы начали практическую часть сдачи на права категории B!");
				SetPlayerRaceCheckpoint(playerid,0,1899.6517,2246.5349,15.9095,1887.0807,2201.9712,16.0329,5.0, RCP_ACTION_TYPE_DRIVING_TEST);
				Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
				pPressed[playerid] = 0;
			}
			else Send(playerid, COLOR_GREY, "Этот транспорт для сдачи на права категории B."), RemovePlayerFromVehicle(playerid);
		}
		if(vehicleid >= CategoryA[0] && vehicleid <= CategoryA[1])
		{
			if(GetPVarInt(playerid, "lesson_a") == 1)
			{
				SetPlayerVirtualWorld(playerid, 1);
				SetVehicleVirtualWorld(vehicleid, 1);
				Send(playerid, COLOR_BLUE, "Вы начали практическую часть сдачи на права категории A!");
				SetPlayerRaceCheckpoint(playerid,0,1899.6517,2246.5349,15.9095,1887.0807,2201.9712,16.0329,5.0, RCP_ACTION_TYPE_DRIVING_TEST);
				Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
				pPressed[playerid] = 0;
			}
			else Send(playerid, COLOR_GREY, "Этот транспорт для сдачи на права категории A."), RemovePlayerFromVehicle(playerid);
		}
		if(vehicleid >= CategoryC[0] && vehicleid <= CategoryC[1])
		{
			if(GetPVarInt(playerid, "lesson_c") == 1)
			{
				SetPlayerVirtualWorld(playerid, 1);
				SetVehicleVirtualWorld(vehicleid, 1);
				Send(playerid, COLOR_BLUE, "Вы начали практическую часть сдачи на права категории C!");
				SetPlayerRaceCheckpoint(playerid,0,1899.6517,2246.5349,15.9095,1887.0807,2201.9712,16.0329,5.0, RCP_ACTION_TYPE_DRIVING_TEST);
				Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
				pPressed[playerid] = 0;
			}
			else Send(playerid, COLOR_GREY, "Этот транспорт для сдачи на права категории C."), RemovePlayerFromVehicle(playerid);
		}
		if(vehicleid == CategoryD)
		{
			if(GetPVarInt(playerid, "lesson_d") == 1)
			{
				SetPlayerVirtualWorld(playerid, 1);
				SetVehicleVirtualWorld(vehicleid, 1);
				Send(playerid, COLOR_BLUE, "Вы начали практическую часть сдачи на права категории D!");
				SetPlayerRaceCheckpoint(playerid,0,1899.6517,2246.5349,15.9095,1887.0807,2201.9712,16.0329,5.0, RCP_ACTION_TYPE_DRIVING_TEST);
				Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
				pPressed[playerid] = 0;
			}
			else Send(playerid, COLOR_GREY, "Этот транспорт для сдачи на права категории D."), RemovePlayerFromVehicle(playerid);
		}
		new engine, lights, alarm, doors, bonnet, boot, objective;
		GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
		if(engine == 0)
		{
			if(player_buy_car[playerid] != -1) 
				return 1;
			
			Send(playerid, COLOR_GREEN, "{ffffff}Чтобы завести транспорт, нажмите {45cbff}[л.CTRL]{ffffff} или же введите команду: {45cbff}/en");
		}
		else
		{
			SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
		}	 
		if(IsABike(vehicleid)) return 1;
		SpeedometrShowForPlayer(playerid);
		SetTimerEx("update_speedometer", 1000, false, "i", playerid);
		PlayerTextDrawColor(playerid, speedometer_td[playerid][12], lights == 0 ? COLOR_GREEN : COLOR_WHITE);
	}
	else if(oldstate == PLAYER_STATE_DRIVER)
	{
		if(player_job_vehicle_arend[playerid] != -1)
		{
			player_end_job_timer[playerid] = SetTimerEx("EndJobEndJob", 15_000, false, "i", playerid);

			Send(playerid, 0xFF6600FF, "У Вас есть 15 секунд чтобы вернуться в транспорт");
		}
		if(GetPVarInt(playerid, "trucker_id") == player_job_vehicle_created[playerid] && player_info[playerid][WORK] == 3)
		{
			player_end_job_timer[playerid] = SetTimerEx("TakeTruck", 15_000, false, "i", playerid);

			Send(playerid, 0xFF6600FF, "У Вас есть 15 секунд чтобы вернуться в транспорт");
		}
		SpeedometrHideForPlayer(playerid);
	}
	else if(newstate == PLAYER_STATE_PASSENGER)
	{
	}
	else if(oldstate == PLAYER_STATE_PASSENGER)
	{
	}
	return 1;
}

 

Edited by DEST

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

Большой код необходимо прятать под спойлер.

Share this post


Link to post
Share on other sites

@Покемон проблемы образовалась. 

Безымянный.png

Edited by Gaiduk

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