Доступ к готовым решениям

Переход в группу "Пользователь"

300.00 ₽
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

Мануал Спидометр как на Engine-rp для РЛС

Статус
В этой теме нельзя размещать новые ответы.

plakapenka

Специалист
Ко всем new:
PHP:
#define ONE_HUNDRED_MSECOND 			100
#define COLOR_BORDER 					0x00000AA
forward UpdateSpeedometr(playerid);
new Text:LBorder; //переменная л-границы  //
new Text:RBorder; //переменная п-границы  //
new Text:BBorder; //переменная н-границы  //
new Text:TBorder; //переменная в-границы  //
new	Text:Speed;
new Text:Fuelll;
new	Text:Health;
new Text:Box;
new	Text:SpeedShow[MAX_PLAYERS];
new	Text:HealthShow[MAX_PLAYERS];
new Text:FuelShow[MAX_PLAYERS];
new Text:StatusShow[MAX_PLAYERS];
new Text:Speed2Show[MAX_PLAYERS];
new Text:EngineShow[MAX_PLAYERS];
new STimer[MAX_PLAYERS];
В OnPlayerConnect:
PHP:
FuelShow[playerid] = TextDrawCreate(329.0, 387.0, "_");
	TextDrawBackgroundColor(FuelShow[playerid], COLOR_BLACK);
	TextDrawLetterSize(FuelShow[playerid],0.399999,1.710000);
	TextDrawFont(FuelShow[playerid], 2);
	TextDrawColor(FuelShow[playerid], COLOR_WHITE);
	TextDrawSetOutline(FuelShow[playerid], 1);
	TextDrawSetProportional(FuelShow[playerid],1);
	TextDrawSetShadow(FuelShow[playerid],1);

	SpeedShow[playerid] = TextDrawCreate(418.000000,366.000000,"0km/h");
	TextDrawBackgroundColor(SpeedShow[playerid],COLOR_BLACK);
	TextDrawLetterSize(SpeedShow[playerid],0.399999,1.710000);
	TextDrawFont(SpeedShow[playerid],2);
	TextDrawColor(SpeedShow[playerid],COLOR_WHITE);
	TextDrawSetOutline(SpeedShow[playerid],1);
	TextDrawSetProportional(SpeedShow[playerid],1);
	TextDrawSetShadow(SpeedShow[playerid],1);

	HealthShow[playerid] = TextDrawCreate(329.000000,366.000000,"0%");
	TextDrawBackgroundColor(HealthShow[playerid],COLOR_BLACK);
	TextDrawLetterSize(HealthShow[playerid],0.399999,1.710000);
	TextDrawFont(HealthShow[playerid],2);
	TextDrawColor(HealthShow[playerid],COLOR_WHITE);
	TextDrawSetOutline(HealthShow[playerid],1);
	TextDrawSetProportional(HealthShow[playerid],1);
	TextDrawSetShadow(HealthShow[playerid],1);

	StatusShow[playerid] = TextDrawCreate(377.0, 391.0, "_");
	TextDrawBackgroundColor(StatusShow[playerid], COLOR_BLACK);
	TextDrawLetterSize(StatusShow[playerid],0.259999,1.010000);
	TextDrawFont(StatusShow[playerid], 2);
	TextDrawColor(StatusShow[playerid], COLOR_WHITE);
	TextDrawSetOutline(StatusShow[playerid], 1);
	TextDrawSetProportional(StatusShow[playerid],1);
	TextDrawSetShadow(StatusShow[playerid],1);

	Speed2Show[playerid] = TextDrawCreate(461.0, 391.0, "_");
	TextDrawBackgroundColor(Speed2Show[playerid], COLOR_BLACK);
	TextDrawLetterSize(Speed2Show[playerid],0.239999,1.010000);
	TextDrawFont(Speed2Show[playerid], 2);
	TextDrawColor(Speed2Show[playerid], COLOR_WHITE);
	TextDrawSetOutline(Speed2Show[playerid], 1);
	TextDrawSetProportional(Speed2Show[playerid],1);
	TextDrawSetShadow(Speed2Show[playerid],1);

	EngineShow[playerid] = TextDrawCreate(432.0, 391.0, "_");
	TextDrawBackgroundColor(EngineShow[playerid], COLOR_BLACK);
	TextDrawLetterSize(EngineShow[playerid],0.259999,1.010000);
	TextDrawFont(EngineShow[playerid], 2);
	TextDrawColor(EngineShow[playerid], COLOR_WHITE);
	TextDrawSetOutline(EngineShow[playerid], 1);
	TextDrawSetProportional(EngineShow[playerid],1);
	TextDrawSetShadow(EngineShow[playerid],1);
В OnPlayerStateChange:
PHP:
if(newstate == 1)//скрываем спидак если выходит из машины
	{
			KillTimer(STimer[playerid]);
		    TextDrawHideForPlayer(playerid,Box);
		    TextDrawHideForPlayer(playerid,LBorder);
		    TextDrawHideForPlayer(playerid,RBorder);
		    TextDrawHideForPlayer(playerid,BBorder);
		    TextDrawHideForPlayer(playerid,TBorder);
			TextDrawHideForPlayer(playerid,Speed);
			TextDrawHideForPlayer(playerid,SpeedShow[playerid]);
			TextDrawHideForPlayer(playerid,Speed2Show[playerid]);
			TextDrawHideForPlayer(playerid,Health);
			TextDrawHideForPlayer(playerid,HealthShow[playerid]);
			TextDrawHideForPlayer(playerid,Fuelll);
			TextDrawHideForPlayer(playerid,FuelShow[playerid]);
			TextDrawHideForPlayer(playerid,StatusShow[playerid]);
			TextDrawHideForPlayer(playerid,EngineShow[playerid]);
	}
	if(newstate == PLAYER_STATE_DRIVER)//показываем спидак если залазит в кар
	{
	        STimer[playerid] = SetTimerEx("UpdateSpeedometr", ONE_HUNDRED_MSECOND, 1, "d", playerid);
    		TextDrawShowForPlayer(playerid,Box);
 			TextDrawShowForPlayer(playerid,LBorder);
 			TextDrawShowForPlayer(playerid,RBorder);
 			TextDrawShowForPlayer(playerid,BBorder);
 			TextDrawShowForPlayer(playerid,TBorder);
 			TextDrawShowForPlayer(playerid,Speed);
 			TextDrawShowForPlayer(playerid,SpeedShow[playerid]);
 			TextDrawShowForPlayer(playerid,Speed2Show[playerid]);
 			TextDrawShowForPlayer(playerid,Health);
 			TextDrawShowForPlayer(playerid,HealthShow[playerid]);
 			TextDrawShowForPlayer(playerid,Fuelll);
 			TextDrawShowForPlayer(playerid,FuelShow[playerid]);
 			TextDrawShowForPlayer(playerid,StatusShow[playerid]);
 			TextDrawShowForPlayer(playerid,EngineShow[playerid]);
	}
В конец мода:
PHP:
stock SpeedVehicle(playerid)
{
    new Float:ST[4];
	if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
	else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 213.3;
    return floatround(ST[3]);
}
public UpdateSpeedometr(playerid)
{
    if(GetPlayerState(playerid) == 2)
	{
	  	new locked[32],str[64],str2[64],str3[64],str4[64], str5[64], str6[64], Float:vehhel, vehh[20], vehs[20], vehe[20], veher[20];
	    if(IsLocked[GetPlayerVehicleID(playerid)] == true) locked = "~r~LOCK";
 		else locked = "~g~UNLOCK";

		GetVehicleHealth(GetPlayerVehicleID(playerid), vehhel);
		if(vehhel <= 500) vehh = "~r~";
		else vehh = "";
		if(Fuell[GetPlayerVehicleID(playerid)] <= 30) vehs = "~r~";
		else vehs = "";
		if(zavodis[playerid] == true) vehe = "~g~ON";
		else vehe = "~r~OFF";
		format(str, sizeof(str),"%d KM/H",SpeedVehicle(playerid) / 2);
		if(vehhel <= 300) format(str3, sizeof(str3),"%s30%",vehh); else format(str3, sizeof(str3),"%s%.0f%",vehh,vehhel / 10);
		format(str2, sizeof(str2), "%s", locked);
	    format(str4, sizeof(str4), "%s%.0f", vehs,Fuell[GetPlayerVehicleID(playerid)]);
	 	format(str5, sizeof(str5), "%s", vehe);
	 	format(str6, sizeof(str6), "%s", veher);

		TextDrawSetString(FuelShow[playerid],str4);
		TextDrawSetString(HealthShow[playerid],str3);
		TextDrawSetString(SpeedShow[playerid],str);
		TextDrawSetString(StatusShow[playerid],str2);
		TextDrawSetString(Speed2Show[playerid],str6);
		TextDrawSetString(EngineShow[playerid],str5);
		UnSurfCar(GetPlayerVehicleID(playerid));
	}
	return 0;
}
В OnGameModeInit:
PHP:
Box = TextDrawCreate(395.0, 354.0, "_");
    LBorder = TextDrawCreate(286.0,354.0,"_");
    RBorder = TextDrawCreate(504.0,354.0,"_");
	BBorder = TextDrawCreate(395.0,416.0,"_");
    TBorder = TextDrawCreate(395.0,354.0,"_");

    Speed = TextDrawCreate(377.000000,370.000000,"SPEED:");
    Health = TextDrawCreate(295.000000,370.000000,"HEAL:");
    Fuelll = TextDrawCreate(295.000000,391.000000,"FUEL:");

    TextDrawLetterSize(Speed,0.259999,1.110000);
    TextDrawLetterSize(Health,0.245999,1.110000);
	TextDrawLetterSize(Fuelll,0.259999,1.010000);

	TextDrawFont(Fuelll,2);
	TextDrawFont(Speed,2);
    TextDrawFont(Health,2);

    TextDrawBackgroundColor(Fuelll,COLOR_BLACK);
    TextDrawBackgroundColor(Speed,COLOR_BLACK);
	TextDrawBackgroundColor(Health,COLOR_BLACK);

    TextDrawColor(Fuelll,COLOR_BBLUE);
    TextDrawColor(Speed,COLOR_BBLUE);
	TextDrawColor(Health,COLOR_BBLUE);

	TextDrawSetOutline(Fuelll,1);
	TextDrawSetOutline(Speed,1);
	TextDrawSetOutline(Health,1);

	TextDrawSetProportional(Fuelll,1);
	TextDrawSetProportional(Speed,1);
	TextDrawSetProportional(Health,1);

	TextDrawSetShadow(Fuelll,1);
	TextDrawSetShadow(Speed,1);
	TextDrawSetShadow(Health,1);

    TextDrawUseBox(Box, 1);
    TextDrawBoxColor(Box, COLOR_BOX);
    TextDrawTextSize(Box, 0.0, 215.0);
    TextDrawLetterSize(Box, 0.0, 6.7);
    TextDrawAlignment(Box, 2);

    TextDrawUseBox(LBorder, 1);
    TextDrawBoxColor(LBorder,COLOR_BORDER);
    TextDrawTextSize(LBorder, 0.0, -2.0);
    TextDrawLetterSize(LBorder, 0.0, 6.7);
    TextDrawAlignment(LBorder, 2);

    TextDrawUseBox(RBorder, 1);
    TextDrawBoxColor(RBorder,COLOR_BORDER);
    TextDrawTextSize(RBorder, 0.0, -2.0);
    TextDrawLetterSize(RBorder, 0.0, 6.7);
    TextDrawAlignment(RBorder, 2);

    TextDrawUseBox(BBorder, 1);
    TextDrawBoxColor(BBorder, COLOR_BORDER);
    TextDrawTextSize(BBorder, 0.0, 215.0);
    TextDrawLetterSize(BBorder, 0.0, -0.2);
    TextDrawAlignment(BBorder, 2);

    TextDrawUseBox(TBorder, 1);
    TextDrawBoxColor(TBorder, COLOR_BORDER);
    TextDrawTextSize(TBorder, 0.0, 215.0);
    TextDrawLetterSize(TBorder, 0.0, -0.2);
    TextDrawAlignment(TBorder, 2);

 
Последнее редактирование модератором:
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу