7.Zip
Дебютант
Автор:Plakapenka
[HR][/HR]
В начало мода:
В Gamemodeinit:
В OnPlayerConnect:
В OnPlayerStateChange:
В OnPlayerKeyStateChange
В конец мода:
По просьбе 'Егорчика'
[HR][/HR]
Для начала избавьтесь от старого спидометра :wink3:
В начало мода:
PHP:
/* ============= Спидометр RakNet, RiP by Plakapenka ==========*/
new bool:pOgran[MAX_PLAYERS];
new Text:spedometrBOX; //Белый, прозрачный бокс
new PlayerText:doorDraw[MAX_PLAYERS]; //Двери, большая полоска посередине
new PlayerText:SPEED_and_FUEL[MAX_PLAYERS]; //Текст скорости и бенза
new Text:ogran1; //Квадратики обозначающие включен ли ограничитель
new Text:ogran2; //Квадратики обозначающие включен ли ограничитель
new Text:ogran3; //Квадратики обозначающие включен ли ограничитель
new Text:ogran4; //Квадратики обозначающие включен ли ограничитель
new Text:Fari; //Фары, полоска снизу
new Text:Engine; //Движок, полоска сверху
new PlayerText:privcar[MAX_PLAYERS]; //Изображение модели ТС
new STimer[MAX_PLAYERS];
/*==============================================================*/
PHP:
/* ============= Ñïèäîìåòð RakNet, RiP by Plakapenka ==========*/
spedometrBOX = TextDrawCreate(594.000000, 355.000000, "_");
TextDrawBackgroundColor(spedometrBOX, 255);
TextDrawFont(spedometrBOX, 1);
TextDrawLetterSize(spedometrBOX, 0.539999, 6.599996);
TextDrawColor(spedometrBOX, -1);
TextDrawSetOutline(spedometrBOX, 0);
TextDrawSetProportional(spedometrBOX, 1);
TextDrawSetShadow(spedometrBOX, 1);
TextDrawUseBox(spedometrBOX, 1);
TextDrawBoxColor(spedometrBOX, -240);
TextDrawTextSize(spedometrBOX, 460.000000, 0.000000);
ogran1 = TextDrawCreate(514.000000, 404.000000, "_");//êâàäðàòèêè
TextDrawBackgroundColor(ogran1, 255);
TextDrawFont(ogran1, 1);
TextDrawLetterSize(ogran1, 0.500000, -1.500000);
TextDrawColor(ogran1, -1);
TextDrawSetOutline(ogran1, 0);
TextDrawSetProportional(ogran1, 1);
TextDrawSetShadow(ogran1, 1);
TextDrawUseBox(ogran1, 1);
TextDrawBoxColor(ogran1, -86);
TextDrawTextSize(ogran1, 515.000000, 0.000000);
ogran2 = TextDrawCreate(514.000000, 381.000000, "_");
TextDrawBackgroundColor(ogran2, 255);
TextDrawFont(ogran2, 1);
TextDrawLetterSize(ogran2, 0.500000, -1.500000);
TextDrawColor(ogran2, -1);
TextDrawSetOutline(ogran2, 0);
TextDrawSetProportional(ogran2, 1);
TextDrawSetShadow(ogran2, 1);
TextDrawUseBox(ogran2, 1);
TextDrawBoxColor(ogran2, -86);
TextDrawTextSize(ogran2, 515.000000, 0.000000);
ogran3 = TextDrawCreate(468.000000, 381.000000, "_");
TextDrawBackgroundColor(ogran3, 255);
TextDrawFont(ogran3, 1);
TextDrawLetterSize(ogran3, 0.500000, -1.500000);
TextDrawColor(ogran3, -1);
TextDrawSetOutline(ogran3, 0);
TextDrawSetProportional(ogran3, 1);
TextDrawSetShadow(ogran3, 1);
TextDrawUseBox(ogran3, 1);
TextDrawBoxColor(ogran3, -86);
TextDrawTextSize(ogran3, 469.000000, 0.000000);
ogran4 = TextDrawCreate(468.000000, 404.000000, "_");
TextDrawBackgroundColor(ogran4, 255);
TextDrawFont(ogran4, 1);
TextDrawLetterSize(ogran4, 0.500000, -1.500000);
TextDrawColor(ogran4, -1);
TextDrawSetOutline(ogran4, 0);
TextDrawSetProportional(ogran4, 1);
TextDrawSetShadow(ogran4, 1);
TextDrawUseBox(ogran4, 1);
TextDrawBoxColor(ogran4, -86);
TextDrawTextSize(ogran4, 469.000000, 0.000000);
Fari = TextDrawCreate(511.000000, 415.000000, "_");//íèç
TextDrawBackgroundColor(Fari, 255);
TextDrawFont(Fari, 1);
TextDrawLetterSize(Fari, 0.509999, -1.000000);
TextDrawColor(Fari, -1);
TextDrawSetOutline(Fari, 0);
TextDrawSetProportional(Fari, 1);
TextDrawSetShadow(Fari, 1);
TextDrawUseBox(Fari, 1);
TextDrawBoxColor(Fari, -86);
TextDrawTextSize(Fari, 473.000000, 0.000000);
Engine = TextDrawCreate(511.000000, 363.000000, "_");
TextDrawBackgroundColor(Engine, 255);
TextDrawFont(Engine, 1);
TextDrawLetterSize(Engine, 0.509999, -1.000000);
TextDrawColor(Engine, -1);
TextDrawSetOutline(Engine, 0);
TextDrawSetProportional(Engine, 1);
TextDrawSetShadow(Engine, 1);
TextDrawUseBox(Engine, 1);
TextDrawBoxColor(Engine, -86);
TextDrawTextSize(Engine, 473.000000, 0.000000);
/*==============================================================*/
В OnPlayerConnect:
PHP:
privcar[playerid] = CreatePlayerTextDraw(playerid, 478.000000, 360.000000, "_");
PlayerTextDrawFont(playerid, privcar[playerid], TEXT_DRAW_FONT_MODEL_PREVIEW);
PlayerTextDrawUseBox(playerid, privcar[playerid], 0);
PlayerTextDrawTextSize(playerid, privcar[playerid], 45.0, 40.0);
PlayerTextDrawSetPreviewModel(playerid, privcar[playerid], 411);
PlayerTextDrawSetPreviewRot(playerid, privcar[playerid], -10.0, 0.0, -20.0,0.8);
PlayerTextDrawBackgroundColor(playerid, privcar[playerid], 0xFFFFFF00);
doorDraw[playerid] = CreatePlayerTextDraw(playerid, 526.000000, 414.000000, "_");
PlayerTextDrawBackgroundColor(playerid, doorDraw[playerid], 255);
PlayerTextDrawFont(playerid, doorDraw[playerid], 1);
PlayerTextDrawLetterSize(playerid, doorDraw[playerid], 0.500000, -6.699995);
PlayerTextDrawColor(playerid, doorDraw[playerid], -1);
PlayerTextDrawSetOutline(playerid, doorDraw[playerid], 0);
PlayerTextDrawSetProportional(playerid, doorDraw[playerid], 1);
PlayerTextDrawSetShadow(playerid, doorDraw[playerid], 1);
PlayerTextDrawUseBox(playerid, doorDraw[playerid], 1);
PlayerTextDrawBoxColor(playerid, doorDraw[playerid], 1650811818);
PlayerTextDrawTextSize(playerid, doorDraw[playerid], 519.000000, 0.000000);
SPEED_and_FUEL[playerid] = CreatePlayerTextDraw(playerid, 533.000000, 361.000000, " Km/h~n~ 60~n~~n~ Fuel~n~59");
PlayerTextDrawBackgroundColor(playerid, SPEED_and_FUEL[playerid], 255);
PlayerTextDrawFont(playerid, SPEED_and_FUEL[playerid], 1);
PlayerTextDrawLetterSize(playerid, SPEED_and_FUEL[playerid], 0.500000, 1.000000);
PlayerTextDrawColor(playerid, SPEED_and_FUEL[playerid], -1);
PlayerTextDrawSetOutline(playerid, SPEED_and_FUEL[playerid], 0);
PlayerTextDrawSetProportional(playerid, SPEED_and_FUEL[playerid], 1);
PlayerTextDrawSetShadow(playerid, SPEED_and_FUEL[playerid], 1);
В OnPlayerStateChange:
PHP:
if(oldstate == 2 && newstate == 1)//вылазит
{
KillTimer(STimer[playerid]);
PlayerTextDrawHide(playerid,doorDraw[playerid]);
PlayerTextDrawHide(playerid,SPEED_and_FUEL[playerid]);
PlayerTextDrawHide(playerid,privcar[playerid]);
TextDrawHideForPlayer(playerid,ogran1);
TextDrawHideForPlayer(playerid,ogran2);
TextDrawHideForPlayer(playerid,ogran3);
TextDrawHideForPlayer(playerid,ogran4);
TextDrawHideForPlayer(playerid,Fari);
TextDrawHideForPlayer(playerid,Engine);
TextDrawHideForPlayer(playerid,spedometrBOX);
}
else if(oldstate == 1 && newstate == 2)//Залазит
{
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
STimer[playerid] = SetTimerEx("UpdateSpeedometr", 150, true, "i", playerid);
PlayerTextDrawShow (playerid, doorDraw[playerid]);
PlayerTextDrawShow (playerid, SPEED_and_FUEL[playerid]);
PlayerTextDrawSetPreviewModel (playerid, privcar[playerid], GetVehicleModel(car));
PlayerTextDrawShow (playerid, privcar[playerid]);
if(doors)PlayerTextDrawBoxColor (playerid, doorDraw[playerid], 0xFFFFFFAA);
else PlayerTextDrawBoxColor (playerid, doorDraw[playerid], -240);
if(engine)TextDrawShowForPlayer (playerid,Engine);
if(lights)TextDrawShowForPlayer (playerid,Fari);
pOgran[playerid] = true;
TextDrawShowForPlayer (playerid, ogran1);
TextDrawShowForPlayer (playerid, ogran2);
TextDrawShowForPlayer (playerid, ogran3);
TextDrawShowForPlayer (playerid, ogran4);
TextDrawShowForPlayer (playerid, Fari);
TextDrawShowForPlayer (playerid, Engine);
TextDrawShowForPlayer (playerid, spedometrBOX);
}
PHP:
if(IsPlayerInAnyVehicle(playerid))
{
if(newkeys == KEY_ANALOG_LEFT)//дверь
{
new
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(doors){
PlayerTextDrawBoxColor(playerid, doorDraw[playerid], -240);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
}
else{
PlayerTextDrawBoxColor(playerid, doorDraw[playerid], 0xFFFFFFAA);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
}
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
PlayerTextDrawShow(playerid,doorDraw[playerid]);
}
else if(newkeys == KEY_ANALOG_UP)//движок
{
new
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine){
TextDrawHideForPlayer(playerid,Engine);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
}
else{
TextDrawShowForPlayer(playerid,Engine);
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
}
else if(newkeys == KEY_ANALOG_DOWN)//фары
{
new
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
PlayerPlaySound(playerid, 17803, 0.0, 0.0, 0.0);
if(lights){
TextDrawHideForPlayer(playerid,Fari);
SetVehicleParamsEx(vehicleid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
}
else{
TextDrawShowForPlayer(playerid,Fari);
SetVehicleParamsEx(vehicleid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
}
}
else if(newkeys == KEY_ANALOG_RIGHT)//огранка
{
if(pOgran[playerid]){
pOgran[playerid] = false;
TextDrawHideForPlayer(playerid,ogran1);
TextDrawHideForPlayer(playerid,ogran2);
TextDrawHideForPlayer(playerid,ogran3);
TextDrawHideForPlayer(playerid,ogran4);
}
else{
pOgran[playerid] = true;
TextDrawShowForPlayer(playerid,ogran1);
TextDrawShowForPlayer(playerid,ogran2);
TextDrawShowForPlayer(playerid,ogran3);
TextDrawShowForPlayer(playerid,ogran4);
}
}
}
PHP:
forward UpdateSpeedometr(playerid);
public UpdateSpeedometr(playerid)//Обновляется 5 раз в секунду если чувак в тачке
{
new
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(vehicleid,ST[0],ST[1],ST[2]);
speed = floatround( floatsqroot( floatpower(ST[0]*100.0,2)+floatpower(ST[1]*100.0,2)+floatpower(ST[2]*100.0,2) ) );
format(str1, 34," Km/h~n~ %d~n~~n~ Fuel~n~%.0f", speed, Fuell[vehicleid]);//замените переменную бензина на свою
PlayerTextDrawSetString(playerid, SPEED_and_FUEL[playerid],str1);
if(pOgran[playerid]){
if((ST[0] > 0.5 || ST[0] < -0.5) || (ST[1] > 0.5 || ST[1] < -0.5))SetVehicleVelocity(vehicleid,ST[0]*0.8,ST[1]*0.8,ST[2]);}
}
Последнее редактирование:
