• Страница 1 из 1
  • 1
Вид от 1-ого лица в кабине
Дмитрий Дата: Суббота, 19.05.2012, 11:59 | Сообщение # 1 | Сообщить о нерабочей теме


Аватар для Дмитрий


[admin]Готовое решение для того чтобы ездить в автомобиле, сидя в кабине, т.е от первого лица. Думаю многие видели всякие Cleo, сейчас в 0.3e версию добавили такую возможность. Использую filterscript. Начнем.
[/admin]
[moder]Ко всем #define[/moder]
Code
#define IGNORE_PASSENGERS  
#define INVALID_DATA -1.11   


[moder]Ко всем new[/moder]

Code
new dcObject[MAX_PLAYERS];
new Float: dCam_Xes[212] =
{
     0.330000/*400*/,0.500000/*401*/,0.540000/*402*/,0.430000/*403*/,0.460000/*404*/,0.430000/*405*/,
     1.379999/*406*/,0.600000/*407*/,0.439999/*408*/,0.460000/*409*/,0.419999/*410*/,0.490000/*411*/,
     0.460000/*412*/,0.490000/*413*/,0.439999/*414*/,0.419999/*415*/,0.419999/*416*/,0.439999/*417*/,
     0.519999/*418*/,0.409999/*419*/,0.519999/*420*/,0.449999/*421*/,0.409999/*422*/,0.579999/*423*/,
     0.389999/*424*/,INVALID_DATA/*425*/,0.519999/*426*/,0.379999/*427*/,0.649999/*428*/,0.490000/*429*/,
     0.400000/*430*/,0.709999/*431*/,0.379999/*432*/,0.490000/*433*/,0.259999/*434*/,INVALID_DATA/*435*/,
     0.400000/*436*/,0.209999/*437*/,0.460000/*438*/,0.490000/*439*/,0.500000/*440*/,0.059999/*441*/,
     0.490000/*442*/,0.389999/*443*/,0.540000/*444*/,0.479999/*445*/,0.689999/*446*/,0.419999/*447*/,
     INVALID_DATA/*448*/,0.460000/*449*/,INVALID_DATA/*450*/,0.529999/*451*/,0.500000/*452*/,0.409999/*453*/,
     -0.560000/*454*/,0.490000/*455*/,0.419999/*456*/,0.340000/*457*/,0.449999/*458*/,0.490000/*459*/,
     0.319999/*460*/,INVALID_DATA/*461*/,INVALID_DATA/*462*/,INVALID_DATA/*463*/,INVALID_DATA/*464*/,INVALID_DATA/*465*/,
     0.500000/*466*/,0.460000/*467*/,INVALID_DATA/*468*/,0.419999/*469*/,0.529999/*470*/,INVALID_DATA/*471*/,
     -0.200000/*472*/,INVALID_DATA/*473*/,0.490000/*474*/,0.419999/*475*/,INVALID_DATA/*476*/,0.550000/*477*/,
     0.439999/*478*/,0.490000/*479*/,0.409999/*480*/,-0.009999/*481*/,0.469999/*482*/,0.379999/*483*/,
     INVALID_DATA/*484*/,0.150000/*485*/,INVALID_DATA/*486*/,0.460000/*487*/,0.449999/*488*/,0.500000/*489*/,
     0.529999/*490*/,0.430000/*491*/,0.460000/*492*/,-0.670000/*493*/,0.479999/*494*/,0.490000/*495*/,
     0.479999/*496*/,0.460000/*497*/,0.730000/*498*/,0.449999/*499*/,0.449999/*500*/,INVALID_DATA/*501*/,
     0.419999/*502*/,0.409999/*503*/,0.460000/*504*/,0.500000/*505*/,0.469999/*506*/,0.540000/*507*/,
     0.540000/*508*/,INVALID_DATA/*509*/,INVALID_DATA/*510*/,0.419999/*511*/,INVALID_DATA/*512*/,INVALID_DATA/*513*/,
     0.449999/*514*/,0.560000/*515*/,0.469999/*516*/,0.509999/*517*/,0.509999/*518*/,0.349999/*519*/,
     INVALID_DATA/*520*/,INVALID_DATA/*521*/,INVALID_DATA/*522*/,INVALID_DATA/*523*/,0.490000/*524*/,0.509999/*525*/,
     0.469999/*526*/,0.409999/*527*/,0.500000/*528*/,0.490000/*529*/,INVALID_DATA/*530*/,INVALID_DATA/*531*/,
     1.009999/*532*/,0.479999/*533*/,0.589999/*534*/,0.419999/*535*/,0.519999/*536*/,0.460000/*537*/,
     0.709999/*538*/,INVALID_DATA/*539*/,0.519999/*540*/,0.479999/*541*/,0.509999/*542*/,0.449999/*543*/,
     0.600000/*544*/,0.330000/*545*/,0.569999/*546*/,0.519999/*547*/,0.649999/*548*/,0.469999/*549*/,
     0.519999/*550*/,0.490000/*551*/,0.620000/*552*/,0.430000/*553*/,0.540000/*554*/,0.439999/*555*/,
     0.540000/*556*/,0.540000/*557*/,0.540000/*558*/,0.479999/*559*/,0.479999/*560*/,0.519999/*561*/,
     0.509999/*562*/,0.419999/*563*/,0.059999/*564*/,0.479999/*565*/,0.540000/*566*/,0.509999/*567*/,
     INVALID_DATA/*568*/,INVALID_DATA/*569*/,INVALID_DATA/*570*/,INVALID_DATA/*571*/,INVALID_DATA/*572*/,0.560000/*573*/,
     0.230000/*574*/,0.500000/*575*/,0.469999/*576*/,1.289999/*577*/,0.469999/*578*/,0.460000/*579*/,
     0.540000/*580*/,INVALID_DATA/*581*/,0.419999/*582*/,INVALID_DATA/*583*/,INVALID_DATA/*584*/,0.469999/*585*/,
     INVALID_DATA/*586*/,0.519999/*587*/,0.699999/*588*/,0.419999/*589*/,INVALID_DATA/*590*/,INVALID_DATA/*591*/,
     0.560000/*592*/,0.319999/*593*/,0.059999/*594*/,0.479999/*595*/,0.519999/*596*/,0.519999/*597*/,
     0.519999/*598*/,0.500000/*599*/,0.519999/*600*/,0.529999/*601*/,0.479999/*602*/,0.519999/*603*/,
     0.500000/*604*/,0.449999/*605*/,INVALID_DATA/*606*/,INVALID_DATA/*607*/,INVALID_DATA/*608*/,0.730000/*609*/,
     INVALID_DATA/*610*/,INVALID_DATA/*611*/
};
new Float:dCam_Highs[212] =  
{
     0.460000/*400*/,0.500000/*401*/,0.449999/*402*/,1.029999/*403*/,0.610000/*404*/,0.430000/*405*/,
     INVALID_DATA/*406*/,0.779999/*407*/,0.589999/*408*/,0.500000/*409*/,0.569999/*410*/,0.409999/*411*/,
     0.419999/*412*/,0.709999/*413*/,0.899999/*414*/,0.340000/*415*/,0.800000/*416*/,INVALID_DATA/*417*/,
     0.569999/*418*/,INVALID_DATA/*419*/,0.529999/*420*/,0.389999/*421*/,0.479999/*422*/,0.769999/*423*/,
     INVALID_DATA/*424*/,INVALID_DATA/*425*/,0.529999/*426*/,0.930000/*427*/,0.769999/*428*/,0.400000/*429*/,
     INVALID_DATA/*430*/,1.330000/*431*/,INVALID_DATA/*432*/,1.240000/*433*/,0.409999/*434*/,INVALID_DATA/*435*/,
     0.540000/*436*/,INVALID_DATA/*437*/,0.439999/*438*/,0.400000/*439*/,0.569999/*440*/,INVALID_DATA/*441*/,
     0.469999/*442*/,1.029999/*443*/,1.340000/*444*/,0.509999/*445*/,INVALID_DATA/*446*/,INVALID_DATA/*447*/,
     INVALID_DATA/*448*/,INVALID_DATA/*449*/,INVALID_DATA/*450*/,0.340000/*451*/,INVALID_DATA/*452*/,INVALID_DATA/*453*/,
     INVALID_DATA/*454*/,1.220000/*455*/,0.889999/*456*/,0.550000/*457*/,0.419999/*458*/,0.709999/*459*/,
     INVALID_DATA/*460*/,INVALID_DATA/*461*/,INVALID_DATA/*462*/,INVALID_DATA/*463*/,INVALID_DATA/*464*/,INVALID_DATA/*465*/,
     0.529999/*466*/,0.519999/*467*/,INVALID_DATA/*468*/,INVALID_DATA/*469*/,0.720000/*470*/,INVALID_DATA/*471*/,
     INVALID_DATA/*472*/,INVALID_DATA/*473*/,0.560000/*474*/,0.439999/*475*/,INVALID_DATA/*476*/,0.460000/*477*/,
     0.529999/*478*/,0.629999/*479*/,0.430000/*480*/,INVALID_DATA/*481*/,0.540000/*482*/,0.509999/*483*/,
     INVALID_DATA/*484*/,INVALID_DATA/*485*/,INVALID_DATA/*486*/,INVALID_DATA/*487*/,INVALID_DATA/*488*/,0.750000/*489*/,
     0.750000/*490*/,0.439999/*491*/,0.550000/*492*/,INVALID_DATA/*493*/,0.449999/*494*/,0.620000/*495*/,
     0.529999/*496*/,INVALID_DATA/*497*/,1.049999/*498*/,0.629999/*499*/,0.589999/*500*/,INVALID_DATA/*501*/,
     0.449999/*502*/,0.479999/*503*/,INVALID_DATA/*504*/,0.750000/*505*/,0.370000/*506*/,0.500000/*507*/,
     0.409999/*508*/,INVALID_DATA/*509*/,INVALID_DATA/*510*/,INVALID_DATA/*511*/,INVALID_DATA/*512*/,INVALID_DATA/*513*/,
     0.910000/*514*/,0.819999/*515*/,0.540000/*516*/,0.519999/*517*/,0.449999/*518*/,INVALID_DATA/*519*/,
     INVALID_DATA/*520*/,INVALID_DATA/*521*/,INVALID_DATA/*522*/,INVALID_DATA/*523*/,0.500000/*524*/,1.029999/*525*/,
     0.389999/*526*/,0.579999/*527*/,0.670000/*528*/,0.620000/*529*/,INVALID_DATA/*530*/,INVALID_DATA/*531*/,
     INVALID_DATA/*532*/,0.500000/*533*/,0.370000/*534*/,0.569999/*535*/,0.349999/*536*/,INVALID_DATA/*537*/,
     INVALID_DATA/*538*/,INVALID_DATA/*539*/,0.389999/*540*/,0.400000/*541*/,0.519999/*542*/,0.569999/*543*/,
     0.870000/*544*/,0.479999/*545*/,0.509999/*546*/,0.589999/*547*/,INVALID_DATA/*548*/,0.490000/*549*/,
     0.400000/*550*/,0.519999/*551*/,1.000000/*552*/,INVALID_DATA/*553*/,0.689999/*554*/,0.379999/*555*/,
     1.309999/*556*/,1.320000/*557*/,0.569999/*558*/,0.469999/*559*/,0.540000/*560*/,0.490000/*561*/,
     0.519999/*562*/,INVALID_DATA/*563*/,INVALID_DATA/*564*/,0.430000/*565*/,0.550000/*566*/,0.379999/*567*/,
     0.449999/*568*/,INVALID_DATA/*569*/,INVALID_DATA/*570*/,INVALID_DATA/*571*/,INVALID_DATA/*572*/,0.829999/*573*/,
     0.759999/*574*/,0.709999/*575*/,0.589999/*576*/,INVALID_DATA/*577*/,0.680000/*578*/,0.800000/*579*/,
     0.720000/*580*/,INVALID_DATA/*581*/,0.720000/*582*/,1.090000/*583*/,INVALID_DATA/*584*/,0.680000/*585*/,
     INVALID_DATA/*586*/,0.449999/*587*/,1.159999/*588*/,0.750000/*589*/,INVALID_DATA/*590*/,INVALID_DATA/*591*/,
     INVALID_DATA/*592*/,INVALID_DATA/*593*/,INVALID_DATA/*594*/,INVALID_DATA/*595*/,0.529999/*596*/,0.529999/*597*/,
     0.540000/*598*/,0.750000/*599*/,0.500000/*600*/,INVALID_DATA/*601*/,0.409999/*602*/,0.349999/*603*/,
     0.529999/*604*/,0.569999/*605*/,INVALID_DATA/*606*/,INVALID_DATA/*607*/,INVALID_DATA/*608*/,1.049999/*609*/,
     INVALID_DATA/*610*/,INVALID_DATA/*611*/
};
new Float:dCam_Yes[212] =
{
     0.029999/*400*/,-0.059999/*401*/,-0.349999/*402*/,1.450000/*403*/,-0.129999/*404*/,INVALID_DATA/*405*/,2.559999/*406*/,
     2.890000/*407*/,2.730000/*408*/,1.059999/*409*/,-0.170000/*410*/,0.050000/*411*/,-0.129999/*412*/,0.779999/*413*/,
     0.959999/*414*/,INVALID_DATA/*415*/,0.949999/*416*/,3.269999/*417*/,0.460000/*418*/,-0.209999/*419*/,0.059999/*420*/,
     0.109999/*421*/,0.070000/*422*/,0.670000/*423*/,-0.090000/*424*/,2.549999/*425*/,0.059999/*426*/,1.100000/*427*/,0.649999/*428*/,
     -0.500000/*429*/,0.519999/*430*/,4.730000/*431*/,2.769999/*432*/,1.159999/*433*/,-0.449999/*434*/,INVALID_DATA/*435*/,-0.170000/*436*/,
     4.289999/*437*/,0.419999/*438*/,-0.540000/*439*/,0.750000/*440*/,-0.070000/*441*/,0.270000/*442*/,2.880000/*443*/,
     0.349999/*444*/,-0.029999/*445*/,0.250000/*446*/,0.949999/*447*/,-0.340000/*448*/,3.359999/*449*/,INVALID_DATA/*450*/,-0.200000/*451*/,
     2.980000/*452*/,1.570000/*453*/,2.730000/*454*/,1.169999/*455*/,1.389999/*456*/,-0.270000/*457*/,0.140000/*458*/,0.779999/*459*/,
     0.280000/*460*/,-0.400000/*461*/,-0.340000/*462*/,-0.409999/*463*/,INVALID_DATA/*464*/,INVALID_DATA/*465*/,0.150000/*466*/,
     0.109999/*467*/,-0.200000/*468*/,0.949999/*469*/,-0.039999/*470*/,-0.349999/*471*/,-0.159999/*472*/,0.579999/*473*/,-0.300000/*474*/,
     -0.129999/*475*/,-0.449999/*476*/,-0.250000/*477*/,0.090000/*478*/,-0.070000/*479*/,-0.280000/*480*/,-0.340000/*481*/,
     0.529999/*482*/,1.649999/*483*/,-5.010000/*484*/,-0.449999/*485*/,-0.389999/*486*/,1.620000/*487*/,0.730000/*488*/,
     -0.090000/*489*/,0.460000/*490*/,-0.280000/*491*/,0.140000/*492*/,0.600000/*493*/,-0.289999/*494*/,INVALID_DATA/*495*/,-0.250000/*496*/,
     1.620000/*497*/,1.379999/*498*/,0.209999/*499*/,-0.239999/*500*/,INVALID_DATA/*501*/,-0.119999/*502*/,-0.289999/*503*/,0.180000/*504*/,
     -0.090000/*505*/,-0.340000/*506*/,0.050000/*507*/,1.419999/*508*/,-0.479999/*509*/,-0.270000/*510*/,2.009999/*511*/,
     -0.219999/*512*/,-0.910000/*513*/,1.600000/*514*/,1.340000/*515*/,0.070000/*516*/,-0.019999/*517*/,0.070000/*518*/,
     5.179999/*519*/,2.839999/*520*/,-0.400000/*521*/,-0.400000/*522*/,-0.400000/*523*/,1.450000/*524*/,0.259999/*525*/,
     -0.079999/*526*/,-0.019999/*527*/,-0.140000/*528*/,-0.079999/*529*/,-0.319999/*530*/,-0.460000/*531*/,3.000000/*532*/,
     -0.239999/*533*/,0.029999/*534*/,0.009999/*535*/,-0.219999/*536*/,5.130000/*537*/,5.989999/*538*/,0.349999/*539*/,-0.059999/*540*/,
     -0.119999/*541*/,-0.150000/*542*/,0.090000/*543*/,2.509999/*544*/,-0.340000/*545*/,-0.159999/*546*/,INVALID_DATA/*547*/,4.570000/*548*/,
     0.250000/*549*/,0.050000/*550*/,0.109999/*551*/,0.639999/*552*/,9.529999/*553*/,0.100000/*554*/,-0.170000/*555*/,0.100000/*556*/,
     INVALID_DATA/*557*/,-0.239999/*558*/,-0.189999/*559*/,0.109999/*560*/,0.090000/*561*/,-0.050000/*562*/,2.640000/*563*/,
     -0.070000/*564*/,-0.059999/*565*/,0.090000/*566*/,0.250000/*567*/,-0.029999/*568*/,INVALID_DATA/*569*/,1.960000/*570*/,
     -0.180000/*571*/,-0.620000/*572*/,2.029999/*573*/,0.550000/*574*/,0.059999/*575*/,-0.159999/*576*/,21.059999/*577*/,3.430000/*578*/,
     -0.159999/*579*/,-0.009999/*580*/,-0.400000/*581*/,0.560000/*582*/,-1.009999/*583*/,INVALID_DATA/*584*/,INVALID_DATA/*585*/,-0.419999/*586*/,
     -0.239999/*587*/,2.289999/*588*/,-0.019999/*589*/,INVALID_DATA/*590*/,INVALID_DATA/*591*/,12.510000/*592*/,0.029999/*593*/,-0.070000/*594*/,
     0.899999/*595*/,0.059999/*596*/,0.059999/*597*/,0.059999/*598*/,-0.090000/*599*/,0.059999/*600*/,-0.300000/*601*/,-0.119999/*602*/,
     -0.419999/*603*/,0.150000/*604*/,0.090000/*605*/,INVALID_DATA/*606*/,INVALID_DATA/*607*/,INVALID_DATA/*608*/,1.379999/*609*/,
     INVALID_DATA/*610*/,INVALID_DATA/*611*/
};   


[moder]В public OnPlayerDisconnect(playerid, reason) добавляем:[/moder]

Code
if(IsValidPlayerObject(playerid,dcObject[playerid])==1) DestroyPlayerObject(playerid,dcObject[playerid]);  


[moder]В public OnPlayerStateChange вставляем:[/moder]

Code
 if(newstate == PLAYER_STATE_DRIVER)
     {
         if(IsValidPlayerObject(playerid,dcObject[playerid])==1) DestroyPlayerObject(playerid,dcObject[playerid]);
         new pv=GetPlayerVehicleID(playerid),slot=GetVehicleModel(pv)-400;
         if(dCam_Xes[slot] == INVALID_DATA || INVALID_DATA == dCam_Yes[slot] || INVALID_DATA == dCam_Highs[slot]) return 0;
         dcObject[playerid] = CreatePlayerObject(playerid,0,0.0,0.0,0.0,0.0,0.0,0.0);
         AttachPlayerObjectToVehicle(playerid,dcObject[playerid],pv,-dCam_Xes[slot],dCam_Yes[slot],dCam_Highs[slot],0.0,0.0,0.0);
         AttachCameraToPlayerObject(playerid,dcObject[playerid]);
     }
     else if(oldstate == PLAYER_STATE_DRIVER)
     {
         if(IsValidPlayerObject(playerid,dcObject[playerid])==1)DestroyPlayerObject(playerid,dcObject[playerid]);
         SetCameraBehindPlayer(playerid);
     }
     #if !defined INGORE_PASSENGERS
     if(newstate == PLAYER_STATE_PASSENGER&&GetPlayerVehicleSeat(playerid)==1)
     {
         if(IsValidPlayerObject(playerid,dcObject[playerid])==1) DestroyPlayerObject(playerid,dcObject[playerid]);
         new pv=GetPlayerVehicleID(playerid),slot=GetVehicleModel(pv)-400;
         if(dCam_Xes[slot] == INVALID_DATA || INVALID_DATA == dCam_Yes[slot] || INVALID_DATA == dCam_Highs[slot]) return 0;
         dcObject[playerid] = CreatePlayerObject(playerid,0,0.0,0.0,0.0,0.0,0.0,0.0);
         AttachPlayerObjectToVehicle(playerid,dcObject[playerid],pv,dCam_Xes[slot],dCam_Yes[slot],dCam_Highs[slot],0.0,0.0,0.0);
         AttachCameraToPlayerObject(playerid,dcObject[playerid]);
     }
     else if(oldstate == PLAYER_STATE_PASSENGER)
     {
         if(IsValidPlayerObject(playerid,dcObject[playerid])==1)DestroyPlayerObject(playerid,dcObject[playerid]);
         SetCameraBehindPlayer(playerid);
          
          
     }
     #endif   


[moder]На этом все комплируем ( F5 ) и идем тестировать.[/moder]

[admin]Примичания:[/admin]
[reklama]! - Работает только на 0.3e
! - В транспорте, у которого нет окон, будет все как обычно.[/reklama]


From Russia With Love!
  • Страница 1 из 1
  • 1
Поиск: