Advertisement
Guest User

[FS] Avto-Povorotniki

a guest
Dec 21st, 2010
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.93 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. forward povorotniki();
  4.  
  5. new povorotnic[MAX_VEHICLES][4];
  6. new PovarotStat[MAX_VEHICLES];
  7. new steppov[MAX_VEHICLES];
  8.  
  9. enum
  10. {
  11. POVOROT_OFF,
  12. POVOROT_ON
  13. }
  14.  
  15. public OnFilterScriptInit()
  16. {
  17.     print("************Поворотинкики для машин v0.1**********");
  18.     print("*****************by Morino_Reigan*****************");
  19.     print("************CopyRight 2010 © SAMP-RUS.COM*********");
  20.     SetTimer("povorotniki",500,true);
  21.     SetWorldTime(21);
  22. }
  23.  
  24. public OnPlayerConnect(playerid)
  25. {
  26. }
  27.  
  28. public povorotniki()
  29. {
  30.     for(new i=0;i<MAX_VEHICLES;i++)
  31.     {
  32.         if(PovarotStat[i]==POVOROT_ON)
  33.         {
  34.             switch(steppov[i])
  35.             {
  36.                 case 1:
  37.                 {
  38.                     povorotnic[i][0] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  39.                     povorotnic[i][1] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  40.                     AttachObjectToVehicle(povorotnic[i][0], i, 0.9, 2.5, 0.1, 0.0, 0.0, 0.0);
  41.                     AttachObjectToVehicle(povorotnic[i][1], i, 0.9, -2.7, 0.1, 0.0, 0.0, 0.0);
  42.                     steppov[i]=2;
  43.                 }
  44.                 case 2:
  45.                 {
  46.                     DestroyObject(povorotnic[i][0]);
  47.                     DestroyObject(povorotnic[i][1]);
  48.                     steppov[i]=1;
  49.                 }
  50.                 case 3:
  51.                 {
  52.                     povorotnic[i][2] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  53.                     povorotnic[i][3] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  54.                     AttachObjectToVehicle(povorotnic[i][2], i, -0.9, 2.5, 0.1, 0.0, 0.0, 0.0);
  55.                     AttachObjectToVehicle(povorotnic[i][3], i, -0.9, -2.7, 0.1, 0.0, 0.0, 0.0);
  56.                     steppov[i]=4;
  57.                 }
  58.                 case 4:
  59.                 {
  60.                     DestroyObject(povorotnic[i][2]);
  61.                     DestroyObject(povorotnic[i][3]);
  62.                     steppov[i]=3;
  63.                 }
  64.                 case 5:
  65.                 {
  66.                     povorotnic[i][0] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  67.                     povorotnic[i][1] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  68.                     povorotnic[i][2] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  69.                     povorotnic[i][3] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  70.                     AttachObjectToVehicle(povorotnic[i][0], i, 0.9, 2.5, 0.1, 0.0, 0.0, 0.0);
  71.                     AttachObjectToVehicle(povorotnic[i][1], i, 0.9, -2.7, 0.1, 0.0, 0.0, 0.0);
  72.                     AttachObjectToVehicle(povorotnic[i][2], i, -0.9, 2.5, 0.1, 0.0, 0.0, 0.0);
  73.                     AttachObjectToVehicle(povorotnic[i][3], i, -0.9, -2.7, 0.1, 0.0, 0.0, 0.0);
  74.                     steppov[i]=6;
  75.                 }
  76.                 case 6:
  77.                 {
  78.                     DestroyObject(povorotnic[i][0]);
  79.                     DestroyObject(povorotnic[i][1]);
  80.                     DestroyObject(povorotnic[i][2]);
  81.                     DestroyObject(povorotnic[i][3]);
  82.                     steppov[i]=5;
  83.                 }
  84.                 case 7:
  85.                 {
  86.                     DestroyObject(povorotnic[i][0]);
  87.                     DestroyObject(povorotnic[i][1]);
  88.                     DestroyObject(povorotnic[i][2]);
  89.                     DestroyObject(povorotnic[i][3]);
  90.                     PovarotStat[i]=POVOROT_OFF;
  91.                 }
  92.             }
  93.         }
  94.     }
  95. }
  96. public OnPlayerCommandText(playerid,cmdtext[])
  97. {
  98.     if(!strcmp("rpovorot",cmdtext[1],true))
  99.     {
  100.         if(!IsPlayerInAnyVehicle(playerid))return 1;
  101.         steppov[GetPlayerVehicleID(playerid)]=1;
  102.         SendClientMessage(playerid,0xf0ff0fff,"DIZEL");
  103.         PovarotStat[GetPlayerVehicleID(playerid)]=POVOROT_ON;
  104.         return 1;
  105.     }
  106.     if(!strcmp("lpovorot",cmdtext[1],true))
  107.     {
  108.         if(!IsPlayerInAnyVehicle(playerid))return 1;
  109.         steppov[GetPlayerVehicleID(playerid)]=3;
  110.         SendClientMessage(playerid,0xf0ff0fff,"DIZEL");
  111.         PovarotStat[GetPlayerVehicleID(playerid)]=POVOROT_ON;
  112.         return 1;
  113.     }
  114.     return 0;
  115. }
  116.  
  117. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  118. {
  119.     if(newkeys&256)
  120.     {
  121.         new carid=GetPlayerVehicleID(playerid);
  122.         if(PovarotStat[carid]==POVOROT_OFF)
  123.         {
  124.             if(!IsPlayerInAnyVehicle(playerid))return 1;
  125.             steppov[carid]=3;
  126.             PovarotStat[carid]=POVOROT_ON;
  127.             return 1;
  128.         }
  129.         else if(PovarotStat[carid]==POVOROT_ON)
  130.         {
  131.             steppov[carid]=7;
  132.         }
  133.         return 1;
  134.     }
  135.     if(newkeys&64)
  136.     {
  137.         new carid=GetPlayerVehicleID(playerid);
  138.         if(PovarotStat[carid]==POVOROT_OFF)
  139.         {
  140.             if(!IsPlayerInAnyVehicle(playerid))return 1;
  141.             steppov[carid]=1;
  142.             PovarotStat[carid]=POVOROT_ON;
  143.             return 1;
  144.         }
  145.         else if(PovarotStat[carid]==POVOROT_ON)
  146.         {
  147.             steppov[carid]=7;
  148.         }
  149.         return 1;
  150.     }
  151.     if(newkeys&512)
  152.     {
  153.         new carid=GetPlayerVehicleID(playerid);
  154.         if(PovarotStat[carid]==POVOROT_OFF)
  155.         {
  156.             if(!IsPlayerInAnyVehicle(playerid))return 1;
  157.             steppov[carid]=5;
  158.             PovarotStat[carid]=POVOROT_ON;
  159.             return 1;
  160.         }
  161.         else if(PovarotStat[carid]==POVOROT_ON)
  162.         {
  163.             steppov[carid]=7;
  164.         }
  165.         return 1;
  166.     }
  167.     return 1;
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement