Advertisement
Phyber1206

Blinkersystem von Phyber

Jan 4th, 2012
1,396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.03 KB | None | 0 0
  1. /* Dieser Filterscript wurde von Phyber erstellt. Bei Fragen oder Probleme meldet euch einfach in Skype bei mir: peter02238.
  2. Bitte diese Credits nicht löschen, man sieht diese ja nicht :)
  3.  
  4. Funktionen:
  5. q = links blinken
  6. e = rechts blinken
  7. /warnblinken = Warnblinker*/
  8.  
  9. #include <a_samp>
  10.  
  11. enum AutoControl
  12. {
  13.     phyberLeftBlink,
  14.     phyberRightBlink,
  15.     phyberBlink[4],
  16. }
  17. new VehInfo[MAX_VEHICLES][AutoControl];
  18. new Blinker[5];
  19.  
  20. #define rot 0xFF0000FF
  21.  
  22. public OnFilterScriptInit()
  23. {
  24.     print("\n--------------------------------------");
  25.     print(" Blinkersystem von Phyber");
  26.     print("--------------------------------------\n");
  27.    
  28.     Blinker[0] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  29.     Blinker[1] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  30.     Blinker[2] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  31.     Blinker[3] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  32.     return 1;
  33. }
  34.  
  35. public OnFilterScriptExit()
  36. {
  37.     return 1;
  38. }
  39. public OnVehicleSpawn(vehicleid)
  40. {
  41.     DestroyObject(VehInfo[vehicleid][phyberBlink][0]);
  42.     DestroyObject(VehInfo[vehicleid][phyberBlink][1]);
  43.     VehInfo[vehicleid][phyberRightBlink] = 0;
  44.     DestroyObject(VehInfo[vehicleid][phyberBlink][2]);
  45.     DestroyObject(VehInfo[vehicleid][phyberBlink][3]);
  46.     VehInfo[vehicleid][phyberLeftBlink] = 0;
  47.     return 1;
  48. }
  49. public OnPlayerCommandText(playerid, cmdtext[])
  50. {
  51.     if (strcmp("/warnblinken", cmdtext, true, 10) == 0)
  52.     {
  53.         if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,rot,"Zu Fuß kann man nicht blinken ;D");
  54.         new carid = GetPlayerVehicleID(playerid);
  55.         if(IsVehACar(carid) || IsVehACar2(carid))
  56.         {
  57.             new vid = GetPlayerVehicleID(playerid);
  58.             if(VehInfo[vid][phyberLeftBlink] == 0 && VehInfo[vid][phyberRightBlink] == 0)
  59.             {
  60.                 VehInfo[vid][phyberLeftBlink] = 1; VehInfo[vid][phyberRightBlink] = 1;
  61.                 VehInfo[vid][phyberBlink][0] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  62.                 VehInfo[vid][phyberBlink][1] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  63.                 AttachObjectToVehicle(VehInfo[vid][phyberBlink][0], vid, 0.9, 2.5, 0.1, 0.0, 0.0, 0.0);
  64.                 AttachObjectToVehicle(VehInfo[vid][phyberBlink][1], vid, 0.9, -2.7, 0.1, 0.0, 0.0, 0.0);
  65.                 VehInfo[vid][phyberRightBlink] = 1;
  66.                 VehInfo[vid][phyberBlink][2] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  67.                 VehInfo[vid][phyberBlink][3] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  68.                 AttachObjectToVehicle(VehInfo[vid][phyberBlink][2], vid, -0.9, 2.5, 0.1, 0.0, 0.0, 0.0);
  69.                 AttachObjectToVehicle(VehInfo[vid][phyberBlink][3], vid, -0.9, -2.7, 0.1, 0.0, 0.0, 0.0);
  70.                 VehInfo[vid][phyberLeftBlink] = 1;
  71.             }
  72.             else
  73.             {
  74.                 if(VehInfo[vid][phyberLeftBlink] == 1 && VehInfo[vid][phyberRightBlink] == 1)
  75.                 {
  76.                     VehInfo[vid][phyberLeftBlink] = 0; VehInfo[vid][phyberRightBlink] = 0;
  77.                     DestroyObject(VehInfo[vid][phyberBlink][0]);
  78.                     DestroyObject(VehInfo[vid][phyberBlink][1]);
  79.                     VehInfo[vid][phyberRightBlink] = 0;
  80.                     DestroyObject(VehInfo[vid][phyberBlink][2]);
  81.                     DestroyObject(VehInfo[vid][phyberBlink][3]);
  82.                     VehInfo[vid][phyberLeftBlink] = 0;
  83.                 }
  84.                 if(VehInfo[vid][phyberLeftBlink] == 1)
  85.                 {
  86.                     VehInfo[vid][phyberLeftBlink] = 0;
  87.                     DestroyObject(VehInfo[vid][phyberBlink][2]);
  88.                     DestroyObject(VehInfo[vid][phyberBlink][3]);
  89.                     VehInfo[vid][phyberLeftBlink] = 0;
  90.                 }
  91.                 if(VehInfo[vid][phyberRightBlink] == 1)
  92.                 {
  93.                     VehInfo[vid][phyberRightBlink] = 0;
  94.                     DestroyObject(VehInfo[vid][phyberBlink][0]);
  95.                     DestroyObject(VehInfo[vid][phyberBlink][1]);
  96.                     VehInfo[vid][phyberRightBlink] = 0;
  97.                 }
  98.             }
  99.         }
  100.         else
  101.         {
  102.             SendClientMessage(playerid,rot,"Dein Fahrzeug kann nicht blinken!");
  103.         }
  104.     }
  105.     return 1;
  106. }
  107.  
  108. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  109. {
  110.     new carid = GetPlayerVehicleID(playerid);
  111.     new vid = GetPlayerVehicleID(playerid);
  112.    
  113.     if(newkeys == (KEY_LOOK_RIGHT)) //rechts gucken im auto
  114.     {
  115.         if(!IsPlayerInAnyVehicle(playerid)) return 1;
  116.         if(VehInfo[vid][phyberRightBlink] == 0)
  117.         {
  118.             if(IsVehACar(carid) || IsVehACar2(carid))
  119.             {
  120.                 VehInfo[vid][phyberLeftBlink] = 0; //Linker Blinker ausschalten
  121.                 DestroyObject(VehInfo[vid][phyberBlink][2]);
  122.                 DestroyObject(VehInfo[vid][phyberBlink][3]);
  123.                 VehInfo[vid][phyberLeftBlink] = 0;
  124.  
  125.                 VehInfo[vid][phyberRightBlink] = 1;
  126.                 VehInfo[vid][phyberBlink][0] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  127.                 VehInfo[vid][phyberBlink][1] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  128.                 AttachObjectToVehicle(VehInfo[vid][phyberBlink][0], vid, 0.9, 2.5, 0.1, 0.0, 0.0, 0.0);
  129.                 AttachObjectToVehicle(VehInfo[vid][phyberBlink][1], vid, 0.9, -2.7, 0.1, 0.0, 0.0, 0.0);
  130.                 VehInfo[vid][phyberRightBlink] = 1;
  131.             }
  132.             else {return 1;}
  133.         }
  134.         else
  135.         {
  136.             VehInfo[vid][phyberRightBlink] = 0;
  137.             DestroyObject(VehInfo[vid][phyberBlink][0]);
  138.             DestroyObject(VehInfo[vid][phyberBlink][1]);
  139.             VehInfo[vid][phyberRightBlink] = 0;
  140.         }
  141.     }
  142.     if(newkeys == (KEY_LOOK_LEFT)) //links gucken im auto
  143.     {
  144.         if(!IsPlayerInAnyVehicle(playerid)) return 1;
  145.         if(VehInfo[vid][phyberLeftBlink] == 0)
  146.         {
  147.             if(IsVehACar(carid) || IsVehACar2(carid))
  148.             {
  149.                 VehInfo[vid][phyberRightBlink] = 0; //rechter blinker aus
  150.                 DestroyObject(VehInfo[vid][phyberBlink][0]);
  151.                 DestroyObject(VehInfo[vid][phyberBlink][1]);
  152.                 VehInfo[vid][phyberRightBlink] = 0;
  153.  
  154.                 VehInfo[vid][phyberLeftBlink] = 1;
  155.                 VehInfo[vid][phyberBlink][2] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  156.                 VehInfo[vid][phyberBlink][3] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,100.0);
  157.                 AttachObjectToVehicle(VehInfo[vid][phyberBlink][2], vid, -0.9, 2.5, 0.1, 0.0, 0.0, 0.0);
  158.                 AttachObjectToVehicle(VehInfo[vid][phyberBlink][3], vid, -0.9, -2.7, 0.1, 0.0, 0.0, 0.0);
  159.                 VehInfo[vid][phyberLeftBlink] = 1;
  160.                 return 1;
  161.             }
  162.             else {return 1;}
  163.         }
  164.         else
  165.         {
  166.             VehInfo[vid][phyberLeftBlink] = 0;
  167.             DestroyObject(VehInfo[vid][phyberBlink][2]);
  168.             DestroyObject(VehInfo[vid][phyberBlink][3]);
  169.             VehInfo[vid][phyberLeftBlink] = 0;
  170.         }
  171.         return 1;
  172.     }
  173.     return 1;
  174. }
  175.  
  176.  
  177. //stocks
  178. stock IsVehACar(vehicleid)
  179. {
  180.     new result;
  181.     new model = GetVehicleModel(vehicleid);
  182.     switch(model)
  183.     {
  184.         case 400,401,402,404,409,410,411,412,413,414,415,416,418,419,420,421,422,423,424,426,427,428,429,434,436,438,439,440,442,445,451,457,458,459,466,467,470,471,474,475,477,478,479,480,482,483,485,486,489,490,491,492,494,495,496,498,499,500,502,503,504: result= model;
  185.         default: result = 0;
  186.     }
  187.     return result;
  188. }
  189. stock IsVehACar2(vehicleid)
  190. {
  191.     new result;
  192.     new model = GetVehicleModel(vehicleid);
  193.     switch(model)
  194.     {
  195.         case 505,507,508,516,517,518,525,526,527,528,529,530,531,533,534,535,536,539,540,541,542,543,545,546,547,549,550,551,552,554,555,558,559,560,561,562,565,566,567,568,571,572,573,574,575,576,579,580,582,583,585,587,588,589,596,597,598,599,600,601,602,603,604,605,609: result= model;
  196.         default: result = 0;
  197.     }
  198.     return result;
  199. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement