Advertisement
Guest User

Bus Map (pawn)

a guest
Dec 31st, 2012
1,669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.15 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. //Позиция центра карты
  4. #define POS_X 1798.6000
  5. #define POS_Y -1881.6550
  6. #define POS_Z 14.3381
  7.  
  8. new mtimer;
  9. new bus[6];
  10. new point[6];
  11.  
  12. forward UpdateMap();
  13.  
  14. public OnFilterScriptInit()
  15. {
  16.     print("Карта by mihan-888");
  17.     //Сама карта
  18.     CreateObject(19168, 1797.8475, -1881.6311, 15.0892,   90.00, 0.00, 0.00);
  19.     CreateObject(19169, 1799.3453, -1881.6311, 15.0892,   90.00, 0.00, 0.00);
  20.     CreateObject(19170, 1797.8475, -1881.6311, 13.5896,   90.00, 0.00, 0.00);
  21.     CreateObject(19171, 1799.3472, -1881.6311, 13.5896,   90.00, 0.00, 0.00);
  22.     //Фонарики
  23.     CreateObject(19280, 1799.7864, -1881.6339, 15.8763,   180.00, 180.00, 0.00);
  24.     CreateObject(19280, 1797.4865, -1881.6339, 15.8763,   180.00, 180.00, 0.00);
  25.     //Таймер
  26.     mtimer = SetTimer("UpdateMap", 4000, true);
  27.     //Автобусы
  28.     bus[0] = CreateVehicle(431,2849.6064453,1348.8885498,11.0616951,90.0000000,-1,-1,1500); //Bus
  29.     bus[1] = CreateVehicle(431,211.1277924,1921.1492920,17.8906250,90.0000000,-1,-1,1500); //Bus
  30.     bus[2] = CreateVehicle(431,-2645.8889160,1371.4929199,7.4176097,0.0000000,-1,-1,1500); //Bus
  31.     bus[3] = CreateVehicle(431,-1995.4799805,146.8946838,27.9298630,0.0000000,-1,-1,1500); //Bus
  32.     bus[4] = CreateVehicle(431,1774.5667725,-1922.8370361,13.6353350,0.0000000,-1,-1,1500); //Bus
  33.     bus[5] = CreateVehicle(431,1807.1064453,-1921.8720703,13.8133907,0.0000000,-1,-1,1500); //Bus
  34.     //Метки
  35.     for(new i = 0; i < 6; i++) point[i] = CreateObject(19177, POS_X, POS_Y, POS_Z,   90.00, 0.0, 0.0);
  36.     return 1;
  37. }
  38.  
  39. public OnFilterScriptExit()
  40. {
  41.     KillTimer(mtimer);
  42.     return 1;
  43. }
  44.  
  45. public UpdateMap()
  46. {
  47.     for(new i = 0; i < 6; i++)
  48.     {
  49.         new Float:vehx, Float:vehy, Float:vehz;
  50.         new Float:nvehx, Float:nvehy, Float:nvehz;
  51.         GetVehiclePos(bus[i], vehx, vehy, vehz);
  52.         GetMiniMapCoord(vehx,vehy,nvehx,nvehy,nvehz);
  53.        
  54.         MoveObject(point[i], nvehx, nvehy, nvehz, 0.1, 90.0, 0.0, 0.0);
  55.     }
  56. }
  57.  
  58. stock GetMiniMapCoord(Float:x,Float:y,&Float:nx,&Float:ny,&Float:nz)
  59. {//x,y - реальные координаты, nx,ny,nz - позиция на мини-карте
  60.     nx = x/2000;
  61.     nz = y/2000;
  62.     ny = POS_Y;
  63.     nx+=POS_X;
  64.     nz+=POS_Z;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement