Sign in to follow this  
Followers 0
DEST

Вид от руля (в машине)

12 posts in this topic

Внимание! Реализация системы морально устарела и требует современной доработки. 

В начало мода: 
 

Спойлер

enum CameraObjects
{
	camobj
};
new Player[MAX_PLAYERS][CameraObjects];

enum DashBoardEnum
{
	modelid,
	Float:cam_x,
	Float:cam_y,
	Float:cam_z
};

new DashBoards[][DashBoardEnum] =
{
	{ 410, -0.30, -0.25, 0.48 }, // Manana
	{ 404, -0.35, -0.10, 0.53 }, // Perreniel
	{ 405, -0.35, -0.10, 0.47 }, // Perreniel
	{ 409, -0.35, -0.10, 0.50 }, // Perreniel
	{ 575, -0.35, -0.15, 0.68 }, // Broadway
	{ 466, -0.38, -0.15, 0.68 }, // 535 áåõà
	{ 551, -0.30, -0.07, 0.95 }, // Âîëãà 105
	{ 401, -0.40, -0.00, 0.32 }, // Bravura
	{ 478, -0.40, -0.00, 0.32 }, // Êàáëóê
	{ 419, -0.40, -0.25, 0.40 }, // Esperanto
	{ 474, -0.47, -0.30, 0.52 }, // Hermes
	{ 518, -0.53, -0.22, 0.43 }, // Buccaneer
	{ 516, -0.47, -0.15, 0.55 }, // Nebula
	{ 491, -0.40, -0.25, 0.44 }, // Virgo
	{ 566, -0.45, -0.03, 0.55 }, // Tahoma
	{ 535, -0.35, -0.15, 0.62 }, // Slamvan
	{ 467, -0.45, -0.23, 0.40 }, // Oceanic
	{ 492, -0.45, -0.20, 0.37 }, // Greenwood
	{ 426, -0.45, -0.12, 0.54 }, // Premier
	{ 427, -0.45, 0.63, 0.55 }, // Ãàçåëü
	{ 428, -0.45, 1.27, 0.73 }, // Ãàçåëü2
	{ 505, -0.45, -0.35, 0.68 }, // Rancher
	{ 546, -0.45, -0.12, 0.56 }, // Ìîñêâè÷
	{ 547, -0.45, -0.12, 0.43 }, // Ìîñêâè÷2
	{ 549, -0.45, -0.09, 0.43 }, // Çàïîð
	{ 555, -0.45, -0.09, 0.43 }, // Çàïîð2
	{ 533, -0.45, -0.33, 0.56 }, // Feltzer
	{ 496, -0.45, -0.37, 0.51 }, // Blista
	{ 542, -0.45, -0.30, 0.61 }, // Íèâà
	{ 589, -0.45, -0.31, 0.73 }, // Club
	{ 565, -0.45, -0.25, 0.42 }, // Flash
	{ 587, -0.45, -0.38, 0.44 }, // Euros
	{ 412, -0.45, -0.19, 0.52 }, // Voodoo
	{ 420, -0.45, -0.16, 0.52 }, // ÂÎëãà Ñòàðàÿ
	{ 596, -0.45, -0.06, 0.52 }, // ÂÎëãà Ñòàðàÿ (Ïîëèöèÿ)
	{ 597, -0.45, -0.06, 0.52 }, // 99 (Ïîëèöèÿ)
	{ 507, -0.45, -0.04, 0.52 }, // ÂÎëãà3
	{ 540, -0.45, -0.04, 0.52 }, // ÂÎëãà Íîâåå
	{ 439, -0.45, -0.20, 0.45 }, // Stallion
	{ 534, -0.50, -0.2, 0.42 }, // Remington
	{ 602, -0.45, -0.25, 0.40 }, // Alpha
	{ 536, -0.45, -0.25, 0.42 }, // Blade
	{ 475, -0.45, 0.06, 0.70 }, // Sabre
	{ 436, -0.34, -0.12, 0.52 }, // Previon
	{ 438, -0.34, -0.10, 0.52 }, // Âîëãà Òàêñè
	{ 445, -0.34, -0.07, 0.52 }, // Âîëãà
	{ 479, -0.34, -0.07, 0.52 }, // Âîëãà 2
	{ 485, -0.34, -0.07, 0.52 }, // Âîëãà 2
	{ 489, -0.34, -0.03, 0.52 }, // Øèâðîëå-Íèâà
	{ 599, -0.34, -0.03, 0.52 }, // ÓÀÇ - Ïîëèöèÿ
	{ 500, -0.34, -0.03, 0.52 }, // Äæèïèê
	{ 585, -0.45, -0.26, 0.66 }, // Emperor
	{ 600, -0.45, -0.18, 0.51 }, // Picador
	{ 421, -0.38, -0.07, 0.45 }, // Washington
	{ 580, -0.45, -0.26, 0.69 }, // Stafford
	{ 458, -0.45, -0.10, 0.60 }, // Solair
	{ 561, -0.37, -0.08, 0.43 }, // Stratum
	{ 517, -0.45, -0.26, 0.54 }, // Majestic
	{ 526, -0.40, -0.25, 0.37 }, // Fortune
	{ 576, -0.35, -0.30, 0.58 }, // Tornado
	{ 579, -0.45, -0.33, 0.85 }, // Huntley
	{ 558, -0.37, -0.34, 0.59 }, // Uranus
	{ 603, -0.47, -0.44, 0.35 }, // Phoenix
	{ 560, -0.37, -0.20, 0.58 }, // Sultan
	{ 559, -0.40, -0.40, 0.50 }, // Jester
	{ 598, -0.40, -0.20, 0.50 }, // Ñåëèêà
	{ 400, -0.40, -0.25, 0.50 }, // õ5
	{ 506, -0.39, -0.43, 0.37 }, // Super GT
	{ 562, -0.36, -0.34, 0.53 }, // Elegy
	{ 477, -0.40, -0.35, 0.47 }, // ZR-350
	{ 402, -0.44, -0.27, 0.50 }, // Îïåëü
	{ 415, -0.36, -0.32, 0.32 }, // Cheetah
	{ 451, -0.36, -0.32, 0.32 }, // Turismo
	{ 541, -0.36, -0.20, 0.40 }, // Bullet
	{ 429, -0.40, 0.01, 0.45 }, // Banshee
	{ 411, -0.39, -0.21, 0.40 }
};

 

К командам: 
 

Спойлер

	CMD:on(playerid)
	{
		new Float:x, Float:y, Float:z, vehicleid = GetPlayerVehicleID(playerid), vehmodel = GetVehicleModel(vehicleid), bool:found;
		for( new i;i<sizeof(DashBoards);i++ )
		{
			if( vehmodel == DashBoards[i][modelid] )
			{
				x = DashBoards[i][cam_x];
				y = DashBoards[i][cam_y];
				z = DashBoards[i][cam_z];
				found = true;
				break;
			}
		}
		if( found )
		{
			Player[playerid][camobj] = CreateObject(19254,x,y,z,0.0,0.0,0.0,200.0);
			AttachObjectToVehicle( Player[playerid][camobj], vehicleid, x,y,z, 0, 0, 0);
			AttachCameraToObject(playerid, Player[playerid][camobj]);
			SendClientMessage(playerid, COLOR_YELLOW, "Вы включили вид от руля.");
		}
		return true;
	}
	CMD:off(playerid)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "Вы выключили вид от руля.");
		SetCameraBehindPlayer( playerid );
		DestroyObject( Player[playerid][camobj] );
		return true;
	}

 

Автор: было найдено при археологических раскопках мода GreenTech. 

Share this post


Link to post
Share on other sites

@DEST

Спойлер

C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(3350) : warning 219: local variable "modelid" shadows a variable at a preceding level
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(3352) : warning 213: tag mismatch
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(3350) : warning 203: symbol is never used: "modelid"
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(3363) : warning 219: local variable "modelid" shadows a variable at a preceding level
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(3365) : warning 213: tag mismatch
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(3363) : warning 203: symbol is never used: "modelid"
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(3376) : warning 219: local variable "modelid" shadows a variable at a preceding level
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(3378) : warning 213: tag mismatch
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(3376) : warning 203: symbol is never used: "modelid"
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(4143) : warning 219: local variable "modelid" shadows a variable at a preceding level
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(4146) : warning 213: tag mismatch
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(4148) : warning 213: tag mismatch
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(29195) : warning 219: local variable "modelid" shadows a variable at a preceding level
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(41842) : warning 202: number of arguments does not match definition
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(44292) : warning 219: local variable "modelid" shadows a variable at a preceding level
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(44292) : warning 203: symbol is never used: "modelid"
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(46480) : warning 213: tag mismatch
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(46483) : warning 213: tag mismatch
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(47072) : warning 219: local variable "modelid" shadows a variable at a preceding level
C:\Users\777\Desktop\Admin_Nikita\JRP\gamemodes\RRP.pwn(47911) : warning 219: local variable "modelid" shadows a variable at a preceding level

 

 

Share this post


Link to post
Share on other sites

enum DashBoardEnum замените на этот: 
 

enum DashBoardEnum
{
	modelidssss,
	Float:cam_x,
	Float:cam_y,
	Float:cam_z
};

и команду ON соответственно тоже: 

	CMD:on(playerid)
	{
		new Float:x, Float:y, Float:z, vehicleid = GetPlayerVehicleID(playerid), vehmodel = GetVehicleModel(vehicleid), bool:found;
		for( new i;i<sizeof(DashBoards);i++ )
		{
			if( vehmodel == DashBoards[i][modelidssss] )
			{
				x = DashBoards[i][cam_x];
				y = DashBoards[i][cam_y];
				z = DashBoards[i][cam_z];
				found = true;
				break;
			}
		}
		if( found )
		{
			Player[playerid][camobj] = CreateObject(19254,x,y,z,0.0,0.0,0.0,200.0);
			AttachObjectToVehicle( Player[playerid][camobj], vehicleid, x,y,z, 0, 0, 0);
			AttachCameraToObject(playerid, Player[playerid][camobj]);
			SendClientMessage(playerid, COLOR_YELLOW, "Вы включили вид от руля.");
		}
		return true;
	}

 

Share this post


Link to post
Share on other sites

@DEST Дест А вот если у меня стоят модификации то как быть?

 

Share this post


Link to post
Share on other sites

@Nekit_Krut18 координаты для вида от первого лица можно корректировать. Вычисляйте их и заменяйте в массиве DashBoards.

Share this post


Link to post
Share on other sites

@DEST Хорошо!

@Nekit_Krut18 А как измерить?

 

@Nekit_Krut18 Вычеслить*

Share this post


Link to post
Share on other sites
В 05.11.2017 в 16:58, DEST сказал:

enum DashBoardEnum замените на этот: 
 


enum DashBoardEnum
{
	modelidssss,
	Float:cam_x,
	Float:cam_y,
	Float:cam_z
};

и команду ON соответственно тоже: 


	CMD:on(playerid)
	{
		new Float:x, Float:y, Float:z, vehicleid = GetPlayerVehicleID(playerid), vehmodel = GetVehicleModel(vehicleid), bool:found;
		for( new i;i<sizeof(DashBoards);i++ )
		{
			if( vehmodel == DashBoards[i][modelidssss] )
			{
				x = DashBoards[i][cam_x];
				y = DashBoards[i][cam_y];
				z = DashBoards[i][cam_z];
				found = true;
				break;
			}
		}
		if( found )
		{
			Player[playerid][camobj] = CreateObject(19254,x,y,z,0.0,0.0,0.0,200.0);
			AttachObjectToVehicle( Player[playerid][camobj], vehicleid, x,y,z, 0, 0, 0);
			AttachCameraToObject(playerid, Player[playerid][camobj]);
			SendClientMessage(playerid, COLOR_YELLOW, "Вы включили вид от руля.");
		}
		return true;
	}

 

Не работает

Share this post


Link to post
Share on other sites
1 минуту назад, DEST сказал:

@MaJoR чего не работает? 

Ну я сделал все нормально без ошибок, но ввожу /on пишет текст а камера не включается от руля не в машине не пешком

Share this post


Link to post
Share on other sites

@MaJoR в какой машине пробуешь? 

Share this post


Link to post
Share on other sites
12 часов назад, DEST сказал:

@MaJoR в какой машине пробуешь? 

Пробовал в 402, 579, 400, и 502

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • Chopick
      By Chopick
      Всем здравствуйте! Делаю систему домов/бизнесов по туториалу knox know с плагином GoodArea. Есть проблема, если заходишь в интерьер бизнеса, то когда выходишь спавнит почему-то на пикап дома.

      Вот енумы:
       
      #define MAX_HOUSES 1000 #define MAX_BIZS 1000 enum house {         hID,         STREAMER_TAG_PICKUP:hPICKUP,         STREAMER_TAG_AREA:hAREA,         hOWNER[MAX_PLAYER_NAME],         STREAMER_TAG_3D_TEXT_LABEL:hTEXT[256],         STREAMER_TAG_MAP_ICON:hICON,         hPRICE,         hCLASS,         hINTERIOR,         Float:hX,         Float:hY,         Float:hZ,         Float:hA,         hCONDITION // Закрыт/Открыт } new House[MAX_HOUSES][house]; new Houses; new HouseGroup; enum biz {         bID,         STREAMER_TAG_PICKUP:bPICKUP,         STREAMER_TAG_AREA:bAREA,         bOWNER[MAX_PLAYER_NAME],         STREAMER_TAG_3D_TEXT_LABEL:bTEXT[256],         STREAMER_TAG_MAP_ICON:bICON,         bNAME[25],         bPRICE,         bTYPE,         bINTERIOR,         Float:bX,         Float:bY,         Float:bZ,         Float:bA } new Biz[MAX_BIZS][biz]; new Bizs; new BizGroup; enum interior_info {         intID,         intNAME[41],         intINTERIOR,         Float:intX,         Float:intY,         Float:intZ,         Float:intA,         STREAMER_TAG_AREA:intAREA } new Interior[MAX_INTERIORS][interior_info]; new Interiors; new InteriorGroup; Вот что у меня в OnGameModeInit:
      HouseGroup = CreateGroupGoodAreas(GoodArea:HouseEnter); InteriorGroup = CreateGroupGoodAreas(GoodArea:InteriorExit); BizGroup = CreateGroupGoodAreas(GoodArea:BizArea);  
      Вот стоки:
      GAResponse:HouseEnter(playerid, response, key, index) {         switch(response)         {             case GA_RESPONSE_PRESS_KEY:             {                 if(key & KEY_WALK)                 {                 if(House[index][hCONDITION] > 0 && House[index][hOWNER] == player_info[playerid][NAME] || House[index][hCONDITION] == 0)                 {                                         GoToInterior(playerid, House[index][hINTERIOR]);                                         SetPlayerVirtualWorld(playerid, index);                                 }                                 else if(House[index][hCONDITION] > 0 && House[index][hOWNER] != player_info[playerid][NAME]) return SCM(playerid, COLOR_RED, "[Ошибка]{ffffff}Этот дом закрыт на ключ!");                         }                 }                 case GA_RESPONSE_ENTER:                 {                     if(House[index][hOWNER] == 0)                     {                         CreateNoOwnerHouseTD(playerid);                         for(new i = 0; i < sizeof NoOwnerTextDraw_PTD[]; i++)                         {                             PlayerTextDrawShow(playerid, NoOwnerTextDraw_PTD[playerid][i]);                                 }                                 new price[8];                                 format(price, sizeof(price), "%d$", House[index][hPRICE]);                                 PlayerTextDrawSetString(playerid, NoOwnerTextDraw_PTD[playerid][2], price);                                 new id[9];                                 format(id, sizeof(id), "%d", House[index][hID]);                                 PlayerTextDrawSetString(playerid, NoOwnerTextDraw_PTD[playerid][0], id);                                 switch(House[index][hCLASS])                                 {                                     case 1: PlayerTextDrawSetString(playerid, NoOwnerTextDraw_PTD[playerid][1], "A");                                     case 2: PlayerTextDrawSetString(playerid, NoOwnerTextDraw_PTD[playerid][1], "B");                                     case 3: PlayerTextDrawSetString(playerid, NoOwnerTextDraw_PTD[playerid][1], "C");                                 }                                 for(new i = 0; i < sizeof NoOwnerTextDraw_TD; i++)                         {                             TextDrawShowForPlayer(playerid, NoOwnerTextDraw_TD[i]);                                 }                         }                 }                 case GA_RESPONSE_LEAVE:                 {                 for(new i = 0; i < sizeof NoOwnerTextDraw_PTD[]; i++)                 {                     PlayerTextDrawHide(playerid, NoOwnerTextDraw_PTD[playerid][i]);                         }                         for(new i = 0; i < sizeof NoOwnerTextDraw_TD; i++)                 {                     TextDrawHideForPlayer(playerid, NoOwnerTextDraw_TD[i]);                         }                 }         }         return 1; } GAResponse:BizArea(playerid, response, key, index) {         switch(response)         {             case GA_RESPONSE_PRESS_KEY:             {                 if(key & KEY_WALK)                 {                     GoToInteriorBiz(playerid, Biz[index][bINTERIOR]);                                 SetPlayerVirtualWorld(playerid, index);                 }                 }         }         return 1; } GAResponse:InteriorExit(playerid, response, key, index) {         switch(response)         {             case GA_RESPONSE_PRESS_KEY:             {                 new world = GetPlayerVirtualWorld(playerid);                 if(key & KEY_WALK)                 {                     if(world < MAX_HOUSES)                     {                         SetPlayerInterior(playerid, 0);                             SetPlayerVirtualWorld(playerid, 0);                             SetPlayerPos(playerid, House[world][hX], House[world][hY], House[world][hZ]);                             SetPlayerFacingAngle(playerid, House[world][hA]);                                 }                                 else if(world < MAX_HOUSES + MAX_BIZS)                     {                         world -= MAX_HOUSES;                                         printf("%d index world", world);                         SetPlayerInterior(playerid, 0);                             SetPlayerVirtualWorld(playerid, 0);                             SetPlayerPos(playerid, Biz[world][bX], Biz[world][bY], Biz[world][bZ]);                             SetPlayerFacingAngle(playerid, Biz[world][bA]);                                 }                         }                         if(key & KEY_CTRL_BACK)                         {                             if(player_info[playerid][HOUSE] != House[world][hID]) return SCM(playerid, COLOR_RED, "[Ошибка]{ffffff}Вы не владелец данного дома!");                             new dialog[256];                                 format(dialog, sizeof(dialog),                                         "{ffd900}[1]{ffffff}Информация о доме\n\                                         {ffd900}[2]{ffffff}%s дом",                                 (House[world][hCONDITION] == 1) ? ("{00ff00}Открыть") : ("{ff0000}Закрыть"));                             SPD(playerid, DLG_HMENU, DIALOG_STYLE_LIST, "{ffd900}Меню дома", dialog, "Выбрать", "Закрыть");                             return 1;                         }                 }         }         return 1; } stock GoToInterior(playerid, interior) {     for(new i = 0; i < Interiors; i++)         {             if(Interior[i][intID] != interior) continue;             SetPlayerInterior(playerid, Interior[i][intINTERIOR]);             SetPlayerPos(playerid, Interior[i][intX], Interior[i][intY], Interior[i][intZ]);             SetPlayerFacingAngle(playerid, Interior[i][intA]);             SetPlayerCheckpoint(playerid, Interior[i][intX], Interior[i][intY], Interior[i][intZ], 1.0);             new str[128];             format(str, sizeof(str),                         "Нажмите \"ALT\" для выхода\n\                         Нажмите \"H\", чтобы открыть меню дома");             Create3DTextLabel(str, -1, Interior[i][intX], Interior[i][intY], Interior[i][intZ], 15.0, 0, 1);             return 1;         }         return 0; } stock GoToInteriorBiz(playerid, interior) {     for(new i = 0; i < Interiors; i++)         {             if(Interior[i][intID] != interior) continue;             SetPlayerInterior(playerid, Interior[i][intINTERIOR]);             SetPlayerPos(playerid, Interior[i][intX], Interior[i][intY], Interior[i][intZ]);             SetPlayerFacingAngle(playerid, Interior[i][intA]);             SetPlayerCheckpoint(playerid, Interior[i][intX], Interior[i][intY], Interior[i][intZ], 1.0);             new str[128];             format(str, sizeof(str),                         "Нажмите \"ALT\" для выхода");             Create3DTextLabel(str, -1, Interior[i][intX], Interior[i][intY], Interior[i][intZ], 15.0, 0, 1);             return 1;         }         return 0; }  
       
      Что мне делать, подскажите пожалуйста?
    • Jdjdjd
      By Jdjdjd
      Как сделать открытие закрытие ворот в Радмир рп на копии,и куд а нужно вставлять код?