Как сделать спидометр pawno
Создание спидометра с 0 [Урок 2] Оценка:
Ukrainian
Всем привет. В этом финальном уроке мы сделаем настоящий спидометр в не просто картинку =)
Итак. Идём в папку Ipleomax и заходим в папку scriptfiles. Открываем наш спидометр
Видем new-ы и наши отдельные текстдравы.
Давайте присвоим эти текстдравы для игрока а не для сервера.
К new-вам дописываем [MAX_PLAYERS].
Пример
Теперь идём к текст дравам там дописываем [playerid]
Пример
И так со всеми.
Далеее идём в наш мод.
Ко всем new мы дописываем new-вы из Ipleomax
Теперь давайте загрузим наши текстдравы
В конец мода
Ко всем new добавим необходимые new-вы
Теперь в OnGameModeInit
Мы добавили ManualVehicleEngineAndLights. Что же это?
Это стандартная ф-ция. без нее фары будут автоматично вкл/выкл в зависимости от того где машина в тёмном или светлом месте. А двигатель когда игрок садится в машину будет выключен. Без нее при посадке в машину двигатель будет включон даже если на спидометре он выкл.
В конец мода
Теперь создадим stock-ы которые будут менять значения на спидометре.
Этим сток можно открывать закрывать машину(просто вставив (Un)LockCar(carid) в нужно место)
Теперь нам нужно както узнать скорость автомобиля
Для этого в конце мода создаем stock
Создадим паблик в конце мода котрый будет обновлять спидометр
Теперь нужно зделать чтоб спидометр показывался только когда игрок зайдёт в машину и если выйдет то закрывался
Для этого идём в паблик OnPlayerStateChange
И пишем
Ко всем new добавим названия машин
Теперь установим кнопки для того чтобы включить или выключить двигатель или ограничитель скорости
В паблик OnPlayerKeyStateChange
mxINI
new Text : speedusebox [ MAX_PLAYERS ];
new Text : namevehicle [ MAX_PLAYERS ];
new Text : fuelvehicle [ MAX_PLAYERS ];
new Text : speedvehicle [ MAX_PLAYERS ];
new Text : millagevehicle [ MAX_PLAYERS ];
new Text : healthvehicle [ MAX_PLAYERS ];
new Text : statusengine [ MAX_PLAYERS ];
new Text : statuslock [ MAX_PLAYERS ];
new Text : statuslamp [ MAX_PLAYERS ];
new speedtimer [ MAX_PLAYERS ];
enum TRANSPORT Float : trFuel ,
Float : trMillage ,
Float : trExpense ,
Float : trHealth ,
Float : trPosX ,
Float : trPosY ,
Float : trPosZ
>;
new gTransport [ MAX_VEHICLES ][ TRANSPORT ];
ManualVehicleEngineAndLights ();
for(new veh = 0 ; veh < MAX_VEHICLES ; veh ++) gTransport [ veh ][ trFuel ] = 50 ;
gTransport [ veh ][ trExpense ] = 0.1 ;
SetVehicleParamsEx ( veh , false , false , false , false , false , false , false );
>
speedusebox [ playerid ] = TextDrawCreate ( 606.000000 , 357.625000 , "usebox" );
TextDrawLetterSize ( speedusebox [ playerid ], 0.000000 , 7.849999 );
TextDrawTextSize ( speedusebox [ playerid ], 425.500000 , 0.000000 );
TextDrawAlignment ( speedusebox [ playerid ], 1 );
TextDrawColor ( speedusebox [ playerid ], 0 );
TextDrawUseBox ( speedusebox [ playerid ], true );
TextDrawBoxColor ( speedusebox [ playerid ], 102 );
TextDrawSetShadow ( speedusebox [ playerid ], 0 );
TextDrawSetOutline ( speedusebox [ playerid ], 0 );
TextDrawFont ( speedusebox [ playerid ], 0 );
namevehicle [ playerid ] = TextDrawCreate ( 428.500000 , 346.500000 , "Clower" );
TextDrawLetterSize ( namevehicle [ playerid ], 0.449999 , 1.600000 );
TextDrawAlignment ( namevehicle [ playerid ], 1 );
TextDrawColor ( namevehicle [ playerid ], - 1 );
TextDrawSetShadow ( namevehicle [ playerid ], 0 );
TextDrawSetOutline ( namevehicle [ playerid ], 1 );
TextDrawBackgroundColor ( namevehicle [ playerid ], 51 );
TextDrawFont ( namevehicle [ playerid ], 0 );
TextDrawSetProportional ( namevehicle [ playerid ], 1 );
fuelvehicle [ playerid ] = TextDrawCreate ( 467.000000 , 362.250000 , "FUEL: 100L" );
TextDrawLetterSize ( fuelvehicle [ playerid ], 0.388999 , 0.956876 );
TextDrawAlignment ( fuelvehicle [ playerid ], 1 );
TextDrawColor ( fuelvehicle [ playerid ], - 1 );
TextDrawSetShadow ( fuelvehicle [ playerid ], 0 );
TextDrawSetOutline ( fuelvehicle [ playerid ], 1 );
TextDrawBackgroundColor ( fuelvehicle [ playerid ], 51 );
TextDrawFont ( fuelvehicle [ playerid ], 2 );
TextDrawSetProportional ( fuelvehicle [ playerid ], 1 );
speedvehicle [ playerid ] = TextDrawCreate ( 450.500000 , 372.750000 , "SPEED: 170KM/H" );
TextDrawLetterSize ( speedvehicle [ playerid ], 0.388998 , 0.956875 );
TextDrawAlignment ( speedvehicle [ playerid ], 1 );
TextDrawColor ( speedvehicle [ playerid ], - 1 );
TextDrawSetShadow ( speedvehicle [ playerid ], 0 );
TextDrawSetOutline ( speedvehicle [ playerid ], 1 );
TextDrawBackgroundColor ( speedvehicle [ playerid ], 51 );
TextDrawFont ( speedvehicle [ playerid ], 2 );
TextDrawSetProportional ( speedvehicle [ playerid ], 1 );
millagevehicle [ playerid ] = TextDrawCreate ( 455.500000 , 395.500000 , "MILLAGE: 0.00" );
TextDrawLetterSize ( millagevehicle [ playerid ], 0.388998 , 0.956875 );
TextDrawAlignment ( millagevehicle [ playerid ], 1 );
TextDrawColor ( millagevehicle [ playerid ], - 1 );
TextDrawSetShadow ( millagevehicle [ playerid ], 0 );
TextDrawSetOutline ( millagevehicle [ playerid ], 1 );
TextDrawBackgroundColor ( millagevehicle [ playerid ], 51 );
TextDrawFont ( millagevehicle [ playerid ], 2 );
TextDrawSetProportional ( millagevehicle [ playerid ], 1 );
healthvehicle [ playerid ] = TextDrawCreate ( 459.000000 , 383.687500 , "HEALTH: 100" );
TextDrawLetterSize ( healthvehicle [ playerid ], 0.388998 , 0.956875 );
TextDrawAlignment ( healthvehicle [ playerid ], 1 );
TextDrawColor ( healthvehicle [ playerid ], - 1 );
TextDrawSetShadow ( healthvehicle [ playerid ], 0 );
TextDrawSetOutline ( healthvehicle [ playerid ], 1 );
TextDrawBackgroundColor ( healthvehicle [ playerid ], 51 );
TextDrawFont ( healthvehicle [ playerid ], 2 );
TextDrawSetProportional ( healthvehicle [ playerid ], 1 );
statusengine [ playerid ] = TextDrawCreate ( 433.000000 , 409.500000 , "ENGINE" );
TextDrawLetterSize ( statusengine [ playerid ], 0.431499 , 1.490623 );
TextDrawAlignment ( statusengine [ playerid ], 1 );
TextDrawColor ( statusengine [ playerid ], - 1979184897 );
TextDrawSetShadow ( statusengine [ playerid ], 0 );
TextDrawSetOutline ( statusengine [ playerid ], 1 );
TextDrawBackgroundColor ( statusengine [ playerid ], 51 );
TextDrawFont ( statusengine [ playerid ], 2 );
TextDrawSetProportional ( statusengine [ playerid ], 1 );
statuslock [ playerid ] = TextDrawCreate ( 501.500000 , 409.500000 , "LOCK" );
TextDrawLetterSize ( statuslock [ playerid ], 0.431499 , 1.490623 );
TextDrawAlignment ( statuslock [ playerid ], 1 );
TextDrawColor ( statuslock [ playerid ], - 1979184897 );
TextDrawSetShadow ( statuslock [ playerid ], 0 );
TextDrawSetOutline ( statuslock [ playerid ], 1 );
TextDrawBackgroundColor ( statuslock [ playerid ], 51 );
TextDrawFont ( statuslock [ playerid ], 2 );
TextDrawSetProportional ( statuslock [ playerid ], 1 );
statuslamp [ playerid ] = TextDrawCreate ( 552.000000 , 409.500000 , "LAMP" );
TextDrawLetterSize ( statuslamp [ playerid ], 0.431499 , 1.490623 );
TextDrawAlignment ( statuslamp [ playerid ], 1 );
TextDrawColor ( statuslamp [ playerid ], - 1979184897 );
TextDrawSetShadow ( statuslamp [ playerid ], 0 );
TextDrawSetOutline ( statuslamp [ playerid ], 1 );
TextDrawBackgroundColor ( statuslamp [ playerid ], 51 );
TextDrawFont ( statuslamp [ playerid ], 2 );
TextDrawSetProportional ( statuslamp [ playerid ], 1 );
OnPlayerStateChange(playerid, newstate, oldstate)
if( newstate == PLAYER_STATE_DRIVER ) <
if(! enginenone ( GetPlayerVehicleID ( playerid ))) <
new veh = GetPlayerVehicleID ( playerid );
GetPlayerPos ( playerid , gTransport [ veh ][ trPosX ], gTransport [ veh ][ trPosY ], gTransport [ veh ][ trPosZ ]);
TextDrawShowForPlayer ( playerid , speedusebox [ playerid ]);
TextDrawShowForPlayer ( playerid , namevehicle [ playerid ]);
TextDrawShowForPlayer ( playerid , fuelvehicle [ playerid ]);
TextDrawShowForPlayer ( playerid , speedvehicle [ playerid ]);
TextDrawShowForPlayer ( playerid , millagevehicle [ playerid ]);
TextDrawShowForPlayer ( playerid , healthvehicle [ playerid ]);
TextDrawShowForPlayer ( playerid , statusengine [ playerid ]);
TextDrawShowForPlayer ( playerid , statuslock [ playerid ]);
TextDrawShowForPlayer ( playerid , statuslamp [ playerid ]);
speedtimer [ playerid ] = SetTimerEx ( "TransportUpdate" , 300 , true , "i" , playerid );
>
>
else if( newstate == PLAYER_STATE_ONFOOT ) <
TextDrawHideForPlayer ( playerid , speedusebox [ playerid ]);
TextDrawHideForPlayer ( playerid , namevehicle [ playerid ]);
TextDrawHideForPlayer ( playerid , fuelvehicle [ playerid ]);
TextDrawHideForPlayer ( playerid , speedvehicle [ playerid ]);
TextDrawHideForPlayer ( playerid , millagevehicle [ playerid ]);
TextDrawHideForPlayer ( playerid , healthvehicle [ playerid ]);
TextDrawHideForPlayer ( playerid , statusengine [ playerid ]);
TextDrawHideForPlayer ( playerid , statuslock [ playerid ]);
TextDrawHideForPlayer ( playerid , statuslamp [ playerid ]);
KillTimer ( speedtimer [ playerid ]);
>
else if( newkeys & 1 ) < // CTRL
if( GetPlayerState ( playerid ) == PLAYER_STATE_DRIVER ) new engine , lights , alarm , doors , bonnet , boot , objective ;
new veh = GetPlayerVehicleID ( playerid );
GetVehicleParamsEx ( veh , engine , lights , alarm , doors , bonnet , boot , objective );
if( engine == 0 ) SetVehicleParamsEx ( veh , true , lights , alarm , doors , bonnet , boot , objective );
>
else SetVehicleParamsEx ( veh , false , lights , alarm , doors , bonnet , boot , objective );
>
if( gTransport [ veh ][ trFuel ] < 1.0 ) SendClientMessage ( playerid , - 1 , " [Информация] В вашем автомобиле нет бензина!" );
SetVehicleParamsEx ( veh , false , lights , alarm , doors , bonnet , boot , objective );
>
if( gTransport [ veh ][ trHealth ] <= 350 ) SendClientMessage ( playerid , - 1 , " [Информация] Двигатель заглох! Вызовите механика /call (611)" );
SetVehicleParamsEx ( veh , false , lights , alarm , doors , bonnet , boot , objective );
>
>
>
else if( newkeys & 4 ) < // ALT
if( GetPlayerState ( playerid ) == PLAYER_STATE_DRIVER ) new engine , lights , alarm , doors , bonnet , boot , objective ;
new veh = GetPlayerVehicleID ( playerid );
GetVehicleParamsEx ( veh , engine , lights , alarm , doors , bonnet , boot , objective );
if( lights == 0 ) SetVehicleParamsEx ( veh , engine , true , alarm , doors , bonnet , boot , objective );
>
else SetVehicleParamsEx ( veh , engine , false , alarm , doors , bonnet , boot , objective );
>
>
>
forward TransportUpdate ( playerid );
public TransportUpdate ( playerid ) new veh = GetPlayerVehicleID ( playerid );
new str [ 256 ];
GetVehicleHealth ( veh , gTransport [ veh ][ trHealth ]);
format ( str , sizeof ( str ), "~w~SPEED: ~g~%d~w~KM/H" , SpeedVehicle ( playerid ));
TextDrawSetString ( speedvehicle [ playerid ], str );
format ( str , sizeof ( str ), "~w~FUEL: ~b~%d~w~L" , floatround ( gTransport [ veh ][ trFuel ]));
TextDrawSetString ( fuelvehicle [ playerid ], str );
format ( str , sizeof ( str ), "~w~MILLAGE: ~y~%.1f~w~KM" , gTransport [ veh ][ trMillage ]);
TextDrawSetString ( millagevehicle [ playerid ], str );
format ( str , sizeof ( str ), "~w~HEALTH: ~p~%.0f~w~" , gTransport [ veh ][ trHealth ]/ 10 );
TextDrawSetString ( healthvehicle [ playerid ], str );
new engine , lights , alarm , doors , bonnet , boot , objective ;
GetVehicleParamsEx ( veh , engine , lights , alarm , doors , bonnet , boot , objective );
if( engine == 0 ) TextDrawSetString ( statusengine [ playerid ], "~r~ENGINE" );
else TextDrawSetString ( statusengine [ playerid ], "~g~ENGINE" );
if( lights == 0 ) TextDrawSetString ( statuslamp [ playerid ], "~r~LAMP" );
else TextDrawSetString ( statuslamp [ playerid ], "~g~LAMP" );
if( doors == 0 ) TextDrawSetString ( statuslock [ playerid ], "~r~LOCK" );
else TextDrawSetString ( statuslock [ playerid ], "~g~LOCK" );
if( GetPlayerDistanceFromPoint ( playerid , gTransport [ veh ][ trPosX ], gTransport [ veh ][ trPosY ], gTransport [ veh ][ trPosZ ]) > 70.3 ) gTransport [ veh ][ trMillage ] += 0.1 ;
gTransport [ veh ][ trFuel ] -= gTransport [ veh ][ trExpense ];
GetPlayerPos ( playerid , gTransport [ veh ][ trPosX ], gTransport [ veh ][ trPosY ], gTransport [ veh ][ trPosZ ]);
>
if( gTransport [ veh ][ trFuel ] < 1.0 ) SetVehicleParamsEx ( veh , false , lights , alarm , doors , bonnet , boot , objective );
>
if( gTransport [ veh ][ trHealth ] <= 350 ) SetVehicleParamsEx ( veh , false , lights , alarm , doors , bonnet , boot , objective );
>
/*
new Text:speedusebox[MAX_PLAYERS];
new Text:namevehicle[MAX_PLAYERS];
new Text:fuelvehicle[MAX_PLAYERS];
new Text:speedvehicle[MAX_PLAYERS];
new Text:millagevehicle[MAX_PLAYERS];
new Text:healthvehicle[MAX_PLAYERS];
new Text:statusengine[MAX_PLAYERS];
new Text:statuslock[MAX_PLAYERS];
new Text:statuslamp[MAX_PLAYERS];
*/
return 1 ;
>
Федя Хромов
Рузаль, на фига вы беретесь за мейкинг сервера, если ничего не умеете?
Рузаль Галиуллин ответил Феде
Рузаль Галиуллин ответил Феде
Рузаль Галиуллин ответил Феде
Федя Хромов ответил DELETED
Саша Сагаз
Владимир Бобичев
Илья, уже 4 неделю жду
Ахмат Хасанов
Артём, пруфов у него нет , он сказал почистил диалог , там длинная история , но пруфов вообще нет и нам пришлось написать в поддержку что бы восстановили диалоги , так как до того как мы приобрели сообщество , заместитель Ильи( бывшего руководителя ) - Дима , обманул людей на круглую сумму , пока владелец Илья отсутствовал , он пришёл и все это увидел , уволил Диму , уволил весь состав, так как потом группа попала в чс PawnoInfo и продал сообщество уже нам, мы выдаём деньги и призы, но уже было 2 случая по попытке обмана нас,мол мы должны деньги и тд.. по этому уже обратились в поддержку вк.
speed_PTD[playerid][0] = CreatePlayerTextDraw(playerid, 461.7788, 368.5338, "LD_SPAC:white"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][0], 158.0000, 64.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][0], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][0], 303174911);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][0], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][0], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][0], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][0], 0);
speed_PTD[playerid][1] = CreatePlayerTextDraw(playerid, 456.6672, 366.4331, "LD_BEAT:chit"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][1], 60.0000, 60.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][1], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][1], 10196479);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][1], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][1], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][1], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][1], 0);
speed_PTD[playerid][2] = CreatePlayerTextDraw(playerid, 459.2882, 362.5502, "LD_BEAT:chit"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][2], 14.0000, 14.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][2], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][2], 10196479);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][2], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][2], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][2], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][2], 0);
speed_PTD[playerid][3] = CreatePlayerTextDraw(playerid, 466.4642, 364.8002, "LD_SPAC:white"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][3], 148.0000, 9.2398);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][3], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][3], 10196479);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][3], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][3], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][3], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][3], 0);
speed_PTD[playerid][4] = CreatePlayerTextDraw(playerid, 608.0407, 362.5169, "LD_BEAT:chit"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][4], 14.0000, 14.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][4], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][4], 10196479);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][4], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][4], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][4], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][4], 0);
speed_PTD[playerid][5] = CreatePlayerTextDraw(playerid, 426.9602, 417.9670, "LD_BEAT:chit"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][5], 227.6107, 4.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][5], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][5], 10196479);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][5], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][5], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][5], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][5], 0);
speed_PTD[playerid][6] = CreatePlayerTextDraw(playerid, 541.2100, 364.2333, "car_information"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][6], 0.2599, 1.0398);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][6], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][6], -1);
PlayerTextDrawSetOutline(playerid, speed_PTD[playerid][6], 1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][6], 10196479);
PlayerTextDrawFont(playerid, speed_PTD[playerid][6], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][6], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][6], 0);
speed_PTD[playerid][7] = CreatePlayerTextDraw(playerid, 461.7785, 432.1173, "LD_SPAC:white"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][7], 158.0000, 2.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][7], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][7], 10196479);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][7], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][7], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][7], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][7], 0);
speed_PTD[playerid][8] = CreatePlayerTextDraw(playerid, 488.6174, 420.7666, "ENGINE"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][8], 0.2407, 1.0398);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][8], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][8], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][8], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][8], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][8], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][8], 0);
speed_PTD[playerid][9] = CreatePlayerTextDraw(playerid, 544.4108, 420.7666, "LOCK"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][9], 0.2407, 1.0398);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][9], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][9], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][9], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][9], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][9], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][9], 0);
speed_PTD[playerid][10] = CreatePlayerTextDraw(playerid, 596.4982, 420.7666, "LIGHT"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][10], 0.2407, 1.0398);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][10], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][10], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][10], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][10], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][10], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][10], 0);
speed_PTD[playerid][11] = CreatePlayerTextDraw(playerid, 585.9998, 381.9165, "LD_SPAC:white"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][11], 2.8800, 28.2597);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][11], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][11], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][11], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][11], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][11], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][11], 0);
speed_PTD[playerid][12] = CreatePlayerTextDraw(playerid, 597.0285, 381.7164, "LD_SPAC:white"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][12], 2.0000, 28.4797);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][12], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][12], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][12], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][12], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][12], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][12], 0);
speed_PTD[playerid][13] = CreatePlayerTextDraw(playerid, 578.4755, 394.7998, "LD_SPAC:white"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][13], 27.0000, 2.9100);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][13], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][13], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][13], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][13], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][13], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][13], 0);
speed_PTD[playerid][14] = CreatePlayerTextDraw(playerid, 587.8441, 372.9331, "1"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][14], 0.2407, 1.0398);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][14], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][14], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][14], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][14], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][14], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][14], 0);
speed_PTD[playerid][15] = CreatePlayerTextDraw(playerid, 598.4415, 372.9331, "2"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][15], 0.2407, 1.0398);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][15], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][15], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][15], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][15], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][15], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][15], 0);
speed_PTD[playerid][16] = CreatePlayerTextDraw(playerid, 587.5283, 408.9331, "3"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][16], 0.2407, 1.0398);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][16], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][16], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][16], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][16], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][16], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][16], 0);
speed_PTD[playerid][17] = CreatePlayerTextDraw(playerid, 598.4729, 409.3499, "4"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][17], 0.2407, 1.0398);
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][17], 0.0197, 0.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][17], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][17], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][17], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][17], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][17], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][17], 0);
speed_PTD[playerid][18] = CreatePlayerTextDraw(playerid, 608.8176, 390.4497, "5"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][18], 0.2407, 1.0398);
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][18], 0.0197, -5.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][18], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][18], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][18], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][18], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][18], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][18], 0);
speed_PTD[playerid][19] = CreatePlayerTextDraw(playerid, 574.4802, 390.7662, "N"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][19], 0.2407, 1.0398);
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][19], 0.0197, -5.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][19], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][19], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][19], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][19], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][19], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][19], 0);
speed_PTD[playerid][20] = CreatePlayerTextDraw(playerid, 526.8541, 390.6665, "fuel:"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][20], 0.2152, 1.2632);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][20], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][20], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][20], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][20], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][20], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][20], 0);
speed_PTD[playerid][21] = CreatePlayerTextDraw(playerid, 460.4305, 370.5668, "LD_BEAT:chit"); // пусто
PlayerTextDrawTextSize(playerid, speed_PTD[playerid][21], 53.0000, 57.0000);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][21], 1);
PlayerTextDrawColor(playerid, speed_PTD[playerid][21], 303174399);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][21], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][21], 4);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][21], 0);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][21], 0);
speed_PTD[playerid][22] = CreatePlayerTextDraw(playerid, 487.8273, 388.0166, "999"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][22], 0.3939, 1.6799);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][22], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][22], -1);
PlayerTextDrawSetOutline(playerid, speed_PTD[playerid][22], 1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][22], 303174399);
PlayerTextDrawFont(playerid, speed_PTD[playerid][22], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][22], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][22], 0);
speed_PTD[playerid][23] = CreatePlayerTextDraw(playerid, 533.1212, 400.2838, "health:"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][23], 0.2152, 1.2632);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][23], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][23], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][23], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][23], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][23], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][23], 0);
speed_PTD[playerid][24] = CreatePlayerTextDraw(playerid, 487.4476, 400.5833, "00000"); // пусто
PlayerTextDrawLetterSize(playerid, speed_PTD[playerid][24], 0.1808, 1.0733);
PlayerTextDrawAlignment(playerid, speed_PTD[playerid][24], 2);
PlayerTextDrawColor(playerid, speed_PTD[playerid][24], -1);
PlayerTextDrawBackgroundColor(playerid, speed_PTD[playerid][24], 255);
PlayerTextDrawFont(playerid, speed_PTD[playerid][24], 2);
PlayerTextDrawSetProportional(playerid, speed_PTD[playerid][24], 1);
PlayerTextDrawSetShadow(playerid, speed_PTD[playerid][24], 0);
Создание спидометра с 0 [Урок 2] Оценка:
Ukrainian
Всем привет. В этом финальном уроке мы сделаем настоящий спидометр в не просто картинку =)
Итак. Идём в папку Ipleomax и заходим в папку scriptfiles. Открываем наш спидометр
Видем new-ы и наши отдельные текстдравы.
Давайте присвоим эти текстдравы для игрока а не для сервера.
К new-вам дописываем [MAX_PLAYERS].
Пример
Теперь идём к текст дравам там дописываем [playerid]
Пример
И так со всеми.
Далеее идём в наш мод.
Ко всем new мы дописываем new-вы из Ipleomax
Теперь давайте загрузим наши текстдравы
В конец мода
Ко всем new добавим необходимые new-вы
Теперь в OnGameModeInit
Мы добавили ManualVehicleEngineAndLights. Что же это?
Это стандартная ф-ция. без нее фары будут автоматично вкл/выкл в зависимости от того где машина в тёмном или светлом месте. А двигатель когда игрок садится в машину будет выключен. Без нее при посадке в машину двигатель будет включон даже если на спидометре он выкл.
В конец мода
Теперь создадим stock-ы которые будут менять значения на спидометре.
Этим сток можно открывать закрывать машину(просто вставив (Un)LockCar(carid) в нужно место)
Теперь нам нужно както узнать скорость автомобиля
Для этого в конце мода создаем stock
Создадим паблик в конце мода котрый будет обновлять спидометр
Теперь нужно зделать чтоб спидометр показывался только когда игрок зайдёт в машину и если выйдет то закрывался
Для этого идём в паблик OnPlayerStateChange
И пишем
Ко всем new добавим названия машин
Теперь установим кнопки для того чтобы включить или выключить двигатель или ограничитель скорости
В паблик OnPlayerKeyStateChange
mxINI
Читайте также: