Advertisement
xKrUsE6x

Autohaussystem 2.0 by xKrUsE6x

Jan 12th, 2013
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 30.34 KB | None | 0 0
  1. /*
  2. ---------------------------------------------------------------------------------------------------------------------------------------------------------------
  3.                                                     Filterscript by xKrUsE6x
  4.                                                     Ihr könnt es auf euren Servern verwenden,
  5.                                                     aber es nicht als euer eigenes ausgeben !!!
  6.                                                     Copyright(c) 2013 - 2014
  7. ---------------------------------------------------------------------------------------------------------------------------------------------------------------
  8. */
  9. //Autohaussystem
  10. const MAX_PLAYER_CARS = 2;
  11. //Farben für Autohaus
  12. #define FARBE_AUTOHAUS0 0xCD0000FF
  13. #define FARBE_AUTOHAUS1 0xB9FF00FF
  14. //Farben für die Autos
  15. #define CAR_FARBE 25 //Hier die Farbe eintragen in der die KaufCars gespawnt werden sollen
  16. //Dialoge
  17. #define Autokauf 5000
  18. //Includes
  19. #include <a_samp>
  20. #include <dini>
  21. //Booleane
  22. new bool:carlock[MAX_VEHICLES];
  23. //Variablen für Autohaussystem
  24. new meinauto[MAX_PLAYERS][MAX_PLAYER_CARS];
  25. new KaufAutos[66];
  26. new engine,lights,alarm,doors,bonnet,boot,objective;
  27. //Enums + passende Arrays
  28. enum AKinfo
  29. {
  30.     modelid,
  31.     Name[54],
  32.     preis,
  33.     Float:kaufx,
  34.     Float:kaufy,
  35.     Float:kaufz,
  36.     Float:kaufrot,
  37.     Float:spawnx,
  38.     Float:spawny,
  39.     Float:spawnz,
  40.     Float:spawnrot
  41. }
  42. new BuyCars[66][AKinfo] = {
  43. //Luxusautohaus
  44. {400,"Landstalker",100000,-1985.4628,303.9438,35.1696,271.0079,-1946.9000244,275.0000000,41.2000008,114.0000000},
  45. {402,"Buffalo",140000,-1985.4628,303.9438,35.1696,271.0079,-1946.4000244,270.5000000,41.0000000,90.0000000},
  46. {405,"Sentinel",120000,-1985.4628,303.9438,35.1696,271.0079,-1946.6999512,266.8999939,41.0000000,90.0000000},
  47. {409,"Stretch",1000000,-1985.4628,303.9438,35.1696,271.0079,-1954.6999512,297.2999878,41.0000000,163.9998169},
  48. {411,"Infernus",350000,-1985.4628,303.9438,35.1696,271.0079,-1946.1999512,263.2000122,40.7999992,90.0000000},
  49. {415,"Cheetah",250000,-1985.4628,303.9438,35.1696,271.0079,-1946.5999756,259.2000122,40.9000015,90.0000000},
  50. {429,"Banshee",340000,-1985.4628,303.9438,35.1696,271.0079,-1957.1999512,259.5000000,40.7999992,338.0000000},
  51. {445,"Admiral",70000,-1985.4628,303.9438,35.1696,271.0079,-1949.3000488,255.5000000,41.0000000,66.0000000},
  52. {451,"Turismo",550000,-1985.4628,303.9438,35.1696,271.0079,-1956.9000244,267.2000122,40.7999992,338.0000000},
  53. {474,"Hermes",150000,-1985.4628,303.9438,35.1696,271.0079,-1948.5000000,274.7999878,35.4000015,114.0000000},
  54. {477,"ZR-350",230000,-1985.4628,303.9438,35.1696,271.0079,-1948.0000000,270.2999878,35.2999992,90.0000000},
  55. {480,"Comet",220000,-1985.4628,303.9438,35.1696,271.0079,-1948.4000244,266.1000061,35.2999992,90.0000000},
  56. {506,"Super GT",340000,-1985.4628,303.9438,35.1696,271.0079,-1948.5000000,262.1000061,35.2999992,90.0000000},
  57. {507,"Elegant",95000,-1985.4628,303.9438,35.1696,271.0079,-1947.9000244,258.0000000,35.4000015,90.0000000},
  58. {533,"Feltzer",70000,-1985.4628,303.9438,35.1696,271.0079,-1960.4000244,255.8999939,35.2999992,296.0000000},
  59. {541,"Bullet",650000,-1985.4628,303.9438,35.1696,271.0079,-1960.8000488,260.3999939,35.2000008,270.0000000},
  60. {545,"Hustler",220000,-1985.4628,303.9438,35.1696,271.0079,-1960.8000488,266.7999878,35.4000015,270.0000000},
  61. {560,"Sultan",250000,-1985.4628,303.9438,35.1696,271.0079,-1960.8000488,270.8999939,35.2999992,270.0000000},
  62. {562,"Elegy",240000,-1985.4628,303.9438,35.1696,271.0079,-1960.9000244,274.7999878,35.2000008,270.0000000},
  63. {565,"Flash",85000,-1985.4628,303.9438,35.1696,271.0079,-1960.6999512,279.8999939,35.2000008,270.0000000},
  64. {579,"Huntley",90000,-1985.4628,303.9438,35.1696,271.0079,-1960.8000488,285.0000000,35.5999985,306.0000000},
  65. {603,"Phoenix",300000,-1985.4628,303.9438,35.1696,271.0079,-1958.3000488,303.1000061,35.5000000,137.9998779},
  66. {602,"Alpha",110000,-1985.4628,303.9438,35.1696,271.0079,-1953.5000000,300.1000061,35.4000015,157.9998779},
  67. //Billigautohaus
  68. {401,"Bravura",20000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1198.9000244,23.7000008,270.0000000},
  69. {404,"Perrenniel",13500,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1194.4000244,23.7000008,270.0000000},
  70. {412,"Voodoo",12000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1189.5999756,23.7000008,270.0000000},
  71. {413,"Pony",23000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1184.6999512,23.7000008,270.0000000},
  72. {419,"Esperanto",9500,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1180.3000488,23.7000008,270.0000000},
  73. {421,"Washington",13000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1175.5999756,23.7000008,270.0000000},
  74. {422,"Bobcat",40000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1171.0000000,23.7000008,270.0000000},
  75. {426,"Premier",15400,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1166.4000244,23.7000008,270.0000000},
  76. {436,"Previon",14300,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1161.8000488,23.7000008,270.0000000},
  77. {439,"Stallion",25000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1157.3000488,23.7000008,270.0000000},
  78. {440,"Rumpo",12500,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1152.9000244,23.7999992,270.0000000},
  79. {458,"Solair",16000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1148.0999756,24.3999996,270.0000000},
  80. {466,"Glendale",15000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1143.1999512,24.8999996,270.0000000},
  81. {467,"Oceanic",6000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1138.4000244,25.3999996,270.0000000},
  82. {475,"Sabre",9500,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1134.0999756,25.3999996,270.0000000},
  83. {479,"Regina",12000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1197.4000244,23.7000008,90.0000000},
  84. {482,"Burrito",25000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1192.4000244,23.7000008,90.0000000},
  85. {483,"Camper",40000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1187.5000000,23.7000008,90.0000000},
  86. {489,"Rancher",35000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1182.5999756,23.7000008,90.0000000},
  87. {492,"Greenwood",23000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1177.8000488,23.7000008,90.0000000},
  88. {496,"Blista Compact",37000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1172.9000244,23.7000008,90.0000000},
  89. {500,"Mesa",34500,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1168.0000000,23.7000008,90.0000000},
  90. {508,"Journey",80000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1162.9000244,23.7000008,90.0000000},
  91. {518,"Buccaneer",22000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1158.1999512,23.7000008,90.0000000},
  92. {526,"Fortune",26000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1152.8000488,23.7999992,90.0000000},
  93. {527,"Cadrona",28000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1148.0999756,24.2999992,90.0000000},
  94. {535,"Slamvan",50000,2125.4915,-1116.5385,25.2411,72.6353,2161.1000977,-1143.5999756,24.7999992,90.0000000},
  95. {536,"Blade",45000,2125.4915,-1116.5385,25.2411,72.6353,2120.1000977,-1146.8000488,24.2999992,292.0000000},
  96. {542,"Clover",5000,2125.4915,-1116.5385,25.2411,72.6353,2120.1000977,-1141.1999512,24.7999992,291.9946289},
  97. {547,"Primo",23400,2125.4915,-1116.5385,25.2411,72.6353,2119.6000977,-1135.3000488,25.1000004,291.9946289},
  98. {549,"Tampa",19500,2125.4915,-1116.5385,25.2411,72.6353,2119.6999512,-1128.9000244,25.2000008,291.9946289},
  99. {550,"Sunrise",34000,2125.4915,-1116.5385,25.2411,72.6353,2119.3000488,-1123.0000000,25.2000008,291.9946289},
  100. {554,"Yosemite",36000,2125.4915,-1116.5385,25.2411,72.6353,2135.5000000,-1128.0999756,25.3999996,64.0000000},
  101. {587,"Euros",20000,2125.4915,-1116.5385,25.2411,72.6353,2135.8000488,-1134.0999756,25.5000000,63.9953613},
  102. {600,"Picador",31000,2125.4915,-1116.5385,25.2411,72.6353,2148.3999023,-1203.5999756,23.7000008,270.0000000},
  103. //Bikeautohaus
  104. {461,"PCJ-600",30000,2466.6999512,-1545.5000000,23.7000008,90.0000000,2445.1000977,-1557.3000488,23.7000008,328.0000000},
  105. {462,"Faggio",2000,2466.6999512,-1545.5000000,23.7000008,90.0000000,2447.6999512,-1557.3000488,23.7000008,327.9968262},
  106. {463,"Freeway",40000,2466.6999512,-1545.5000000,23.7000008,90.0000000,2450.3000488,-1557.3000488,23.7000008,327.9968262},
  107. {468,"Sanchez",20000,2466.6999512,-1545.5000000,23.7000008,90.0000000,2453.0000000,-1557.3000488,23.7000008,327.9968262},
  108. {471,"Quad",35000,2466.6999512,-1545.5000000,23.7000008,90.0000000,2455.6999512,-1557.3000488,23.7000008,327.9968262},
  109. {521,"FCR-900",60000,2466.6999512,-1545.5000000,23.7000008,90.0000000,2458.1000977,-1557.3000488,23.7000008,327.9968262},
  110. {522,"NRG-500",120000,2466.6999512,-1545.5000000,23.7000008,90.0000000,2460.8999023,-1557.3000488,23.7000008,327.9968262},
  111. {581,"BF-400",35000,2466.6999512,-1545.5000000,23.7000008,90.0000000,2463.8999023,-1557.3000488,23.7000008,327.9968262}
  112. };
  113. enum Ainfo
  114. {
  115.     Float:Park_x,
  116.     Float:Park_y,
  117.     Float:Park_z,
  118.     Float:Park_rot,
  119.     Farbe1,
  120.     Farbe2,
  121.     Paintjob,
  122.     Spoiler,
  123.     Hood,
  124.     Roof,
  125.     Sideskirt,
  126.     Lamps,
  127.     Nitro,
  128.     Exhaust,
  129.     Wheels,
  130.     Stereo,
  131.     Hydraulics,
  132.     FrontBumper,
  133.     RearBumper,
  134.     VentRight,
  135.     VentLeft,
  136.     modelid,
  137.     preis
  138. }
  139. new Autos[MAX_PLAYERS][MAX_PLAYER_CARS][Ainfo];
  140.  
  141. public OnFilterScriptInit()
  142. {
  143.     print("\n--------------------------------------");
  144.     print("Autohaus System by xKrUsE6x geladen");
  145.     print("--------------------------------------\n");
  146.     for(new i = 0; i < sizeof BuyCars;i++)
  147.     {
  148.         KaufAutos[i] = CreateVehicle(BuyCars[i][modelid],BuyCars[i][spawnx],BuyCars[i][spawny],BuyCars[i][spawnz],BuyCars[i][spawnrot],CAR_FARBE,CAR_FARBE,-1);
  149.     }
  150.     return 1;
  151. }
  152.  
  153. public OnFilterScriptExit()
  154. {
  155.     for(new i = 0; i < sizeof BuyCars;i++)
  156.     {
  157.         for(new x = 0; x < MAX_PLAYER_CARS;x++)
  158.         {
  159.             for(new j = 0; j < MAX_PLAYERS;j++)
  160.             {
  161.                 DestroyVehicle(meinauto[j][x]);
  162.                 DestroyVehicle(KaufAutos[i]);
  163.             }
  164.         }
  165.     }
  166.     return 1;
  167. }
  168.  
  169. public OnPlayerConnect(playerid)
  170. {
  171.     for(new i = 0;i < MAX_PLAYER_CARS;i++)
  172.     {
  173.         new Car[128];
  174.         format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",playername(playerid),i);
  175.         if(!dini_Exists(Car)) continue;
  176.         {
  177.             Autos[playerid][i][Park_x]= dini_Float(Car,"Car_X");
  178.             Autos[playerid][i][Park_y]= dini_Float(Car,"Car_y");
  179.             Autos[playerid][i][Park_z]= dini_Float(Car,"Car_Z");
  180.             Autos[playerid][i][Park_rot]= dini_Float(Car,"Car_ROT");
  181.             Autos[playerid][i][Farbe1] = dini_Int(Car,"Farbe1");
  182.             Autos[playerid][i][Farbe2] = dini_Int(Car,"Farbe2");
  183.             Autos[playerid][i][Paintjob] = dini_Int(Car,"Paintjob");
  184.             Autos[playerid][i][modelid] = dini_Int(Car,"modelid");
  185.             Autos[playerid][i][Spoiler] = dini_Int(Car,"Spoiler");
  186.             Autos[playerid][i][Wheels] = dini_Int(Car,"Wheels");
  187.             Autos[playerid][i][Nitro] = dini_Int(Car,"Nitro");
  188.             Autos[playerid][i][Roof] = dini_Int(Car,"Roof");
  189.             Autos[playerid][i][Hood] = dini_Int(Car,"Hood");
  190.             Autos[playerid][i][Sideskirt] = dini_Int(Car,"Sideskirt");
  191.             Autos[playerid][i][Lamps] = dini_Int(Car,"Lamps");
  192.             Autos[playerid][i][Exhaust] = dini_Int(Car,"Exhaust");
  193.             Autos[playerid][i][Stereo] = dini_Int(Car,"Stereo");
  194.             Autos[playerid][i][Hydraulics] = dini_Int(Car,"Hydraulics");
  195.             Autos[playerid][i][VentRight] = dini_Int(Car,"VentRight");
  196.             Autos[playerid][i][VentLeft] = dini_Int(Car,"VentLeft");
  197.             Autos[playerid][i][FrontBumper] = dini_Int(Car,"FrontBumper");
  198.             Autos[playerid][i][RearBumper] = dini_Int(Car,"RearBumper");
  199.             Autos[playerid][i][modelid] = dini_Int(Car,"modelid");
  200.             Autos[playerid][i][preis] = dini_Int(Car,"Preis");
  201.             meinauto[playerid][i] = CreateVehicle(Autos[playerid][i][modelid],Autos[playerid][i][Park_x],Autos[playerid][i][Park_y],Autos[playerid][i][Park_z],Autos[playerid][i][Park_rot],-1,-1,-1);
  202.             if(Autos[playerid][i][Paintjob] >= 0)
  203.             {
  204.                 ChangeVehiclePaintjob(meinauto[playerid][i],Autos[playerid][i][Paintjob]);
  205.             }
  206.             if(Autos[playerid][i][Farbe1] >= 0 || Autos[playerid][i][Farbe2] >= 0)
  207.             {
  208.                 ChangeVehicleColor(meinauto[playerid][i],Autos[playerid][i][Farbe1],Autos[playerid][i][Farbe2]);
  209.             }
  210.             if(Autos[playerid][i][Spoiler] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Spoiler]); }
  211.             if(Autos[playerid][i][Hood] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Hood]); }
  212.             if(Autos[playerid][i][Roof] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Roof]); }
  213.             if(Autos[playerid][i][Sideskirt] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Sideskirt]); }
  214.             if(Autos[playerid][i][Lamps] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Lamps]); }
  215.             if(Autos[playerid][i][Nitro] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Nitro]); }
  216.             if(Autos[playerid][i][Exhaust] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Exhaust]); }
  217.             if(Autos[playerid][i][Wheels] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Wheels]); }
  218.             if(Autos[playerid][i][Stereo] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Stereo]); }
  219.             if(Autos[playerid][i][Hydraulics] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][Hydraulics]); }
  220.             if(Autos[playerid][i][FrontBumper] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][FrontBumper]); }
  221.             if(Autos[playerid][i][RearBumper] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][RearBumper]); }
  222.             if(Autos[playerid][i][VentRight] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][VentRight]); }
  223.             if(Autos[playerid][i][VentLeft] >= 1000) { AddVehicleComponent(meinauto[playerid][i],Autos[playerid][i][VentLeft]); }
  224.             GetVehicleParamsEx(meinauto[playerid][i],engine,lights,alarm,doors,bonnet,boot,objective);
  225.             SetVehicleParamsEx(meinauto[playerid][i],engine,lights,alarm,true,bonnet,boot,objective);
  226.             carlock[meinauto[playerid][i]] = true;
  227.         }
  228.     }
  229.     return 1;
  230. }
  231.  
  232. public OnPlayerDisconnect(playerid, reason)
  233. {
  234.     for(new i = 0;i < MAX_PLAYER_CARS;i++)
  235.     {
  236.         new Car[128];
  237.         format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",playername(playerid),i);
  238.         if(dini_Exists(Car))
  239.         {
  240.             dini_FloatSet(Car,"Car_X",Autos[playerid][i][Park_x]);
  241.             dini_FloatSet(Car,"Car_y",Autos[playerid][i][Park_y]);
  242.             dini_FloatSet(Car,"Car_Z",Autos[playerid][i][Park_z]);
  243.             dini_FloatSet(Car,"Car_ROT",Autos[playerid][i][Park_rot]);
  244.             dini_IntSet(Car,"Farbe1",Autos[playerid][i][Farbe1]);
  245.             dini_IntSet(Car,"Farbe2",Autos[playerid][i][Farbe2]);
  246.             dini_IntSet(Car,"Paintjob",Autos[playerid][i][Paintjob]);
  247.             dini_IntSet(Car,"Spoiler",GetVehicleComponentInSlot(meinauto[playerid][i],0));
  248.             dini_IntSet(Car,"Hood",GetVehicleComponentInSlot(meinauto[playerid][i],1));
  249.             dini_IntSet(Car,"Roof",GetVehicleComponentInSlot(meinauto[playerid][i],2));
  250.             dini_IntSet(Car,"Sideskirt",GetVehicleComponentInSlot(meinauto[playerid][i],3));
  251.             dini_IntSet(Car,"Lamps",GetVehicleComponentInSlot(meinauto[playerid][i],4));
  252.             dini_IntSet(Car,"Nitro",GetVehicleComponentInSlot(meinauto[playerid][i],5));
  253.             dini_IntSet(Car,"Exhaust",GetVehicleComponentInSlot(meinauto[playerid][i],6));
  254.             dini_IntSet(Car,"Wheels",GetVehicleComponentInSlot(meinauto[playerid][i],7));
  255.             dini_IntSet(Car,"Stereo",GetVehicleComponentInSlot(meinauto[playerid][i],8));
  256.             dini_IntSet(Car,"Hydraulics",GetVehicleComponentInSlot(meinauto[playerid][i],9));
  257.             dini_IntSet(Car,"FrontBumper",GetVehicleComponentInSlot(meinauto[playerid][i],10));
  258.             dini_IntSet(Car,"RearBumper",GetVehicleComponentInSlot(meinauto[playerid][i],11));
  259.             dini_IntSet(Car,"VentRight",GetVehicleComponentInSlot(meinauto[playerid][i],12));
  260.             dini_IntSet(Car,"VentLeft",GetVehicleComponentInSlot(meinauto[playerid][i],13));
  261.             dini_IntSet(Car,"Modelid",GetVehicleModel(meinauto[playerid][i]));
  262.             DestroyVehicle(meinauto[playerid][i]);
  263.         }
  264.     }
  265.     return 1;
  266. }
  267. public OnVehicleDeath(vehicleid, killerid)
  268. {
  269.     for(new z = 0; z < MAX_PLAYERS;z++)
  270.     {
  271.         for(new i = 0; i < MAX_PLAYER_CARS;i++)
  272.         {
  273.             if(vehicleid == meinauto[z][i])
  274.             {
  275.                 new Car[128];
  276.                 format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",playername(z),i);
  277.                 Autos[z][i][Park_x]= dini_Float(Car,"Car_X");
  278.                 Autos[z][i][Park_y]= dini_Float(Car,"Car_y");
  279.                 Autos[z][i][Park_z]= dini_Float(Car,"Car_Z");
  280.                 Autos[z][i][Park_rot]= dini_Float(Car,"Car_ROT");
  281.                 Autos[z][i][Farbe1] = dini_Int(Car,"Farbe1");
  282.                 Autos[z][i][Farbe2] = dini_Int(Car,"Farbe2");
  283.                 Autos[z][i][Paintjob] = dini_Int(Car,"Paintjob");
  284.                 Autos[z][i][modelid] = dini_Int(Car,"modelid");
  285.                 Autos[z][i][Spoiler] = dini_Int(Car,"Spoiler");
  286.                 Autos[z][i][Wheels] = dini_Int(Car,"Wheels");
  287.                 Autos[z][i][Nitro] = dini_Int(Car,"Nitro");
  288.                 Autos[z][i][Roof] = dini_Int(Car,"Roof");
  289.                 Autos[z][i][Hood] = dini_Int(Car,"Hood");
  290.                 Autos[z][i][Sideskirt] = dini_Int(Car,"Sideskirt");
  291.                 Autos[z][i][Lamps] = dini_Int(Car,"Lamps");
  292.                 Autos[z][i][Exhaust] = dini_Int(Car,"Exhaust");
  293.                 Autos[z][i][Stereo] = dini_Int(Car,"Stereo");
  294.                 Autos[z][i][Hydraulics] = dini_Int(Car,"Hydraulics");
  295.                 Autos[z][i][VentRight] = dini_Int(Car,"VentRight");
  296.                 Autos[z][i][VentLeft] = dini_Int(Car,"VentLeft");
  297.                 Autos[z][i][FrontBumper] = dini_Int(Car,"FrontBumper");
  298.                 Autos[z][i][RearBumper] = dini_Int(Car,"RearBumper");
  299.                 DestroyVehicle(meinauto[z][i]);
  300.                 meinauto[z][i] = CreateVehicle(Autos[z][i][modelid],Autos[z][i][Park_x],Autos[z][i][Park_y],Autos[z][i][Park_z],Autos[z][i][Park_rot],Autos[z][i][Farbe1],Autos[z][i][Farbe2],-1);
  301.                                    ChangeVehiclePaintjob(meinauto[z][i],Autos[z][i][Paintjob]);
  302.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Spoiler]);
  303.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Hood]);
  304.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Roof]);
  305.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Sideskirt]);
  306.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Lamps]);
  307.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Nitro]);
  308.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Exhaust]);
  309.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Wheels]);
  310.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Stereo]);
  311.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][Hydraulics]);
  312.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][FrontBumper]);
  313.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][RearBumper]);
  314.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][VentRight]);
  315.                 AddVehicleComponent(meinauto[z][i],Autos[z][i][VentLeft]);
  316.                 GetVehicleParamsEx(meinauto[z][i],engine,lights,alarm,doors,bonnet,boot,objective);
  317.                 SetVehicleParamsEx(meinauto[z][i],engine,lights,alarm,true,bonnet,boot,objective);
  318.                 carlock[meinauto[z][i]] = true;
  319.             }
  320.             else continue;
  321.         }
  322.     }
  323.     return 1;
  324. }
  325. public OnPlayerCommandText(playerid, cmdtext[])
  326. {
  327.     if(strcmp(cmdtext, "/park", true) == 0)
  328.     {
  329.         new inveh = 0;
  330.         for(new i= 0;i < MAX_PLAYER_CARS;i++)
  331.         {
  332.             if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,FARBE_AUTOHAUS0,"Du musst in einem Auto sitzen!");
  333.             new vehicleid = GetPlayerVehicleID(playerid);
  334.             if(vehicleid == meinauto[playerid][i])
  335.             {
  336.                 new Float:x,Float:y,Float:z,Float:rot;
  337.                 GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
  338.                 GetVehicleZAngle(GetPlayerVehicleID(playerid),rot);
  339.                 Autos[playerid][i][Park_x] = x;
  340.                 Autos[playerid][i][Park_y] = y;
  341.                 Autos[playerid][i][Park_z] = z;
  342.                 Autos[playerid][i][Park_rot] = rot;
  343.                 new Car[128];
  344.                 format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",playername(playerid),i);
  345.                 dini_FloatSet(Car,"Car_X",Autos[playerid][i][Park_x]);
  346.                 dini_FloatSet(Car,"Car_y",Autos[playerid][i][Park_y]);
  347.                 dini_FloatSet(Car,"Car_Z",Autos[playerid][i][Park_z]);
  348.                 dini_FloatSet(Car,"Car_ROT",Autos[playerid][i][Park_rot]);
  349.                 SendClientMessage(playerid,0xFFFF00FF,"*Du hast dein Auto nun hier geparkt, du wirst es nun immer hier wieder finden.");
  350.             }
  351.             else
  352.             {
  353.                 inveh = 1;
  354.                 continue;
  355.             }
  356.         }
  357.         if(inveh == 1)
  358.         {
  359.             SendClientMessage(playerid,FARBE_AUTOHAUS0,"*Für dieses Auto besitzt du keine Schlüssel!");
  360.         }
  361.         return 1;
  362.     }
  363.     if(strcmp(cmdtext, "/carlock", true) == 0)
  364.     {
  365.         new inveh = 0;
  366.         for(new i = 0;i < MAX_PLAYER_CARS;i++)
  367.         {
  368.             new Float:x,Float:y,Float:z;
  369.             GetVehiclePos(meinauto[playerid][i],x,y,z);
  370.             if(IsPlayerInRangeOfPoint(playerid,2.5,x,y,z))
  371.             {
  372.                 if(carlock[meinauto[playerid][i]] == false)
  373.                 {
  374.                     PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
  375.                     GetVehicleParamsEx(meinauto[playerid][i],engine,lights,alarm,doors,bonnet,boot,objective);
  376.                     SetVehicleParamsEx(meinauto[playerid][i],engine,lights,alarm,true,bonnet,boot,objective);
  377.                     GameTextForPlayer(playerid, "~w~Fahrzeug ~r~abgeschlossen", 3000, 6);
  378.                     carlock[meinauto[playerid][i]] = true;
  379.                 }
  380.                 else
  381.                 {
  382.                     PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
  383.                     GetVehicleParamsEx(meinauto[playerid][i],engine,lights,alarm,doors,bonnet,boot,objective);
  384.                     SetVehicleParamsEx(meinauto[playerid][i],engine,lights,alarm,false,bonnet,boot,objective);
  385.                     GameTextForPlayer(playerid, "~w~Fahrzeug ~g~aufgeschlossen", 3000, 6);
  386.                     carlock[meinauto[playerid][i]] = false;
  387.                 }
  388.             }
  389.             else
  390.             {
  391.                 inveh = 1;
  392.                 continue;
  393.             }
  394.         }
  395.         if(inveh == 1)
  396.         {
  397.             SendClientMessage(playerid,FARBE_AUTOHAUS0,"*Für dieses Auto besitzt du keine Schlüssel!");
  398.         }
  399.         return 1;
  400.     }
  401.     if(strcmp(cmdtext, "/carsell", true) == 0)
  402.     {
  403.         new inveh = 0;
  404.         for(new i = 0;i < MAX_PLAYER_CARS;i++)
  405.         {
  406.             if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,FARBE_AUTOHAUS0,"*Du musst in deinem Auto sitzen!");
  407.             new vehicleid = GetPlayerVehicleID(playerid);
  408.             if(vehicleid == meinauto[playerid][i])
  409.             {
  410.                 new Car[100];
  411.                 format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",playername(playerid),i);
  412.                 dini_Remove(Car);
  413.                 DestroyVehicle(meinauto[playerid][i]);
  414.                 GivePlayerMoney(playerid,Autos[playerid][i][preis]/4);
  415.                 SendClientMessage(playerid,FARBE_AUTOHAUS1,"*Du hast dein Auto verkauft und ein viertel des Kaufpreises zurück bekommen.");
  416.             }
  417.             else
  418.             {
  419.                 inveh = 1;
  420.                 continue;
  421.             }
  422.         }
  423.         if(inveh == 1)
  424.         {
  425.             SendClientMessage(playerid,FARBE_AUTOHAUS0,"*Für dieses Auto besitzt du keine Schlüssel!");
  426.         }
  427.         return 1;
  428.     }
  429.     return 0;
  430. }
  431. public OnPlayerStateChange(playerid, newstate, oldstate)
  432. {
  433.     if(newstate == PLAYER_STATE_DRIVER)
  434.     {
  435.         for(new i = 0; i < sizeof BuyCars;i++)
  436.         {
  437.             if(GetPlayerVehicleID(playerid) == KaufAutos[i])
  438.             {
  439.                 new string[150];
  440.                 format(string, sizeof(string),"Möchtest sie dieses Fahrzeug kaufen?\nName: %s\nPreis: %d",BuyCars[i][Name],BuyCars[i][preis]);
  441.                 TogglePlayerControllable(playerid,0);
  442.                 return ShowPlayerDialog(playerid,Autokauf,DIALOG_STYLE_MSGBOX,"Autokauf",string,"Kaufen","Abbrechen");
  443.             }
  444.         }
  445.     }
  446.     return 1;
  447. }
  448. public OnVehicleMod(playerid, vehicleid, componentid)
  449. {
  450.     for(new i = 0; i < MAX_PLAYER_CARS;i++)
  451.     {
  452.         if(vehicleid == meinauto[playerid][i])
  453.         {
  454.             new Car[128];
  455.             format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",playername(playerid),i);
  456.             dini_IntSet(Car,"Spoiler",GetVehicleComponentInSlot(meinauto[playerid][i],0));
  457.             dini_IntSet(Car,"Hood",GetVehicleComponentInSlot(meinauto[playerid][i],1));
  458.             dini_IntSet(Car,"Roof",GetVehicleComponentInSlot(meinauto[playerid][i],2));
  459.             dini_IntSet(Car,"Sideskirt",GetVehicleComponentInSlot(meinauto[playerid][i],3));
  460.             dini_IntSet(Car,"Lamps",GetVehicleComponentInSlot(meinauto[playerid][i],4));
  461.             dini_IntSet(Car,"Nitro",GetVehicleComponentInSlot(meinauto[playerid][i],5));
  462.             dini_IntSet(Car,"Exhaust",GetVehicleComponentInSlot(meinauto[playerid][i],6));
  463.             dini_IntSet(Car,"Wheels",GetVehicleComponentInSlot(meinauto[playerid][i],7));
  464.             dini_IntSet(Car,"Stereo",GetVehicleComponentInSlot(meinauto[playerid][i],8));
  465.             dini_IntSet(Car,"Hydraulics",GetVehicleComponentInSlot(meinauto[playerid][i],9));
  466.             dini_IntSet(Car,"FrontBumper",GetVehicleComponentInSlot(meinauto[playerid][i],10));
  467.             dini_IntSet(Car,"RearBumper",GetVehicleComponentInSlot(meinauto[playerid][i],11));
  468.             dini_IntSet(Car,"VentRight",GetVehicleComponentInSlot(meinauto[playerid][i],12));
  469.             dini_IntSet(Car,"VentLeft",GetVehicleComponentInSlot(meinauto[playerid][i],13));
  470.         }
  471.         else continue;
  472.     }
  473.     return 1;
  474. }
  475.  
  476. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  477. {
  478.     for(new i = 0;i < MAX_PLAYER_CARS;i++)
  479.     {
  480.         if(vehicleid == meinauto[playerid][i])
  481.         {
  482.             Autos[playerid][i][Paintjob] = paintjobid;
  483.             new Car[128];
  484.             format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",playername(playerid),i);
  485.             dini_IntSet(Car,"Paintjob",Autos[playerid][i][Paintjob]);
  486.         }
  487.         else continue;
  488.     }
  489.     return 1;
  490. }
  491.  
  492. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  493. {
  494.     for(new i = 0;i < MAX_PLAYER_CARS;i++)
  495.     {
  496.         if(vehicleid == meinauto[playerid][i])
  497.         {
  498.             Autos[playerid][i][Farbe1] = color1;
  499.             Autos[playerid][i][Farbe2] = color2;
  500.             new Car[128];
  501.             format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",playername(playerid),i);
  502.             dini_IntSet(Car,"Farbe1",Autos[playerid][i][Farbe1]);
  503.             dini_IntSet(Car,"Farbe2",Autos[playerid][i][Farbe2]);
  504.         }
  505.         else continue;
  506.     }
  507.     return 1;
  508. }
  509. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  510. {
  511.     if(dialogid == Autokauf)
  512.     {
  513.         for(new i = 0; i < sizeof BuyCars;i++)
  514.         {
  515.             if(response == 0)
  516.             {
  517.                 TogglePlayerControllable(playerid,1);
  518.                 RemovePlayerFromVehicle(playerid);
  519.                 return 1;
  520.             }
  521.             if(response == 1)
  522.             {
  523.                 if(GetPlayerVehicleID(playerid) == KaufAutos[i])
  524.                 {
  525.                     if(GetPlayerMoney(playerid) >= BuyCars[i][preis])
  526.                     {
  527.                         new Car[128];
  528.                         format(Car,sizeof(Car),"/Car/%s's Auto 0.txt",playername(playerid));
  529.                         if(dini_Exists(Car))
  530.                         {
  531.                             new Car1[128];
  532.                             format(Car1,sizeof(Car1),"/Car/%s's Auto 1.txt",playername(playerid));
  533.                             if(dini_Exists(Car1))
  534.                             {
  535.                                 SendClientMessage(playerid,FARBE_AUTOHAUS0,"*Du hast bereits 2 Autos! Verkaufe erst eines mit /carsell.");
  536.                                 RemovePlayerFromVehicle(playerid);
  537.                                 TogglePlayerControllable(playerid,1);
  538.                             }
  539.                             else KaufAuto(playerid,1);
  540.                         }
  541.                         else KaufAuto(playerid,0);
  542.                     }
  543.                     else
  544.                     {
  545.                         SendClientMessage(playerid,FARBE_AUTOHAUS0,"*Du hast nicht genug Geld um dir das Auto zukaufen!");
  546.                         RemovePlayerFromVehicle(playerid);
  547.                         TogglePlayerControllable(playerid,1);
  548.                     }
  549.                 }
  550.             }
  551.         }
  552.     }
  553.     return 1;
  554. }
  555. stock KaufAuto(playerid,autoid)
  556. {
  557.     for(new i = 0; i < sizeof(BuyCars);i++)
  558.     {
  559.         if(GetPlayerVehicleID(playerid) == KaufAutos[i])
  560.         {
  561.             new Car[100];
  562.             format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",playername(playerid),autoid);
  563.             dini_Create(Car);
  564.             dini_Set(Car,"Name",BuyCars[i][Name]);
  565.             dini_IntSet(Car,"modelid",BuyCars[i][modelid]);
  566.             dini_FloatSet(Car,"Car_X",BuyCars[i][kaufx]);
  567.             dini_FloatSet(Car,"Car_Y",BuyCars[i][kaufy]);
  568.             dini_FloatSet(Car,"Car_Z",BuyCars[i][kaufz]);
  569.             dini_FloatSet(Car,"Car_ROT",BuyCars[i][kaufrot]);
  570.             dini_IntSet(Car,"Farbe1",-1);
  571.             dini_IntSet(Car,"Farbe2",-1);
  572.             dini_IntSet(Car,"Paintjob",-1);
  573.             dini_IntSet(Car,"Preis",BuyCars[i][preis]);
  574.             meinauto[playerid][autoid] = CreateVehicle(BuyCars[i][modelid],BuyCars[i][kaufx],BuyCars[i][kaufy],BuyCars[i][kaufz],BuyCars[i][kaufrot],-1,-1,-1);
  575.             dini_IntSet(Car,"Spoiler",GetVehicleComponentInSlot(meinauto[playerid][autoid],0));
  576.             dini_IntSet(Car,"Hood",GetVehicleComponentInSlot(meinauto[playerid][autoid],1));
  577.             dini_IntSet(Car,"Roof",GetVehicleComponentInSlot(meinauto[playerid][autoid],2));
  578.             dini_IntSet(Car,"Sideskirt",GetVehicleComponentInSlot(meinauto[playerid][autoid],3));
  579.             dini_IntSet(Car,"Lamps",GetVehicleComponentInSlot(meinauto[playerid][autoid],4));
  580.             dini_IntSet(Car,"Nitro",GetVehicleComponentInSlot(meinauto[playerid][autoid],5));
  581.             dini_IntSet(Car,"Exhaust",GetVehicleComponentInSlot(meinauto[playerid][autoid],6));
  582.             dini_IntSet(Car,"Wheels",GetVehicleComponentInSlot(meinauto[playerid][autoid],7));
  583.             dini_IntSet(Car,"Stereo",GetVehicleComponentInSlot(meinauto[playerid][autoid],8));
  584.             dini_IntSet(Car,"Hydraulics",GetVehicleComponentInSlot(meinauto[playerid][autoid],9));
  585.             dini_IntSet(Car,"FrontBumper",GetVehicleComponentInSlot(meinauto[playerid][autoid],10));
  586.             dini_IntSet(Car,"RearBumper",GetVehicleComponentInSlot(meinauto[playerid][autoid],11));
  587.             dini_IntSet(Car,"VentRight",GetVehicleComponentInSlot(meinauto[playerid][autoid],12));
  588.             dini_IntSet(Car,"VentLeft",GetVehicleComponentInSlot(meinauto[playerid][autoid],13));
  589.             RemovePlayerFromVehicle(playerid);
  590.             TogglePlayerControllable(playerid,1);
  591.             GivePlayerMoney(playerid,-BuyCars[i][preis]);
  592.             Autos[playerid][autoid][preis] = dini_Int(Car,"Preis");
  593.             Autos[playerid][autoid][modelid] = dini_Int(Car,"modelid");
  594.             Autos[playerid][autoid][Farbe1] = dini_Int(Car,"Farbe1");
  595.             Autos[playerid][autoid][Farbe2] = dini_Int(Car,"Farbe2");
  596.             Autos[playerid][autoid][Paintjob] = dini_Int(Car,"Paintjob");
  597.             Autos[playerid][autoid][Park_x] = dini_Int(Car,"posx");
  598.             Autos[playerid][autoid][Park_y] = dini_Int(Car,"posy");
  599.             Autos[playerid][autoid][Park_z] = dini_Int(Car,"posz");
  600.             Autos[playerid][autoid][Park_rot] = dini_Int(Car,"posa");
  601.             Autos[playerid][autoid][Spoiler] = dini_Int(Car,"Spoiler");
  602.             Autos[playerid][autoid][Wheels] = dini_Int(Car,"Wheels");
  603.             Autos[playerid][autoid][Nitro] = dini_Int(Car,"Nitro");
  604.             Autos[playerid][autoid][Roof] = dini_Int(Car,"Roof");
  605.             Autos[playerid][autoid][Hood] = dini_Int(Car,"Hood");
  606.             Autos[playerid][autoid][Sideskirt] = dini_Int(Car,"Sideskirt");
  607.             Autos[playerid][autoid][Lamps] = dini_Int(Car,"Lamps");
  608.             Autos[playerid][autoid][Exhaust] = dini_Int(Car,"Exhaust");
  609.             Autos[playerid][autoid][Stereo] = dini_Int(Car,"Stereo");
  610.             Autos[playerid][autoid][Hydraulics] = dini_Int(Car,"Hydraulics");
  611.             Autos[playerid][autoid][VentRight] = dini_Int(Car,"VentRight");
  612.             Autos[playerid][autoid][VentLeft] = dini_Int(Car,"VentLeft");
  613.             Autos[playerid][autoid][FrontBumper] = dini_Int(Car,"FrontBumper");
  614.             Autos[playerid][autoid][RearBumper] = dini_Int(Car,"RearBumper");
  615.             GetVehicleParamsEx(meinauto[playerid][autoid],engine,lights,alarm,doors,bonnet,boot,objective);
  616.             SetVehicleParamsEx(meinauto[playerid][autoid],engine,lights,alarm,true,bonnet,boot,objective);
  617.             carlock[meinauto[playerid][autoid]] = true;
  618.         }
  619.     }
  620. }
  621. stock playername(playerid)
  622. {
  623.     new name[MAX_PLAYER_NAME];
  624.     GetPlayerName(playerid,name,sizeof(name));
  625.     return name;
  626. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement