Advertisement
Guest User

Untitled

a guest
Oct 27th, 2011
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 57.84 KB | None | 0 0
  1. /*
  2. LLLLL       VVVVV                          VVVVV
  3. LLLLL        VVVVV                        VVVVV
  4. LLLLL         VVVVV                      VVVVV
  5. LLLLL          VVVVV                    VVVVV
  6. LLLLL           VVVVV                  VVVVV
  7. LLLLL            VVVVV                VVVVV
  8. LLLLL             VVVVV              VVVVV
  9. LLLLL              VVVVV            VVVVV
  10. LLLLL               VVVVV          VVVVV
  11. LLLLL                VVVVV        VVVVV
  12. LLLLL                 VVVVV      VVVVV
  13. LLLLL                  VVVVV    VVVVV
  14. LLLLLLLLLLLLLLLLLLL     VVVVVVVVVVVV
  15. LLLLLLLLLLLLLLLLLLL      VVVVVVVVVV
  16. LLLLLLLLLLLLLLLLLLL       VVVVVVVV
  17. LITE                     VEHICLEOWNERSHIP
  18.  
  19. by
  20.  
  21. RRRRRRRRRRRRRRRRRR            GGGGGGGGGGGGGGGGGGGGG
  22. RRRRRRRRRRRRRRRRRRR          GGGGGGGGGGGGGGGGGGGGGGGG
  23. RRRRRRRRRRRRRRRRRRRRR       GGGGGGGGGGGGGGGGGGGGGGGGGG
  24. RRRRRRR         RRRRRRR     GGGGGGGGG
  25. RRRRRRR         RRRRRRR     GGGGGGGG
  26. RRRRRRR         RRRRRRR     GGGGGGG
  27. RRRRRRR         RRRRRRR     GGGGGGG
  28. RRRRRRRRRRRRRRRRRRRRR       GGGGGGG
  29. RRRRRRRRRRRRRRRRRRR         GGGGGGG         GGGGGGGGGG
  30. RRRRRRRRRRRRRRRRRR          GGGGGGG         GGGGGGGGGGG
  31. RRRRRRR   RRRRRRR           GGGGGGG         GGGGGGGGGGG
  32. RRRRRRR    RRRRRRR          GGGGGGG             GGGGGGG
  33. RRRRRRR     RRRRRRR         GGGGGGGG            GGGGGGG
  34. RRRRRRR      RRRRRRR        GGGGGGGGG           GGGGGGG
  35. RRRRRRR       RRRRRRR       GGGGGGGGGGGGGGGGGGGGGGGGGG
  36. RRRRRRR        RRRRRRR       GGGGGGGGGGGGGGGGGGGGGGGG
  37. RRRRRRR         RRRRRRR       GGGGGGGGGGGGGGGGGGGGG
  38.  
  39. Vehicleownership lite v1.2.2 (C), RealGamer // STABLE BUILD
  40.  
  41. */
  42. #include a_samp
  43. #include dini
  44. #include a_http
  45. //FARBEN
  46. #define ROT 0xAA3333AA
  47. #define GREEN 0x33AA33AA
  48. #define BLUE 0xFFFFFFFF
  49. // DIALOGE
  50. #define DIALOG_BUY 512
  51. #define DIALOG_CONFIG 513
  52. #define DIALOG_SETOWNER 514
  53. #define DIALOG_KEYSETTINGS 515
  54. #define DIALOG_EDITVEH 516
  55. #define DIALOG_EDIT 517
  56. #define DIALOG_EDITFUNC 518
  57. #define editfunctions "Gewählte FahrzeugID: %d\nModell: %s\nFarbe1: %d\nFarbe2: %d\nBesitzer: %s\nWert: %d"
  58. // EINSTELLUNGEN
  59. #define MAX_KEYS 10 // Definiere die maximale Anzahl an Keys
  60. #define MAX_NOM 20 // Definiere die maximale Länge der Namen
  61. #define MAX_OWNEDVEHICLES 200 // Definiere die maximale Anzahl an verkaufbaren Fahrzeugen
  62. #define drawdistance 10.0 // Definiere die Drawdistanz für die 3D Texte
  63. #define AUTOHAUS // Definiere, ob das Autohaus aktiv sein soll
  64. #define MOTORSYSTEM // Definiere, falls du KEIN Motorsystem besitzt
  65. #define MODVERSION 1.2
  66. //#define TESTMODE
  67. #define Function%0(%1) forward%0(%1); public%0(%1)
  68. #define DIFF 2.0
  69. #define CAMSPEED 1.0
  70. // NEW & ENUM
  71. new IsEngineOn[MAX_VEHICLES];
  72. new AreLightsOn[MAX_VEHICLES];
  73. new IsKaufbaresAuto[MAX_VEHICLES];
  74. new Emptyfile;
  75. enum pInfo
  76. {
  77.     SelectedVeh,
  78.     ChosenField,
  79.     liveview,
  80.     LiveViewPos,
  81.     CurrVeh,
  82.     CurrVehID,
  83.     #if defined AUTOHAUS
  84.     Text:Textdraw0,
  85.     Text:Textdraw3,
  86.     autokauf,
  87.     #endif
  88.     Float:PlayerPosX,
  89.     Float:PlayerPosY,
  90.     Float:PlayerPosZ
  91. }
  92. new SpielerData[MAX_PLAYERS][pInfo];
  93. enum CarInfo
  94. {
  95.     ID,Model,Col1,Col2,
  96.     Owner[MAX_NOM],Price,
  97.     Keys[MAX_KEYS*MAX_NOM],
  98.     Locked,Float:SpawnX,
  99.     Float:SpawnY,Float:SpawnZ,
  100.     Float:SpawnRot,Text3D:dtext,
  101.     mod1,mod2,mod3,mod4,
  102.     mod5,mod6,mod7,mod8,
  103.     mod9,mod10,mod11,
  104.     mod12,mod13,mod14,
  105.     mod15,mod16,mod17,
  106.     VehSkin
  107. }
  108. new AutoData[MAX_VEHICLES][CarInfo];
  109. #if defined AUTOHAUS
  110. #tryinclude CameraMoving
  111.     #if !defined MovePlayerCamera
  112.     #define ERROR 1
  113.     #undef AUTOHAUS
  114.     #endif
  115. #endif
  116.  
  117.  
  118. #if defined AUTOHAUS
  119. new Text:Textdraw1,Text:Textdraw2,
  120.     Text:Textdraw4,Text:Textdraw5,
  121.     Text:Textdraw6,Text:Textdraw7,
  122.     Text:Textdraw8,Text:Textdraw9,
  123.     Text:Textdraw10,Text:Textdraw11,
  124.     Text:Textdraw12,Text:Textdraw13;
  125. enum AutoHausInformation
  126. {
  127.     Float:PosX,
  128.     Float:PosY,
  129.     Float:PosZ,
  130.     Float:VehSpawnX,
  131.     Float:VehSpawnY,
  132.     Float:VehSpawnZ,
  133.     Float:VehSpawnRot,
  134.     Text3D:Label,
  135.     Pickup
  136. }
  137. new AutoHausInfo[AutoHausInformation];
  138. enum OwnerCarInfo
  139. {
  140.     model1,
  141.     price1
  142. }
  143. new OwnerVehicleInfo[][OwnerCarInfo] = { // Adde neue Fahrzeuge hier, Aufbau: {AUTOMODEL,PREIS}
  144.         {423,5344},
  145.         {411,50244},
  146.         {420,4319},
  147.         {560,66125},
  148.         {520,1000000}
  149. };
  150. new Float:LiveViewCoords[][] = {
  151. {2061.8957519531,2428.55859375,49.5234375}, // Position für Spieler (Im Hintergrund, dient lediglich dafür, dass das Fahrzeug eingestreamt ist)
  152. {2091.6440429688,2407.1145019531,49.5234375}, // Position für Fahrzeug ID: 1
  153. {2088.2592773438,2426.8110351563,51.4299774}, // Position für 1.Start MovePlayerCamera ID: 2
  154. {2088.2592773438,2388.9240722656,51.4299774}, // Position für 1.Ziel MovePlayerCamera ID: 3
  155. {2095.8930664063,2388.9240722656,51.4299774}, // Position für 2.Start MovePlayerCamera ID: 4
  156. {2095.8930664063,2426.8110351563,51.4299774} // Position für 2.Ziel MovePlayerCamera ID: 5
  157. };
  158. #endif
  159. new VehicleNames[212][] = {
  160.         "Landstalker","Bravura","Buffalo","Linerunner","Perrenial","Sentinel",
  161.         "Dumper","Firetruck","Trashmaster","Stretch","Manana","Infernus","Voodoo",
  162.         "Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto","Taxi",
  163.         "Washington","Bobcat","Mr. Whoopee","BF. Injection","Hunter","Premier","Enforcer",
  164.         "Securicar","Banshee","Predator","Bus","Rhino","Barracks","Hotknife","Article Trailer",
  165.         "Previon","Coach","Cabbie","Stallion","Rumpo","RC Bandit","Romero","Packer","Monster",
  166.         "Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Article Trailer 2","Turismo","Speeder",
  167.         "Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer",
  168.         "PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic","Sanchez",
  169.         "Sparrow","Patriot","Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR-350",
  170.         "Walton","Regina","Comet","BMX","Burrito","Camper","Marquis","Baggage","Dozer",
  171.         "Maverick","News Chopper","Rancher","FBI Rancher","Virgo","Greenwood","Jetmax","Hotring",
  172.         "Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa","RC Goblin",
  173.         "Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT","Elegant",
  174.         "Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","Roadtrain",
  175.         "Nebula","Majestic","Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000",
  176.         "Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck","Willard","Forklift",
  177.         "Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight","Streak",
  178.         "Vortex","Vincent","Bullet","Clover","Sadler","Firetruck LA","Hustler","Intruder",
  179.         "Primo","Cargobob","Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor",
  180.         "Monster A","Monster B","Uranus","Jester","Sultan","Stratum","Elegy","Raindance",
  181.         "RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight Flat","Streak Carriage",
  182.         "Kart","Mower","Dunerider","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley",
  183.         "Stafford","BF-400","Newsvan","Tug","Article Trailer 3","Emperor","Wayfarer","Euros","Mobile Hotdog",
  184.         "Club","Freight Carriage","Trailer 3","Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)",
  185.         "Police Car (SFPD)","Police Car (LVPD)","Police Ranger","Picador","S.W.A.T Van","Alpha",
  186.         "Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B","Stair Trailer",
  187.         "Boxville","Farm Plow","Utility Trailer"
  188. };
  189. new spoiler[20]= {
  190. 1000,1001,1002,1003,1014,1015,1016,1023,1058,
  191. 1060,1049,1050,1138,1139,1146,1147,1158,1162,
  192. 1163,1164};
  193. new nitro[3] = {1008,1009,1010};
  194. new frontbumper[23]= {
  195. 1117,1152,1153,1155,1157,1160,1165,1167,1169,
  196. 1170,1171,1172,1173,1174,1175,1179,1181,1182,
  197. 1185,1188,1189,1192,1193};
  198. new rbumper[22]= {
  199. 1140,1141,1148,1149,1150,1151,1154,1156,1159,
  200. 1161,1166,1168,1176,1177,1178,1180,1183,1184,
  201. 1186,1187,1190,1191};
  202. new exhaust[28]= {
  203. 1018,1019,1020,1021,1022,1028,1029,1037,1043,
  204. 1044,1045,1046,1059,1064,1065,1066,1089,1092,
  205. 1104,1105,1113,1114,1126,1127,1129,1132,1135,
  206. 1136};
  207. new bventr[2]= {1042,1044};
  208. new bventl[2]= {1043,1045};
  209. new bscoop[4]= {1004,1005,1011,1012};
  210. new rscoop[13]= {
  211. 1006,1032,1033,1035,1038,1053,1054,1055,1061,
  212. 1067,1068,1088,1091};
  213. new lskirt[21]= {
  214. 1007,1026,1031,1036,1039,1042,1047,1048,1056,
  215. 1057,1069,1070,1090,1093,1106,1108,1118,1119,
  216. 1133,1122,1134};
  217. new rskirt[21]= {
  218. 1017,1027,1030,1040,1041,1051,1052,1062,1063,
  219. 1071,1072,1094,1095,1099,1101,1102,1107,1120,
  220. 1121,1124,1137};
  221. new hydraulics= 1087;
  222. new base= 1086;
  223. new rbbars[2]= {1109,1110};
  224. new fbbars[2]= {1115,1116};
  225. new wheels[17]= {
  226. 1025,1073,1074,1075,1076,1077,1078,1079,1080,
  227. 1081,1082,1083,1084,1085,1096,1097,1098};
  228. new light[2]= {1013,1024};
  229. public OnFilterScriptInit()
  230. {
  231.     print("\n\n\nRV Vehicleownership wird initialisiert...");
  232.     ManualVehicleEngineAndLights();
  233.     #if defined AUTOHAUS
  234.     print("Lade Autohausdaten...");
  235.     Textdraw1 = TextDrawCreate(0.000000, 0.000000, "Autohaus-Computer");
  236.     TextDrawBackgroundColor(Textdraw1, 255);
  237.     TextDrawFont(Textdraw1, 1);
  238.     TextDrawLetterSize(Textdraw1, 0.619999, 3.099999);
  239.     TextDrawColor(Textdraw1, -1);
  240.     TextDrawSetOutline(Textdraw1, 0);
  241.     TextDrawSetProportional(Textdraw1, 1);
  242.     TextDrawSetShadow(Textdraw1, 1);
  243.     TextDrawUseBox(Textdraw1, 1);
  244.     TextDrawBoxColor(Textdraw1, 255);
  245.     TextDrawTextSize(Textdraw1, 656.000000, 37.000000);
  246.  
  247.     Textdraw2 = TextDrawCreate(-3.000000, 303.000000, "OKPWADJ AWDJO OWAP DJAOIWD A awidOIAW jdA");
  248.     TextDrawBackgroundColor(Textdraw2, 255);
  249.     TextDrawFont(Textdraw2, 1);
  250.     TextDrawLetterSize(Textdraw2, -0.769999, 14.199999);
  251.     TextDrawColor(Textdraw2, 10);
  252.     TextDrawSetOutline(Textdraw2, 0);
  253.     TextDrawSetProportional(Textdraw2, 0);
  254.     TextDrawSetShadow(Textdraw2, 0);
  255.     TextDrawUseBox(Textdraw2, 1);
  256.     TextDrawBoxColor(Textdraw2, 200);
  257.     TextDrawTextSize(Textdraw2, 679.000000, 254.000000);
  258.  
  259.  
  260.     Textdraw4 = TextDrawCreate(-88.000000, 313.000000, "df sd fsdf we fse fsef s");
  261.     TextDrawBackgroundColor(Textdraw4, 255);
  262.     TextDrawFont(Textdraw4, 0);
  263.     TextDrawLetterSize(Textdraw4, 0.050000, 6.399999);
  264.     TextDrawColor(Textdraw4, -1);
  265.     TextDrawSetOutline(Textdraw4, 0);
  266.     TextDrawSetProportional(Textdraw4, 1);
  267.     TextDrawSetShadow(Textdraw4, 1);
  268.     TextDrawUseBox(Textdraw4, 1);
  269.     TextDrawBoxColor(Textdraw4, -1);
  270.     TextDrawTextSize(Textdraw4, 218.000000, 254.000000);
  271.  
  272.     Textdraw5 = TextDrawCreate(245.000000, 315.000000, "Benutze ~r~SHIFT~w~ um das gewaehlte Fahrzeug");
  273.     TextDrawBackgroundColor(Textdraw5, 255);
  274.     TextDrawFont(Textdraw5, 1);
  275.     TextDrawLetterSize(Textdraw5, 0.500000, 1.000000);
  276.     TextDrawColor(Textdraw5, -1);
  277.     TextDrawSetOutline(Textdraw5, 0);
  278.     TextDrawSetProportional(Textdraw5, 1);
  279.     TextDrawSetShadow(Textdraw5, 1);
  280.  
  281.     Textdraw6 = TextDrawCreate(246.000000, 327.000000, "zu kaufen");
  282.     TextDrawBackgroundColor(Textdraw6, 255);
  283.     TextDrawFont(Textdraw6, 1);
  284.     TextDrawLetterSize(Textdraw6, 0.500000, 1.000000);
  285.     TextDrawColor(Textdraw6, -1);
  286.     TextDrawSetOutline(Textdraw6, 0);
  287.     TextDrawSetProportional(Textdraw6, 1);
  288.     TextDrawSetShadow(Textdraw6, 1);
  289.  
  290.     Textdraw7 = TextDrawCreate(247.000000, 339.000000, "Nutze ~r~Numpad Links/Rechts~w~ um die");
  291.     TextDrawBackgroundColor(Textdraw7, 255);
  292.     TextDrawFont(Textdraw7, 1);
  293.     TextDrawLetterSize(Textdraw7, 0.500000, 1.000000);
  294.     TextDrawColor(Textdraw7, -1);
  295.     TextDrawSetOutline(Textdraw7, 0);
  296.     TextDrawSetProportional(Textdraw7, 1);
  297.     TextDrawSetShadow(Textdraw7, 1);
  298.  
  299.     Textdraw8 = TextDrawCreate(249.000000, 352.000000, "einzelnen Fahrzeuge durchzublaettern");
  300.     TextDrawBackgroundColor(Textdraw8, 255);
  301.     TextDrawFont(Textdraw8, 1);
  302.     TextDrawLetterSize(Textdraw8, 0.500000, 1.000000);
  303.     TextDrawColor(Textdraw8, -1);
  304.     TextDrawSetOutline(Textdraw8, 0);
  305.     TextDrawSetProportional(Textdraw8, 1);
  306.     TextDrawSetShadow(Textdraw8, 1);
  307.  
  308.     Textdraw9 = TextDrawCreate(36.000000, 383.000000, "Nutze ~r~F/Enter~w~ um das Autohaus zu verlassen");
  309.     TextDrawBackgroundColor(Textdraw9, 255);
  310.     TextDrawFont(Textdraw9, 1);
  311.     TextDrawLetterSize(Textdraw9, 0.500000, 1.000000);
  312.     TextDrawColor(Textdraw9, -1);
  313.     TextDrawSetOutline(Textdraw9, 0);
  314.     TextDrawSetProportional(Textdraw9, 1);
  315.     TextDrawSetShadow(Textdraw9, 1);
  316.  
  317.     Textdraw10 = TextDrawCreate(0.000000, 30.500000, "L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L\
  318.                                                       L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L ");
  319.     TextDrawBackgroundColor(Textdraw10, 255);
  320.     TextDrawFont(Textdraw10, 1);
  321.     TextDrawLetterSize(Textdraw10, 0.549999, 1.800000);
  322.     TextDrawColor(Textdraw10, 255);
  323.     TextDrawSetOutline(Textdraw10, 0);
  324.     TextDrawSetProportional(Textdraw10, 1);
  325.     TextDrawSetShadow(Textdraw10, 1);
  326.     TextDrawUseBox(Textdraw10, 1);
  327.     TextDrawBoxColor(Textdraw10, 255);
  328.     TextDrawTextSize(Textdraw10, 32.000000, 37.000000);
  329.  
  330.     Textdraw11 = TextDrawCreate(10.000000, 421.000000, "Unten");
  331.     TextDrawBackgroundColor(Textdraw11, 255);
  332.     TextDrawFont(Textdraw11, 1);
  333.     TextDrawLetterSize(Textdraw11, 0.549999, 2.999999);
  334.     TextDrawColor(Textdraw11, 255);
  335.     TextDrawSetOutline(Textdraw11, 0);
  336.     TextDrawSetProportional(Textdraw11, 1);
  337.     TextDrawSetShadow(Textdraw11, 1);
  338.     TextDrawUseBox(Textdraw11, 1);
  339.     TextDrawBoxColor(Textdraw11, 255);
  340.     TextDrawTextSize(Textdraw11, 656.000000, 37.000000);
  341.  
  342.     Textdraw12 = TextDrawCreate(650.000000, 19.500000, "R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ");
  343.     TextDrawBackgroundColor(Textdraw12, 255);
  344.     TextDrawFont(Textdraw12, 1);
  345.     TextDrawLetterSize(Textdraw12, 0.549999, 1.800000);
  346.     TextDrawColor(Textdraw12, 255);
  347.     TextDrawSetOutline(Textdraw12, 0);
  348.     TextDrawSetProportional(Textdraw12, 1);
  349.     TextDrawSetShadow(Textdraw12, 1);
  350.     TextDrawUseBox(Textdraw12, 1);
  351.     TextDrawBoxColor(Textdraw12, 255);
  352.     TextDrawTextSize(Textdraw12, 603.000000, 37.000000);
  353.  
  354.     Textdraw13 = TextDrawCreate(476.000000, 417.000000, "~r~ | ~w~ ||");
  355.     TextDrawBackgroundColor(Textdraw13, 255);
  356.     TextDrawFont(Textdraw13, 1);
  357.     TextDrawLetterSize(Textdraw13, 1.420000, 7.199999);
  358.     TextDrawColor(Textdraw13, -1);
  359.     TextDrawSetOutline(Textdraw13, 0);
  360.     TextDrawSetProportional(Textdraw13, 1);
  361.     TextDrawSetShadow(Textdraw13, 1);
  362.     loadAutoHausInformation();
  363.     AutoHausInfo[Label] = Text3D:-1;
  364.     AutoHausInfo[Pickup] = -1;
  365.     SetTimer("SaveAutoHausInformation",30000,1);
  366.     #endif
  367.     #if defined ERROR
  368.         print("\n\n       WARNUNG: Das Autohaus konnte nicht initialisiert werden,\n        da das Include \"CameraMoving\" nicht implentiert wurde...\n\n");
  369.     #endif
  370.     print("Lade Fahrzeuge...\n\n");
  371.     LoadVehicles();
  372.     print("Suche nach Updates...\nBitte warten\n\n");
  373.     HTTP(0, HTTP_GET, "www.all-web-vserver.de/MyStuff/RVVehicle/index.php", "", "MOD_VERSIONCHECK");
  374.     return 1;
  375. }
  376.  
  377. public OnFilterScriptExit()
  378. {
  379.     #if defined AUTOHAUS
  380.     Delete3DTextLabel(AutoHausInfo[Label]);
  381.     DestroyPickup(AutoHausInfo[Pickup]);
  382.     TextDrawDestroy(Textdraw1);
  383.     TextDrawDestroy(Textdraw2);
  384.     TextDrawDestroy(Textdraw4);
  385.     TextDrawDestroy(Textdraw5);
  386.     TextDrawDestroy(Textdraw6);
  387.     TextDrawDestroy(Textdraw7);
  388.     TextDrawDestroy(Textdraw8);
  389.     TextDrawDestroy(Textdraw9);
  390.     for(new i = 0;i<MAX_PLAYERS;i++)
  391.         if(IsPlayerConnected(i))
  392.         {
  393.             TextDrawDestroy(SpielerData[i][Textdraw0]);
  394.             TextDrawDestroy(SpielerData[i][Textdraw3]);
  395.         }
  396.     #endif
  397.     for(new i = 0;i< MAX_VEHICLES;i++)
  398.         if(IsKaufbaresAuto[i])
  399.         {
  400.             DestroyVehicle(i);
  401.             SaveVehicle(i);
  402.             if(strmatch(AutoData[i][Owner],"Niemand"))
  403.                 Delete3DTextLabel(AutoData[i][dtext]);
  404.         }
  405. }
  406. public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
  407. {
  408.     switch(dialogid)
  409.     {
  410.         case DIALOG_BUY:
  411.         {
  412.             if(response == 1)
  413.             {
  414.                 if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,ROT,"Du befindest dich in keinem Auto");
  415.                 if(!IsKaufbaresAuto[GetPlayerVehicleID(playerid)]) return SendClientMessage(playerid,ROT,"Dieses Auto steht nicht zum Verkauf");
  416.                 if(GetPlayerMoney(playerid) < AutoData[GetPlayerVehicleID(playerid)][Price]) return SendClientMessage(playerid,ROT,"Du hast zuwenig Geld!"),
  417.                                                                                                     RemovePlayerFromVehicle(playerid);
  418.                 GivePlayerMoney(playerid,-AutoData[GetPlayerVehicleID(playerid)][Price]);
  419.                 strmid(AutoData[GetPlayerVehicleID(playerid)][Owner],PlayerName(playerid),0,MAX_NOM,MAX_NOM);
  420.                 SendClientMessage(playerid,GREEN,"Glückwunsch zu Ihrem neuen Fahrzeug!");
  421.                 strmid(AutoData[GetPlayerVehicleID(playerid)][Keys],PlayerName(playerid),0,20,20);
  422.                 SaveVehicle(GetPlayerVehicleID(playerid));
  423.                 Delete3DTextLabel(AutoData[GetPlayerVehicleID(playerid)][dtext]);
  424.             }
  425.             else return RemovePlayerFromVehicle(playerid);
  426.         }
  427.         case DIALOG_CONFIG:
  428.         {
  429.             if(listitem == 1 && response == 1)
  430.                 ShowPlayerDialog(playerid,DIALOG_SETOWNER,DIALOG_STYLE_INPUT,"Besitzer ändern","Geben Sie hier den neuen Besitzer ein:","Bestätigen","Zurück");
  431.  
  432.             if(listitem == 0 && response == 1)
  433.             {
  434.                 new string[1024],Keysplit[MAX_KEYS][MAX_NOM];
  435.                 split(AutoData[GetPlayerVehicleID(playerid)][Keys],Keysplit,',');
  436.                 for(new i=0;i<MAX_KEYS;i++)
  437.                 {
  438.                     if(!strmatch(Keysplit[i],""))
  439.                         format(string,1024,"%s\n%s",string,Keysplit[i]);
  440.                 }
  441.                 format(string,1024,"Um einen Schlüssel hinzuzufügen, tippen Sie den Namen unten ein\nUm einen Schlüssel zu entfernen,\
  442.                 tippen Sie den Namen unten ein\n\n\n------Aktuelle Schlüssel:------\n%s",string);
  443.                 ShowPlayerDialog(playerid,DIALOG_KEYSETTINGS,DIALOG_STYLE_INPUT,"Schlüsselverteilung ändern",string,"Bestätigen","Zurück");
  444.             }
  445.         }
  446.         case DIALOG_KEYSETTINGS:
  447.         {
  448.             if(response == 0) return ShowPlayerDialog(playerid,DIALOG_CONFIG,DIALOG_STYLE_LIST,"Autokonfiguration","Schlüsselverteilung\nBesitzer ändern","Wählen","Verlassen");
  449.             if(HasPlayerKey(inputtext,GetPlayerVehicleID(playerid)))
  450.                 if(RemovePlayerKey(inputtext,GetPlayerVehicleID(playerid)))return SendClientMessage(playerid,GREEN,"Schlüssel erfolgreich entfernt!");
  451.                 else return SendClientMessage(playerid,ROT,"Schlüssel konnte nicht entfernt werden!");
  452.             if(!HasPlayerKey(inputtext,GetPlayerVehicleID(playerid)))
  453.                 if(AddPlayerKey(inputtext,GetPlayerVehicleID(playerid)))return SendClientMessage(playerid,GREEN,"Schlüssel erfolgreich geaddet!");
  454.                 else return SendClientMessage(playerid,ROT,"Schlüssel konnte nicht geaddet werden!");
  455.         }
  456.         case DIALOG_SETOWNER:
  457.         {
  458.             if(response == 0) return ShowPlayerDialog(playerid,DIALOG_CONFIG,DIALOG_STYLE_LIST,"Autokonfiguration","Schlüsselverteilung\nBesitzer ändern","Wählen","Verlassen");
  459.             strmid(AutoData[GetPlayerVehicleID(playerid)][Owner],inputtext,0,20,20);
  460.             SaveVehicle(GetPlayerVehicleID(playerid));
  461.             SendClientMessage(playerid,GREEN,"Du hast den Besitzer erfolgreich geändert!");
  462.         }
  463.         case DIALOG_EDITVEH:
  464.         {
  465.             new string1[128],string2[128],id=strval(inputtext);
  466.             format(string1,128,"FahrzeugID %d",id);
  467.             format(string2,128,editfunctions,id,GetVehicleModelName(id),AutoData[id][Col1],AutoData[id][Col2],AutoData[id][Owner],AutoData[id][Price]);
  468.             if(!IsKaufbaresAuto[id]) return SendClientMessage(playerid,ROT,"Dieses Auto kann nicht bearbeitet werden!");
  469.             SpielerData[playerid][SelectedVeh]=id;
  470.             ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,string1,string2,"Wählen","Zurück");
  471.         }
  472.         case DIALOG_EDIT:
  473.         {
  474.             if(response == 1)
  475.             {
  476.                 if(listitem == 0)
  477.                 {
  478.                     new string1[128],string2[128],id=SpielerData[playerid][SelectedVeh];
  479.                     format(string1,128,"FahrzeugID %d",id);
  480.                     format(string2,128,editfunctions,id,GetVehicleModelName(id),AutoData[id][Col1],AutoData[id][Col2],AutoData[id][Owner],AutoData[id][Price]);
  481.                     if(!IsKaufbaresAuto[id]) return SendClientMessage(playerid,ROT,"Dieses Auto kann nicht bearbeitet werden!");
  482.                     return ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,string1,string2,"Wählen","Zurück");
  483.                 }
  484.                 ShowPlayerDialog(playerid,DIALOG_EDITFUNC,DIALOG_STYLE_INPUT,"Eingabe","Geben Sie nun einen neuen Wert ein:","Bestätigen","Zurück");
  485.                 return SpielerData[playerid][ChosenField]=listitem;
  486.             }
  487.         }
  488.         case DIALOG_EDITFUNC:
  489.         {
  490.             if(response == 1)
  491.             {
  492.                 new newvalue = strval(inputtext),vehid = SpielerData[playerid][SelectedVeh],string1[128],string2[128];
  493.                 switch(SpielerData[playerid][ChosenField])
  494.                 {
  495.                     case 1: AutoData[vehid][Model] = newvalue;
  496.                     case 2: AutoData[vehid][Col1] = newvalue;
  497.                     case 3: AutoData[vehid][Col2] = newvalue;
  498.                     case 4:
  499.                     {
  500.                         if(strmatch(AutoData[vehid][Owner],"Niemand"))
  501.                             Delete3DTextLabel(AutoData[vehid][dtext]);
  502.                         strmid(AutoData[vehid][Owner],inputtext,0,strlen(inputtext),MAX_NOM);
  503.                     }
  504.                     case 5: AutoData[vehid][Price] = newvalue;
  505.                 }
  506.                 format(string1,128,"FahrzeugID %d",vehid);
  507.                 format(string2,128,editfunctions,vehid,GetVehicleModelName(vehid),AutoData[vehid][Col1],AutoData[vehid][Col2],AutoData[vehid][Owner],AutoData[vehid][Price]);
  508.                 if(!IsKaufbaresAuto[vehid]) return SendClientMessage(playerid,ROT,"Dieses Auto kann nicht bearbeitet werden!");
  509.                 ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,string1,string2,"Wählen","Zurück");
  510.                 RespawnVehicle(vehid);
  511.             }
  512.             if(response == 0) return  ShowPlayerDialog(playerid,DIALOG_EDITVEH,DIALOG_STYLE_INPUT,"Fahrzeug-Bearbeitung","Bitte geben Sie die zu\
  513.                                                                                                     bearbeitende Fahrzeug ID ein:","Absenden","Abbrechen");
  514.         }
  515.     }
  516.     return 0;
  517. }
  518. public OnPlayerDisconnect(playerid)
  519. {
  520.     #if defined AUTOHAUS
  521.     TextDrawDestroy(SpielerData[playerid][Textdraw0]);
  522.     TextDrawDestroy(SpielerData[playerid][Textdraw3]);
  523.     TogglePlayerLiveView(playerid);
  524.     #endif
  525.     SpielerData[playerid][SelectedVeh] = 0;
  526.     SpielerData[playerid][liveview] = 0;
  527.     SpielerData[playerid][LiveViewPos] = 0;
  528.     SpielerData[playerid][CurrVeh] = 0;
  529.     SpielerData[playerid][CurrVehID] = 0;
  530.     return 1;
  531. }
  532. #if defined AUTOHAUS
  533. public OnPlayerEnterCheckpoint(playerid)if(SpielerData[playerid][autokauf] == 1)return DisablePlayerCheckpoint(playerid)&(SpielerData[playerid][autokauf] = 0);
  534.     else return 0;
  535. public OnPlayerConnect(playerid)return CreatePlayersTextDraws(playerid);
  536. stock CreatePlayersTextDraws(playerid)
  537. {
  538.     // Erstelle die textdraws:
  539.     SpielerData[playerid][Textdraw0] = TextDrawCreate(36.000000, 339.000000, "Preis:");
  540.     TextDrawBackgroundColor(SpielerData[playerid][Textdraw0], 255);
  541.     TextDrawFont(SpielerData[playerid][Textdraw0], 1);
  542.     TextDrawLetterSize(SpielerData[playerid][Textdraw0], 0.430000, 2.200000);
  543.     TextDrawColor(SpielerData[playerid][Textdraw0], -1);
  544.     TextDrawSetOutline(SpielerData[playerid][Textdraw0], 0);
  545.     TextDrawSetProportional(SpielerData[playerid][Textdraw0], 1);
  546.     TextDrawSetShadow(SpielerData[playerid][Textdraw0], 1);
  547.    
  548.     SpielerData[playerid][Textdraw3] = TextDrawCreate(35.000000, 319.000000, "Modell:");
  549.     TextDrawBackgroundColor(SpielerData[playerid][Textdraw3], 255);
  550.     TextDrawFont(SpielerData[playerid][Textdraw3], 1);
  551.     TextDrawLetterSize(SpielerData[playerid][Textdraw3], 0.430000, 2.200000);
  552.     TextDrawColor(SpielerData[playerid][Textdraw3], -1);
  553.     TextDrawSetOutline(SpielerData[playerid][Textdraw3], 0);
  554.     TextDrawSetProportional(SpielerData[playerid][Textdraw3], 1);
  555.     TextDrawSetShadow(SpielerData[playerid][Textdraw3], 1);
  556.     return 1;
  557. }
  558. stock ShowPlayerAutohausVehicle(playerid,count)
  559. {
  560.     if(SpielerData[playerid][liveview] != 1) return 0;
  561.     new chosenveh = SpielerData[playerid][CurrVeh]+count;
  562.     SpielerData[playerid][CurrVeh]+=count;
  563.     DestroyVehicle(SpielerData[playerid][CurrVehID]);
  564.     SpielerData[playerid][CurrVehID] = CreateVehicle(OwnerVehicleInfo[chosenveh][model1],
  565.     LiveViewCoords[1][0],LiveViewCoords[1][1],LiveViewCoords[1][2],0.0,0,0,-1);
  566.     SetVehicleVirtualWorld(SpielerData[playerid][CurrVehID],playerid+1);
  567.     new tmpstring[64];
  568.     format(tmpstring,64,"Preis: %d$",OwnerVehicleInfo[chosenveh][price1]);
  569.     TextDrawSetString(SpielerData[playerid][Textdraw0],tmpstring);
  570.     format(tmpstring,64,"Modell: %s",GetVehicleModelName(SpielerData[playerid][CurrVehID]));
  571.     TextDrawSetString(SpielerData[playerid][Textdraw3],tmpstring);
  572.     return 1;
  573. }
  574. stock loadAutoHausInformation()// PLATZHALTER: DELETE
  575. {
  576.     new formatLD[256];
  577.     format(formatLD,256,"Cars/AutohausInformation.cfg");
  578.     if(dini_Exists(formatLD))
  579.     {
  580.         AutoHausInfo[PosX] = dini_Float(formatLD,"PosX");
  581.         AutoHausInfo[PosY] = dini_Float(formatLD,"PosY");
  582.         AutoHausInfo[PosZ] = dini_Float(formatLD,"PosZ");
  583.         AutoHausInfo[VehSpawnX] = dini_Float(formatLD,"VehSpawnX");
  584.         AutoHausInfo[VehSpawnY] = dini_Float(formatLD,"VehSpawnY");
  585.         AutoHausInfo[VehSpawnZ] = dini_Float(formatLD,"VehSpawnZ");
  586.         AutoHausInfo[VehSpawnRot] = dini_Float(formatLD,"VehSpawnRot");
  587.         AutoHausInfo[Label] = Create3DTextLabel("Tippe hier /autohaus\num zur Autoauswahl\nzu gelangen",BLUE,
  588.         AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],drawdistance,0,1);
  589.         AutoHausInfo[Pickup] = CreatePickup(1239,1,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],0);
  590.     }
  591.     else
  592.     {
  593.         dini_Create(formatLD);
  594.     }
  595.     return 1;
  596. }
  597. stock loadAutoHausInformations() // PLATZHALTER: GO ON
  598. {
  599.     new formatLD[256];
  600.     for(new i = 0;i < MAX_AUTOHAUSES;i++)
  601.     {
  602.         format(formatLD,256,"Cars/Ownership_%d.cfg",i);
  603.         if(dini_Exists(formatLD))
  604.         {
  605.             AutoHausInfoNew[i][PosX] = dini_Float(formatLD,"PosX");
  606.             AutoHausInfoNew[i][PosY] = dini_Float(formatLD,"PosY");
  607.             AutoHausInfoNew[i][PosZ] = dini_Float(formatLD,"PosZ");
  608.             AutoHausInfoNew[i][VehSpawnX] = dini_Float(formatLD,"VehSpawnX");
  609.             AutoHausInfoNew[i][VehSpawnY] = dini_Float(formatLD,"VehSpawnY");
  610.             AutoHausInfoNew[i][VehSpawnZ] = dini_Float(formatLD,"VehSpawnZ");
  611.             AutoHausInfoNew[i][VehSpawnRot] = dini_Float(formatLD,"VehSpawnRot");
  612.             AutoHausInfoNew[i][VehSpawnRot] = Create3DTextLabel("Tippe hier /autohaus\num zur Autoauswahl\nzu gelangen",BLUE,
  613.             AutoHausInfoNew[i][PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],drawdistance,0,1);
  614.             AutoHausInfoNew[i][Pickup] = CreatePickup(1239,1,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],0);
  615.         }
  616.     }
  617.     return 1;
  618. }
  619. Function SaveAutoHausInformation()
  620. {
  621.     new formatLD[256];
  622.     format(formatLD,256,"Cars/AutohausInformation.cfg");
  623.     if(dini_Exists(formatLD))
  624.     {
  625.         dini_FloatSet(formatLD,"PosX",AutoHausInfo[PosX]);
  626.         dini_FloatSet(formatLD,"PosY",AutoHausInfo[PosY]);
  627.         dini_FloatSet(formatLD,"PosZ",AutoHausInfo[PosZ]);
  628.         dini_FloatSet(formatLD,"VehSpawnX",AutoHausInfo[VehSpawnX]);
  629.         dini_FloatSet(formatLD,"VehSpawnY",AutoHausInfo[VehSpawnY]);
  630.         dini_FloatSet(formatLD,"VehSpawnZ",AutoHausInfo[VehSpawnZ]);
  631.         dini_FloatSet(formatLD,"VehSpawnRot",AutoHausInfo[VehSpawnRot]);
  632.     }
  633.     else
  634.     {
  635.         dini_Create(formatLD);
  636.     }
  637. }
  638. stock TogglePlayerLiveView(playerid,toggle = 0)
  639. {
  640.     if(toggle == 0)
  641.     {
  642.         SetPlayerVirtualWorld(playerid,0);
  643.         SetPlayerInterior(playerid,0);
  644.         SetPlayerPos(playerid,SpielerData[playerid][PlayerPosX],SpielerData[playerid][PlayerPosY],SpielerData[playerid][PlayerPosZ]);
  645.         DestroyVehicle(SpielerData[playerid][CurrVehID]);
  646.         SpielerData[playerid][liveview] = 0;
  647.         SpielerData[playerid][LiveViewPos] = 1;
  648.         SpielerData[playerid][CurrVehID] = -1;
  649.         PauseCameraMoving(playerid);
  650.         SetCameraBehindPlayer(playerid);
  651.         TextDrawHideForPlayer(playerid,SpielerData[playerid][Textdraw0]);
  652.         TextDrawHideForPlayer(playerid,Textdraw1);
  653.         TextDrawHideForPlayer(playerid,Textdraw2);
  654.         TextDrawHideForPlayer(playerid,SpielerData[playerid][Textdraw3]);
  655.         TextDrawHideForPlayer(playerid,Textdraw4);
  656.         TextDrawHideForPlayer(playerid,Textdraw5);
  657.         TextDrawHideForPlayer(playerid,Textdraw6);
  658.         TextDrawHideForPlayer(playerid,Textdraw7);
  659.         TextDrawHideForPlayer(playerid,Textdraw8);
  660.         TextDrawHideForPlayer(playerid,Textdraw9);
  661.         TextDrawHideForPlayer(playerid,Textdraw10);
  662.         TextDrawHideForPlayer(playerid,Textdraw11);
  663.         TextDrawHideForPlayer(playerid,Textdraw12);
  664.         TextDrawHideForPlayer(playerid,Textdraw13);
  665.         TogglePlayerControllable(playerid,1);
  666.         return 1;
  667.     }
  668.     else
  669.     {
  670.         GetPlayerPos(playerid,SpielerData[playerid][PlayerPosX],SpielerData[playerid][PlayerPosY],SpielerData[playerid][PlayerPosZ]);
  671.         SetPlayerVirtualWorld(playerid,playerid+1);
  672.         SetPlayerInterior(playerid,0);
  673.         SetPlayerPos(playerid,LiveViewCoords[0][0],LiveViewCoords[0][1],LiveViewCoords[0][2]);
  674.         SpielerData[playerid][liveview] = 1;
  675.         SpielerData[playerid][LiveViewPos] = 2;
  676.         TextDrawShowForPlayer(playerid,SpielerData[playerid][Textdraw0]);
  677.         TextDrawShowForPlayer(playerid,Textdraw1);
  678.         TextDrawShowForPlayer(playerid,Textdraw2);
  679.         TextDrawShowForPlayer(playerid,SpielerData[playerid][Textdraw3]);
  680.         TextDrawShowForPlayer(playerid,Textdraw4);
  681.         TextDrawShowForPlayer(playerid,Textdraw5);
  682.         TextDrawShowForPlayer(playerid,Textdraw6);
  683.         TextDrawShowForPlayer(playerid,Textdraw7);
  684.         TextDrawShowForPlayer(playerid,Textdraw8);
  685.         TextDrawShowForPlayer(playerid,Textdraw9);
  686.         TextDrawShowForPlayer(playerid,Textdraw10);
  687.         TextDrawShowForPlayer(playerid,Textdraw11);
  688.         TextDrawShowForPlayer(playerid,Textdraw12);
  689.         TextDrawShowForPlayer(playerid,Textdraw13);
  690.         ShowPlayerAutohausVehicle(playerid,0);
  691.         PauseCameraMoving(playerid);
  692.         SetPlayerCameraPos(playerid,LiveViewCoords[2][0],LiveViewCoords[2][1],LiveViewCoords[2][2]);
  693.         MovePlayerCameraEx(playerid,LiveViewCoords[2][0],LiveViewCoords[2][1],LiveViewCoords[2][2],
  694.         LiveViewCoords[3][0],LiveViewCoords[3][1],LiveViewCoords[3][2],LiveViewCoords[1][0],
  695.         LiveViewCoords[1][1],LiveViewCoords[1][2]-DIFF,CAMSPEED);
  696.         TogglePlayerControllable(playerid,0);
  697.         return 1;
  698.     }
  699. }
  700.  
  701. public OnCameraMoveFinish(playerid)
  702. {
  703.     if(SpielerData[playerid][liveview] == 1)
  704.     {
  705.             new Pos = (SpielerData[playerid][LiveViewPos] == 2) ? 4 : 2;
  706.             MovePlayerCameraEx(playerid, LiveViewCoords[Pos][0],LiveViewCoords[Pos][1],LiveViewCoords[Pos][2],
  707.             LiveViewCoords[Pos+1][0],LiveViewCoords[Pos+1][1],LiveViewCoords[Pos+1][2],LiveViewCoords[1][0],
  708.             LiveViewCoords[1][1],LiveViewCoords[1][2]-DIFF,CAMSPEED);
  709.             return SpielerData[playerid][LiveViewPos] = (Pos == 4) ? 1 : 2;
  710.     }
  711.     else return TogglePlayerLiveView(playerid);
  712. }
  713. /*
  714. public OnCameraMoveFinish(playerid)
  715. {
  716.     if(SpielerData[playerid][liveview] == 1)
  717.     {
  718.         if(SpielerData[playerid][LiveViewPos] == 2)
  719.         {
  720.             MovePlayerCameraEx(playerid,LiveViewCoords[4][0],LiveViewCoords[4][1],LiveViewCoords[4][2],
  721.             LiveViewCoords[5][0],LiveViewCoords[5][1],LiveViewCoords[5][2],LiveViewCoords[1][0],
  722.             LiveViewCoords[1][1],LiveViewCoords[1][2]-DIFF,CAMSPEED);
  723.             return SpielerData[playerid][LiveViewPos] = 1;
  724.         }
  725.         if(SpielerData[playerid][LiveViewPos] == 1)
  726.         {
  727.             MovePlayerCameraEx(playerid,LiveViewCoords[2][0],LiveViewCoords[2][1],LiveViewCoords[2][2],
  728.             LiveViewCoords[3][0],LiveViewCoords[3][1],LiveViewCoords[3][2],LiveViewCoords[1][0],
  729.             LiveViewCoords[1][1],LiveViewCoords[1][2]-DIFF,CAMSPEED);
  730.             SpielerData[playerid][LiveViewPos] = 2;
  731.         }
  732.     }
  733.     #define host "db4free.net:3306" #define mysqluser "tmthebess" #define mysqlpass "rauchen" #define database "tmthebess"
  734.     else return TogglePlayerLiveView(playerid);
  735.     return 1;
  736. }*/
  737. #endif
  738. stock LoadVehicles() //Fertig
  739. {
  740.     for(new i = 0; i< MAX_OWNEDVEHICLES;i++)
  741.     {
  742.         new formatLD[256];
  743.         format(formatLD,256,"Cars/%d_ownerauto.ini",i);
  744.         if(dini_Exists(formatLD))
  745.         {
  746.             new model,price,col1,col2,locked,Float:x,Float:y,Float:z,Float:r;
  747.             model=dini_Int(formatLD, "Model");
  748.             price=dini_Int(formatLD, "Price");
  749.             col1=dini_Int(formatLD, "Col1");
  750.             col2=dini_Int(formatLD, "Col2");
  751.             locked=dini_Int(formatLD, "Locked");
  752.             x=dini_Float(formatLD, "SpawnX");
  753.             y=dini_Float(formatLD, "SpawnY");
  754.             z=dini_Float(formatLD, "SpawnZ");
  755.             r=dini_Float(formatLD, "SpawnRot");
  756.             new veh = CreateVehicle(model,x,y,z,r,col1,col2,-1);
  757.             strmid(AutoData[veh][Owner],dini_Get(formatLD, "Owner"),0,12,12);
  758.             AutoData[veh][Model]=model;
  759.             AutoData[veh][Price]=price;
  760.             AutoData[veh][Col1]=col1;
  761.             AutoData[veh][Col2]=col2;
  762.             strmid(AutoData[veh][Keys],dini_Get(formatLD, "Keys"),0,MAX_NOM*MAX_KEYS,MAX_NOM*MAX_KEYS);
  763.             AutoData[veh][Locked]=locked;
  764.             AutoData[veh][SpawnX]=x;
  765.             AutoData[veh][SpawnY]=y;
  766.             AutoData[veh][SpawnZ]=z;
  767.             AutoData[veh][SpawnRot]=r;
  768.             IsKaufbaresAuto[veh] = 1;
  769.             AutoData[veh][ID]= i;
  770.             AutoData[veh][dtext] = Text3D:-1;
  771.             AutoData[veh][mod1] = dini_Int(formatLD, "mod1");
  772.             AutoData[veh][mod2] = dini_Int(formatLD, "mod2");
  773.             AutoData[veh][mod3] = dini_Int(formatLD, "mod3");
  774.             AutoData[veh][mod4] = dini_Int(formatLD, "mod4");
  775.             AutoData[veh][mod5] = dini_Int(formatLD, "mod5");
  776.             AutoData[veh][mod6] = dini_Int(formatLD, "mod6");
  777.             AutoData[veh][mod7] = dini_Int(formatLD, "mod7");
  778.             AutoData[veh][mod8] = dini_Int(formatLD, "mod8");
  779.             AutoData[veh][mod9] = dini_Int(formatLD, "mod9");
  780.             AutoData[veh][mod10] = dini_Int(formatLD, "mod10");
  781.             AutoData[veh][mod11] = dini_Int(formatLD, "mod11");
  782.             AutoData[veh][mod12] = dini_Int(formatLD, "mod12");
  783.             AutoData[veh][mod13] = dini_Int(formatLD, "mod13");
  784.             AutoData[veh][mod14] = dini_Int(formatLD, "mod14");
  785.             AutoData[veh][mod15] = dini_Int(formatLD, "mod15");
  786.             AutoData[veh][mod16] = dini_Int(formatLD, "mod16");
  787.             AutoData[veh][mod17] = dini_Int(formatLD, "mod17");
  788.             AutoData[veh][VehSkin] = dini_Int(formatLD, "VehSkin");
  789.             AddCarComponents(veh);
  790.             SetVehicleNumberPlate(veh,AutoData[veh][Owner]);
  791.             if(strmatch(AutoData[veh][Owner],"Niemand"))
  792.             {
  793.                 new string[256];
  794.                 SetVehicleNumberPlate(veh,"FOR SALE");
  795.                 format(string,256,"Dieses Fahrzeug steht zum Verkauf\nModell:%s\nPreis:%d$",GetVehicleModelName(veh),AutoData[veh][Price]);
  796.                 AutoData[veh][dtext]=Create3DTextLabel(string,BLUE,0.0,0.0,0.0,drawdistance,1);
  797.                 Attach3DTextLabelToVehicle(AutoData[veh][dtext],veh,0,0,0.0);
  798.             }
  799.         }
  800.     }
  801.     GetEmptyFile();
  802.     return 1;
  803. }
  804. stock SaveVehicle(vehicleid) // Fertig
  805. {
  806.     if(!IsKaufbaresAuto[vehicleid]) return 0;
  807.     new formatLD[256];
  808.     format(formatLD,256,"Cars/%d_ownerauto.ini",AutoData[vehicleid][ID]);
  809.     if(dini_Exists(formatLD))
  810.     {
  811.         dini_Set(formatLD,"Owner",AutoData[vehicleid][Owner]);
  812.         dini_IntSet(formatLD,"Model",AutoData[vehicleid][Model]);
  813.         dini_IntSet(formatLD,"Col1",AutoData[vehicleid][Col1]);
  814.         dini_IntSet(formatLD,"Col2",AutoData[vehicleid][Col2]);
  815.         dini_IntSet(formatLD,"Price",AutoData[vehicleid][Price]);
  816.         dini_Set(formatLD,"Keys",AutoData[vehicleid][Keys]);
  817.         dini_IntSet(formatLD,"Locked",AutoData[vehicleid][Locked]);
  818.         dini_FloatSet(formatLD,"SpawnX",AutoData[vehicleid][SpawnX]);
  819.         dini_FloatSet(formatLD,"SpawnY",AutoData[vehicleid][SpawnY]);
  820.         dini_FloatSet(formatLD,"SpawnZ",AutoData[vehicleid][SpawnZ]);
  821.         dini_FloatSet(formatLD,"SpawnRot",AutoData[vehicleid][SpawnRot]);
  822.         dini_IntSet(formatLD,"mod1",AutoData[vehicleid][mod1]);
  823.         dini_IntSet(formatLD,"mod2",AutoData[vehicleid][mod2]);
  824.         dini_IntSet(formatLD,"mod3",AutoData[vehicleid][mod3]);
  825.         dini_IntSet(formatLD,"mod4",AutoData[vehicleid][mod4]);
  826.         dini_IntSet(formatLD,"mod5",AutoData[vehicleid][mod5]);
  827.         dini_IntSet(formatLD,"mod6",AutoData[vehicleid][mod6]);
  828.         dini_IntSet(formatLD,"mod7",AutoData[vehicleid][mod8]);
  829.         dini_IntSet(formatLD,"mod9",AutoData[vehicleid][mod9]);
  830.         dini_IntSet(formatLD,"mod10",AutoData[vehicleid][mod10]);
  831.         dini_IntSet(formatLD,"mod11",AutoData[vehicleid][mod11]);
  832.         dini_IntSet(formatLD,"mod12",AutoData[vehicleid][mod12]);
  833.         dini_IntSet(formatLD,"mod13",AutoData[vehicleid][mod13]);
  834.         dini_IntSet(formatLD,"mod14",AutoData[vehicleid][mod14]);
  835.         dini_IntSet(formatLD,"mod15",AutoData[vehicleid][mod15]);
  836.         dini_IntSet(formatLD,"mod16",AutoData[vehicleid][mod16]);
  837.         dini_IntSet(formatLD,"mod17",AutoData[vehicleid][mod17]);
  838.         dini_IntSet(formatLD,"VehSkin",AutoData[vehicleid][VehSkin]);
  839.     }
  840.     else
  841.     {
  842.         dini_Create(formatLD);
  843.         SaveVehicle(vehicleid); // Wiederhole Befehl nachdem Datei erstellt
  844.     }
  845.     return 1;
  846.  
  847. }
  848. stock GetEmptyFile()
  849. {
  850.     new formatLD[256];
  851.     for(new id = 0; id<MAX_OWNEDVEHICLES;id++)
  852.     {
  853.         format(formatLD,256,"Cars/%d_ownerauto.ini",id);
  854.         if(!fexist(formatLD))
  855.             Emptyfile=id;
  856.     }
  857.     return 1;
  858. }
  859. stock DestroyOwnedVehicle(vehicleid)
  860. {
  861.     new formatLD[256];
  862.     format(formatLD,256,"Cars/%d_ownerauto.ini",AutoData[vehicleid][ID]);
  863.     if(!dini_Exists(formatLD)) return 0;
  864.     else
  865.     {
  866.         DestroyVehicle(vehicleid);
  867.         IsKaufbaresAuto[vehicleid] = 0;
  868.         dini_Remove(formatLD);
  869.         if(strmatch(AutoData[vehicleid][Owner],"Niemand"))
  870.             Delete3DTextLabel(AutoData[vehicleid][dtext]);
  871.     }
  872.     return 1;
  873. }
  874. stock CreateNewVehicle(model,Float:x,Float:y,Float:z,Float:rot,price,col1,col2) // Fertig
  875. {
  876.     GetEmptyFile();
  877.     new tmpid = CreateVehicle(model,x,y,z,rot,col1,col2,-1);
  878.     new formatLD[256];
  879.     format(formatLD,256,"Cars/%d_ownerauto.ini",Emptyfile);
  880.     if(dini_Exists(formatLD)) return GetEmptyFile();
  881.     strmid(AutoData[tmpid][Owner],"Niemand",0,7,MAX_NOM);
  882.     AutoData[tmpid][Model]=model;
  883.     AutoData[tmpid][ID] = Emptyfile;
  884.     AutoData[tmpid][Price]=price;
  885.     AutoData[tmpid][Col1]=col1;
  886.     AutoData[tmpid][Col2]=col2;
  887.     strmid(AutoData[tmpid][Keys],"",0,0,MAX_KEYS*MAX_NOM);
  888.     AutoData[tmpid][Locked]=0;
  889.     AutoData[tmpid][SpawnX]=x;
  890.     AutoData[tmpid][SpawnY]=y;
  891.     AutoData[tmpid][SpawnZ]=z;
  892.     AutoData[tmpid][SpawnRot]=rot;
  893.     IsKaufbaresAuto[tmpid]= 1;
  894.     new string[256];
  895.     SetVehicleNumberPlate(tmpid,"FOR SALE");
  896.     format(string,256,"Dieses Fahrzeug steht zum Verkauf\nModell:%s\nPreis:%d$",GetVehicleModelName(tmpid),AutoData[tmpid][Price]);
  897.     AutoData[tmpid][dtext]=Create3DTextLabel(string,BLUE,x,y,z,drawdistance,1);
  898.     Attach3DTextLabelToVehicle(AutoData[tmpid][dtext],tmpid,0,0,0.0);
  899.     IsKaufbaresAuto[tmpid] = 1;
  900.     dini_Create(formatLD);
  901.     SaveVehicle(tmpid);
  902.     return tmpid;
  903.  
  904. }
  905. stock strmatch(const String1[], const String2[])
  906. {
  907.     if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
  908.     {
  909.         return true;
  910.     }
  911.     else
  912.     {
  913.         return false;
  914.     }
  915. }
  916.  
  917. stock AddCarComponents(vehicleid)
  918. {
  919.         if(AutoData[vehicleid][mod1]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod1]);
  920.         if(AutoData[vehicleid][mod2]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod2]);
  921.         if(AutoData[vehicleid][mod3]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod3]);
  922.         if(AutoData[vehicleid][mod4]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod4]);
  923.         if(AutoData[vehicleid][mod5]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod5]);
  924.         if(AutoData[vehicleid][mod6]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod6]);
  925.         if(AutoData[vehicleid][mod7]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod7]);
  926.         if(AutoData[vehicleid][mod8]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod8]);
  927.         if(AutoData[vehicleid][mod9]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod9]);
  928.         if(AutoData[vehicleid][mod10]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod10]);
  929.         if(AutoData[vehicleid][mod11]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod11]);
  930.         if(AutoData[vehicleid][mod12]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod12]);
  931.         if(AutoData[vehicleid][mod13]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod13]);
  932.         if(AutoData[vehicleid][mod14]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod14]);
  933.         if(AutoData[vehicleid][mod15]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod15]);
  934.         if(AutoData[vehicleid][mod16]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod16]);
  935.         if(AutoData[vehicleid][mod17]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod17]);
  936.         if(AutoData[vehicleid][VehSkin]!=0)  ChangeVehiclePaintjob(vehicleid,AutoData[vehicleid][VehSkin]);
  937.         return 1;
  938. }
  939. stock FindSlotID(componentid)
  940. {
  941.     new i;
  942.     for(i=0; i<20; i++)if(spoiler[i]==componentid) return 1;
  943.     for(i=0; i<3; i++)if(nitro[i]==componentid) return 2;
  944.     for(i=0; i<23; i++)if(frontbumper[i]==componentid) return 3;
  945.     for(i=0; i<22; i++)if(rbumper[i]==componentid) return 4;
  946.     for(i=0; i<28; i++)if(exhaust[i]==componentid) return 5;
  947.     for(i=0; i<2; i++)if(bventr[i]==componentid) return 6;
  948.     for(i=0; i<2; i++)if(bventl[i]==componentid) return 7;
  949.     for(i=0; i<4; i++)if(bscoop[i]==componentid) return 8;
  950.     for(i=0; i<13; i++)if(rscoop[i]==componentid) return 9;
  951.     for(i=0; i<21; i++)if(lskirt[i]==componentid) return 10;
  952.     for(i=0; i<21; i++)if(rskirt[i]==componentid) return 11;
  953.     if(hydraulics==componentid) return 12;
  954.     if(base==componentid) return 13;
  955.     for(i=0; i<2; i++)if(rbbars[i]==componentid) return 14;
  956.     for(i=0; i<2; i++)if(fbbars[i]==componentid) return 15;
  957.     for(i=0; i<17; i++)if(wheels[i]==componentid) return 16;
  958.     for(i=0; i<2; i++)if(light[i]==componentid) return 17;
  959.     return 0;
  960. }
  961. public OnVehiclePaintjob(playerid,vehicleid, paintjobid)
  962.     return AutoData[vehicleid][VehSkin]=paintjobid;
  963. public OnVehicleMod(playerid,vehicleid,componentid)
  964. {
  965.     switch (FindSlotID(componentid))
  966.     {
  967.         case 1:  AutoData[vehicleid][mod1]=componentid;
  968.         case 2:  AutoData[vehicleid][mod2]=componentid;
  969.         case 3:  AutoData[vehicleid][mod3]=componentid;
  970.         case 4:  AutoData[vehicleid][mod4]=componentid;
  971.         case 5:  AutoData[vehicleid][mod5]=componentid;
  972.         case 6:  AutoData[vehicleid][mod6]=componentid;
  973.         case 7:  AutoData[vehicleid][mod7]=componentid;
  974.         case 8:  AutoData[vehicleid][mod8]=componentid;
  975.         case 9:  AutoData[vehicleid][mod9]=componentid;
  976.         case 10:  AutoData[vehicleid][mod10]=componentid;
  977.         case 11:  AutoData[vehicleid][mod11]=componentid;
  978.         case 12:  AutoData[vehicleid][mod12]=componentid;
  979.         case 13:  AutoData[vehicleid][mod13]=componentid;
  980.         case 14:  AutoData[vehicleid][mod14]=componentid;
  981.         case 15:  AutoData[vehicleid][mod15]=componentid;
  982.         case 16:  AutoData[vehicleid][mod16]=componentid;
  983.         case 17:  AutoData[vehicleid][mod17]=componentid;
  984.     }
  985.     SaveVehicle(vehicleid);
  986.     return 1;
  987. }
  988. public OnPlayerStateChange(playerid, newstate, oldstate)
  989.     if(newstate == 2)
  990.     {
  991.         new vehicleid = GetPlayerVehicleID(playerid);
  992.         #if defined MOTORSYSTEM
  993.             if(!IsKaufbaresAuto[vehicleid])ToggleVehicleEngine(vehicleid,1);
  994.         #endif
  995.         new string[256];
  996.         format(string,256,"Dieses Auto kostet %d$",AutoData[vehicleid][Price]);
  997.         if(strmatch(AutoData[vehicleid][Owner],"Niemand"))  ShowPlayerDialog(playerid,DIALOG_BUY,DIALOG_STYLE_MSGBOX,"Auto erwerben",string,"Kaufen","Abbrechen");
  998.        
  999.     }
  1000. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  1001. {
  1002.     if(IsPlayerInAnyVehicle(playerid))
  1003.     {
  1004.         new vehicle = GetPlayerVehicleID(playerid);
  1005.         if(newkeys == KEY_ANALOG_DOWN || newkeys == 4104 || newkeys == 4128 || newkeys == 4224)
  1006.         {
  1007.             if(!IsKaufbaresAuto[vehicle]) return 1;
  1008.             if(!IsPlayerDriver(playerid)) return 1;
  1009.             if(!HasPlayerKey(PlayerName(playerid),vehicle)) return SendClientMessage(playerid,ROT,"Du hast keinen Schlüssel!");
  1010.             if(IsEngineOn[vehicle])
  1011.             {
  1012.                 ToggleVehicleEngine(vehicle);
  1013.                 IsEngineOn[vehicle] = 0;
  1014.             }
  1015.             else { ToggleVehicleEngine(vehicle,1);IsEngineOn[vehicle] = 1;}
  1016.         }
  1017.         if(newkeys == KEY_ANALOG_UP || newkeys == 2056 || newkeys == 2080 || newkeys == 2176)
  1018.         {
  1019.             if(!IsKaufbaresAuto[vehicle]) return 1;
  1020.             if(!IsPlayerDriver(playerid)) return 1;
  1021.             if(!HasPlayerKey(PlayerName(playerid),vehicle)) return SendClientMessage(playerid,ROT,"Du hast keinen Schlüssel!");
  1022.             if(AreLightsOn[vehicle])
  1023.             {
  1024.                 ToggleVehicleLights(vehicle);
  1025.                 AreLightsOn[vehicle]= 0;
  1026.             }
  1027.             else { ToggleVehicleLights(vehicle,1);AreLightsOn[vehicle]= 1;}
  1028.         }
  1029.     }
  1030.     #if defined AUTOHAUS
  1031.     else if(SpielerData[playerid][liveview] == 1)
  1032.     {
  1033.         if(newkeys == KEY_JUMP)
  1034.         {
  1035.             if(GetPlayerMoney(playerid) < OwnerVehicleInfo[SpielerData[playerid][CurrVeh]][price1]) return SendClientMessage(playerid,ROT,"Du hast nicht genug Geld!");
  1036.             TogglePlayerLiveView(playerid);
  1037.             new newveh = CreateNewVehicle(OwnerVehicleInfo[SpielerData[playerid][CurrVeh]][model1],
  1038.             AutoHausInfo[VehSpawnX],AutoHausInfo[VehSpawnY],AutoHausInfo[VehSpawnZ],AutoHausInfo[VehSpawnRot],
  1039.             OwnerVehicleInfo[SpielerData[playerid][CurrVeh]][price1],0,0);
  1040.             new Float:x,Float:y,Float:z;
  1041.             GetVehiclePos(newveh,x,y,z);
  1042.             SetPlayerCheckpoint(playerid,x,y,z,5.0);
  1043.             SpielerData[playerid][autokauf] = 1;
  1044.             GivePlayerMoney(playerid,-OwnerVehicleInfo[SpielerData[playerid][CurrVeh]][price1]);
  1045.             AddPlayerKey(PlayerName(playerid),newveh);
  1046.             strmid(AutoData[newveh][Owner],PlayerName(playerid),0,MAX_PLAYER_NAME,MAX_NOM);
  1047.             Delete3DTextLabel(AutoData[newveh][dtext]);
  1048.             SaveVehicle(newveh);
  1049.             SetVehicleNumberPlate(newveh,AutoData[newveh][Owner]);
  1050.             SendClientMessage(playerid,GREEN,"Fahrzeug erfolgreich gekauft! Die Position deines neuen Fahrzeugs wurde an dein Handy geschickt.");
  1051.         }
  1052.         if(newkeys == KEY_ANALOG_LEFT)
  1053.             if(SpielerData[playerid][CurrVeh] <= 0)return PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); // Fehlerton
  1054.             else
  1055.             {
  1056.                 PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); // Confirmation sound
  1057.                 ShowPlayerAutohausVehicle(playerid,-1);
  1058.             }
  1059.         if(newkeys == KEY_ANALOG_RIGHT)
  1060.             if(SpielerData[playerid][CurrVeh] >= sizeof(OwnerVehicleInfo)-1)return PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); // Fehlerton
  1061.             else
  1062.             {
  1063.                 PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); // Confirmation sound
  1064.                 ShowPlayerAutohausVehicle(playerid,1);
  1065.             }
  1066.         if(newkeys == KEY_SECONDARY_ATTACK)
  1067.             if(IsPlayerInRangeOfPoint(playerid,5.0,LiveViewCoords[0][0],LiveViewCoords[0][1],LiveViewCoords[0][2]))
  1068.                 TogglePlayerLiveView(playerid);
  1069.  
  1070.     }
  1071.     #endif
  1072.     return 0;
  1073. }
  1074. ToggleVehicleEngine(vehicleid,toggle = 0)
  1075. {
  1076.     new engine,lights,alarm,doors,bonnet,boot,objective;
  1077.     GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
  1078.     if(toggle == 1)return SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
  1079.     else return SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
  1080. }
  1081. ToggleVehicleLights(vehicleid,toggle = 0)
  1082. {
  1083.     new engine,lights,alarm,doors,bonnet,boot,objective;
  1084.     GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
  1085.     if(toggle == 1)return SetVehicleParamsEx(vehicleid,engine,1,alarm,doors,bonnet,boot,objective);
  1086.     else return SetVehicleParamsEx(vehicleid,engine,0,alarm,doors,bonnet,boot,objective);
  1087. }
  1088. stock IsPlayerDriver(playerid)
  1089.     if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return 1;else return 0;
  1090.  
  1091. stock Float:GetDisBetweenPlayerAndCar(p1ayerid,carid)
  1092. {
  1093.     new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  1094.     if(!IsPlayerConnected(p1ayerid))
  1095.     {
  1096.         return -1.00;
  1097.     }
  1098.     GetPlayerPos(p1ayerid,x1,y1,z1);
  1099.     GetVehiclePos(carid,x2,y2,z2);
  1100.     return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  1101. }
  1102. stock GetNearestVehicleToPlayer(playerid,Float:Radius) // Credits to... ehm, kP
  1103. {
  1104.     new x,Float:dis,Float:dis2,car;
  1105.     car = 0;
  1106.     dis = 99999.99;
  1107.     for ( x = 0; x < MAX_VEHICLES; x++ )
  1108.     {
  1109.         dis2 = GetDisBetweenPlayerAndCar(playerid,x);
  1110.         if(dis2 < dis && dis2 < 8.0)
  1111.         {
  1112.             dis = dis2;
  1113.             car = x;
  1114.         }
  1115.     }
  1116.     return car;
  1117. }
  1118. public OnPlayerEnterVehicle(playerid,vehicleid)
  1119. {
  1120.     if(AutoData[vehicleid][VehSkin]!=0)return ChangeVehiclePaintjob(vehicleid,AutoData[vehicleid][VehSkin]);
  1121.     return 0;
  1122. }
  1123. public OnPlayerExitVehicle(playerid,vehicleid)
  1124. {
  1125.     SaveVehicle(vehicleid);
  1126.     #if defined MOTORSYSTEM
  1127.         if(!IsKaufbaresAuto[vehicleid])ToggleVehicleEngine(vehicleid,0);
  1128.     #endif
  1129.     return 0;
  1130. }
  1131. public OnPlayerCommandText(playerid,cmdtext[])
  1132. {
  1133.     new idx,cmd[256];
  1134.     cmd = strtok(cmdtext,idx);
  1135.     if(!strcmp(cmd,"/createcar",true))
  1136.     {
  1137.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ROT,"Diesen Befehl kannst du nicht nutzen!");
  1138.         new Float:X,Float:Y,Float:Z,Float:Rot,model,col1,col2,price;
  1139.         GetPlayerPos(playerid,X,Y,Z);
  1140.         GetPlayerFacingAngle(playerid,Rot);
  1141.         cmd = strtok(cmdtext,idx);
  1142.         if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /createcar [modelid] [col1] [col2] [preis]");
  1143.         model = strval(cmd);
  1144.         cmd = strtok(cmdtext,idx);
  1145.         if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /createcar [modelid] [col1] [col2] [preis]");
  1146.         col1 = strval(cmd);
  1147.         cmd = strtok(cmdtext,idx);
  1148.         if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /createcar [modelid] [col1] [col2] [preis]");
  1149.         col2 = strval(cmd);
  1150.         cmd = strtok(cmdtext,idx);
  1151.         if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /createcar [modelid] [col1] [col2] [preis]");
  1152.         price = strval(cmd);
  1153.         CreateNewVehicle(model,X,Y,Z,Rot,price,col1,col2);
  1154.         return 1;
  1155.     }
  1156.     #if defined TESTMODE
  1157.     if(!strcmp(cmd,"/GELD",true))return GivePlayerMoney(playerid,50000);
  1158.     if(!strcmp(cmd,"/jetz",true))
  1159.     {
  1160.         new tmpstring[56];
  1161.         format(tmpstring,56,"Jetzige CarID %d",GetPlayerVehicleID(playerid));
  1162.         SendClientMessage(playerid,ROT,tmpstring);
  1163.         return 1;
  1164.     }
  1165.     if(!strcmp(cmd,"/specautohaus",true))
  1166.     {
  1167.         TogglePlayerLiveView(playerid, 1);
  1168.         return 1;
  1169.     }
  1170.     if(!strcmp(cmd,"/Cameramove",true))
  1171.     {
  1172.         if(IsCameraMoving(playerid))return SendClientMessage(playerid,ROT,"Bewegt");
  1173.         if(!IsCameraMoving(playerid))return SendClientMessage(playerid,GREEN,"Bewegt nicht");
  1174.     }
  1175.     #endif
  1176.     #if defined AUTOHAUS
  1177.     if(!strcmp(cmd,"/autohaus",true))
  1178.     {
  1179.         if(IsPlayerInRangeOfPoint(playerid,5.0,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ]))return TogglePlayerLiveView(playerid, 1);
  1180.         else return SendClientMessage(playerid,ROT,"Du bist nicht nahe dem Autohaus!");
  1181.     }
  1182.     if(!strcmp(cmd,"/setautohaus",true))
  1183.     {
  1184.         if(!IsPlayerAdmin(playerid))return  SendClientMessage(playerid,ROT,"Du bist nicht befugt!");
  1185.         GetPlayerPos(playerid,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ]);
  1186.         Delete3DTextLabel(AutoHausInfo[Label]);
  1187.         DestroyPickup(AutoHausInfo[Pickup]);
  1188.         AutoHausInfo[Label]=Create3DTextLabel("Tippe hier /autohaus\num zur Autoauswahl\nzu gelangen",BLUE,
  1189.         AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],drawdistance,0,1);
  1190.         AutoHausInfo[Pickup] = CreatePickup(1239,1,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],0);
  1191.         return SendClientMessage(playerid,GREEN,"Autohaus erfolgreich gesetzt!");
  1192.     }
  1193.     /*
  1194.     if(!strcmp(cmd,"/createautohaus",true)) // PLATZHALTER: GO ON
  1195.     {
  1196.         if(!IsPlayerAdmin(playerid))return  SendClientMessage(playerid,ROT,"Du bist nicht befugt!");
  1197.         new hid = GetEmptyAutoHaus(),formatLD[60];
  1198.         format(formatLD,sizeof formatLD, "Ownership_%d.cfg",hid);
  1199.         dini_Create(formatLD);
  1200.         AutoHausInfo[hid][Label]=Create3DTextLabel("Tippe hier /autohaus\num zur Autoauswahl\nzu gelangen",BLUE,
  1201.         AutoHausInfo[hid][PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],drawdistance,0,1);
  1202.         AutoHausInfo[hid][Pickup] = CreatePickup(1239,1,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],0);
  1203.         format(formatLD,sizeof formatLD, "Autohaus erfolgreich erstellt!\n Setze nun noch den Spawnpunkt mit /setautohausspawn [hid] -> Neue hid = %d",hid);
  1204.         return SendClientMessage(playerid,GREEN,formatLD);
  1205.     }*/
  1206.     if(!strcmp(cmd,"/setautohausspawn",true))
  1207.     {
  1208.         if(!IsPlayerAdmin(playerid))return  SendClientMessage(playerid,ROT,"Du bist nicht befugt!");
  1209.         if(!IsPlayerInAnyVehicle(playerid))
  1210.         {
  1211.             GetPlayerPos(playerid,AutoHausInfo[VehSpawnX],AutoHausInfo[VehSpawnY],AutoHausInfo[VehSpawnZ]);
  1212.             GetPlayerFacingAngle(playerid,AutoHausInfo[VehSpawnRot]);
  1213.         }
  1214.         else
  1215.         {
  1216.             GetVehiclePos(GetPlayerVehicleID(playerid),AutoHausInfo[VehSpawnX],AutoHausInfo[VehSpawnY],AutoHausInfo[VehSpawnZ]);
  1217.             GetVehicleZAngle(GetPlayerVehicleID(playerid),AutoHausInfo[VehSpawnRot]);
  1218.         }
  1219.         return SendClientMessage(playerid,GREEN,"Autohaus-Spawn erfolgreich gesetzt!");
  1220.     }
  1221.     #endif
  1222.     if(!strcmp(cmd,"/removecar",true))
  1223.     {
  1224.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ROT,"Diesen Befehl kannst du nicht nutzen!");
  1225.         cmd = strtok(cmdtext,idx);
  1226.         if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /removecar [vehicleid] //Dieser Befehl löscht ein Fahrzeug unwiderruflich");
  1227.         new vehid = strval(cmd);
  1228.         DestroyOwnedVehicle(vehid);
  1229.         SendClientMessage(playerid,GREEN,"Fahrzeug erfolgreich gelöscht!");
  1230.         return 1;
  1231.        
  1232.     }
  1233.     if(!strcmp(cmd,"/park",true))
  1234.     {
  1235.         if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,ROT,"Du befindest dich in keinem Auto");
  1236.         if(!HasPlayerKey(PlayerName(playerid),GetPlayerVehicleID(playerid))) return SendClientMessage(playerid,ROT,"Du hast keinen Schlüssel für dieses Fahrzeug!");
  1237.         new vehicleid = GetPlayerVehicleID(playerid),Float:x,Float:y,Float:z,Float:r;
  1238.         GetVehiclePos(vehicleid,x,y,z);
  1239.         GetVehicleZAngle(vehicleid,r);
  1240.         AutoData[vehicleid][SpawnX] = x;
  1241.         AutoData[vehicleid][SpawnY] = y;
  1242.         AutoData[vehicleid][SpawnZ] = z;
  1243.         AutoData[vehicleid][SpawnRot] = r;
  1244.         SaveVehicle(vehicleid);
  1245.         SendClientMessage(playerid,GREEN,"Fahrzeug erfolgreich geparkt!");
  1246.         return 1;
  1247.     }
  1248.     if(!strcmp(cmd,"/apark",true))
  1249.     {
  1250.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ROT,"Du bist kein Admin!");
  1251.         if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,ROT,"Du befindest dich in keinem Auto");
  1252.         new vehicleid = GetPlayerVehicleID(playerid),Float:x,Float:y,Float:z,Float:r;
  1253.         GetVehiclePos(vehicleid,x,y,z);
  1254.         GetVehicleZAngle(vehicleid,r);
  1255.         AutoData[vehicleid][SpawnX] = x;
  1256.         AutoData[vehicleid][SpawnY] = y;
  1257.         AutoData[vehicleid][SpawnZ] = z;
  1258.         AutoData[vehicleid][SpawnRot] = r;
  1259.         SaveVehicle(vehicleid);
  1260.         SendClientMessage(playerid,GREEN,"Fahrzeug erfolgreich geparkt!");
  1261.         return 1;
  1262.     }
  1263.     if(!strcmp(cmd,"/configcar",true)||!strcmp(cmd,"/cc",true))
  1264.         if(IsPlayerInAnyVehicle(playerid))
  1265.             if(IsKaufbaresAuto[GetPlayerVehicleID(playerid)]&& IsPlayerAbleToConfig(playerid,GetPlayerVehicleID(playerid)))
  1266.                 return ShowPlayerDialog(playerid,DIALOG_CONFIG,DIALOG_STYLE_LIST,"Autokonfiguration","Schlüsselverteilung\nBesitzer ändern","Wählen","Verlassen");
  1267.             else return SendClientMessage(playerid,ROT,"Du kannst dieses Auto nicht konfigurieren!");
  1268.            
  1269.     if(!strcmp(cmd,"/editcar",true))
  1270.         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ROT,"Diesen Befehl kannst du nicht nutzen!");
  1271.         else return ShowPlayerDialog(playerid,DIALOG_EDITVEH,DIALOG_STYLE_INPUT,"Fahrzeug-Bearbeitung","Bitte geben Sie die zu bearbeitende Fahrzeug ID ein:","Absenden","Abbrechen");
  1272.     return 0;
  1273. }
  1274.  
  1275.  
  1276. strtok(const string[], &index)
  1277. {
  1278.     new length = strlen(string);
  1279.     while ((index < length) && (string[index] <= ' '))
  1280.     {
  1281.         index++;
  1282.     }
  1283.  
  1284.     new offset = index;
  1285.     new result[20];
  1286.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  1287.     {
  1288.         result[index - offset] = string[index];
  1289.         index++;
  1290.     }
  1291.     result[index - offset] = EOS;
  1292.     return result;
  1293. }
  1294. stock RespawnVehicle(vehicleid)
  1295. {
  1296.     new Float:x,Float:y,Float:z,Float:r,Float:health;
  1297.     GetVehicleHealth(vehicleid,health);
  1298.     GetVehiclePos(vehicleid,x,y,z);
  1299.     GetVehicleZAngle(vehicleid,r);
  1300.     DestroyVehicle(vehicleid);
  1301.     vehicleid = CreateVehicle(AutoData[vehicleid][Model],x,y,z,r,AutoData[vehicleid][Col1],AutoData[vehicleid][Col2],-1);
  1302.     SetVehicleNumberPlate(vehicleid,AutoData[vehicleid][Owner]);
  1303.     if(strmatch(AutoData[vehicleid][Owner],"Niemand"))
  1304.     {
  1305.         Delete3DTextLabel(AutoData[vehicleid][dtext]);
  1306.         SetVehicleNumberPlate(vehicleid,"FOR SALE");
  1307.         new string[256];
  1308.         format(string,256,"Dieses Fahrzeug steht zum Verkauf\nModell:%s\nPreis:%d$",GetVehicleModelName(vehicleid),AutoData[vehicleid][Price]);
  1309.         AutoData[vehicleid][dtext]=Create3DTextLabel(string,BLUE,0.0,0.0,0.0,drawdistance,1);
  1310.         Attach3DTextLabelToVehicle(AutoData[vehicleid][dtext],vehicleid,0,0,0.0);
  1311.     }
  1312.     AddCarComponents(vehicleid);
  1313.     return 1;
  1314. }
  1315. stock GetVehicleModelName(vehicleid)
  1316. {
  1317.         new string[128];
  1318.         format(string, sizeof(string), VehicleNames[GetVehicleModel(vehicleid)-400]);
  1319.         return string;
  1320. }/*
  1321. stock split(const strsrc[], strdest[][], delimiter = '|')
  1322. {
  1323.     new i, li, aNum, len, srclen = strlen(strsrc);
  1324.     while(i <= srclen)
  1325.     {
  1326.         if (strsrc[i] == delimiter || i == srclen)
  1327.         {
  1328.             len = strmid(strdest[aNum], strsrc, li, i, 128);
  1329.             strdest[aNum][len] = 0;
  1330.             li = i + 1;
  1331.             aNum++;
  1332.         }
  1333.         i++;
  1334.     }
  1335. }*/
  1336. stock PlayerName(playerid)
  1337. {
  1338.   new name[MAX_PLAYER_NAME];
  1339.   GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  1340.   return name;
  1341. }
  1342. stock AddPlayerKey(playername[],vehicleid)
  1343. {
  1344.     if(!IsKaufbaresAuto[vehicleid]) return 0;
  1345.     new Keysplit[MAX_KEYS][MAX_NOM];
  1346.     split(AutoData[vehicleid][Keys], Keysplit,',');
  1347.     for(new i = 0;i<MAX_KEYS;i++)
  1348.         if(strmatch(Keysplit[i],playername))return 0;
  1349.         else if(strmatch(Keysplit[i],""))
  1350.         {
  1351.             strmid(Keysplit[i],playername,0,120,120);
  1352.             strmid(AutoData[vehicleid][Keys],"",0,0,0);
  1353.             for(new u=0;u<MAX_KEYS;u++)
  1354.                 if(!strmatch(Keysplit[u],""))
  1355.                     format(AutoData[vehicleid][Keys],1024,"%s,%s",AutoData[vehicleid][Keys],Keysplit[u]);
  1356.             SaveVehicle(vehicleid);
  1357.             return 1;
  1358.         }
  1359.     return 0;
  1360. }
  1361. stock RemovePlayerKey(playername[],vehicleid)
  1362. {
  1363.     if(!IsKaufbaresAuto[vehicleid]) return 0;
  1364.     new Keysplit[MAX_KEYS][MAX_NOM];
  1365.     split(AutoData[vehicleid][Keys], Keysplit,',');
  1366.     for(new i = 0;i<MAX_KEYS;i++)
  1367.         if(strmatch(Keysplit[i],playername))
  1368.         {
  1369.             strmid(Keysplit[i],"",0,0,0);
  1370.             strmid(AutoData[vehicleid][Keys],"",0,0,0);
  1371.             for(new u=0;u<MAX_KEYS;u++)
  1372.                 if(!strmatch(Keysplit[u],""))
  1373.                     format(AutoData[vehicleid][Keys],1024,"%s,%s",AutoData[vehicleid][Keys],Keysplit[u]);
  1374.             SaveVehicle(vehicleid);
  1375.             return 1;
  1376.         }
  1377.     return 0;
  1378. }
  1379. stock IsPlayerAbleToConfig(playerid,vehicleid)
  1380. {
  1381.     if(!IsKaufbaresAuto[vehicleid]) return 0;
  1382.     if(strmatch(PlayerName(playerid),AutoData[vehicleid][Owner])) return 1;
  1383.     return 0;
  1384. }
  1385. stock HasPlayerKey(playername[],vehicleid)
  1386. {
  1387.     if(!IsKaufbaresAuto[vehicleid]) return 0;
  1388.     new Keysplit[MAX_KEYS][MAX_NOM];
  1389.     split(AutoData[vehicleid][Keys], Keysplit,',');
  1390.     for(new i = 0;i<MAX_KEYS;i++)
  1391.         if(strmatch(Keysplit[i],playername))return 1;
  1392.     return 0;
  1393. }
  1394.  
  1395. stock split(const strsrc[], strdest[][], delimiter = '|')
  1396. {
  1397.     new i, li, aNum, len, srclen = strlen(strsrc);
  1398.     while(i <= srclen)
  1399.     {
  1400.         if (strsrc[i] == delimiter || i == srclen)
  1401.         {
  1402.             len = strmid(strdest[aNum], strsrc, li, i, 128);
  1403.             strdest[aNum][len] = 0;
  1404.             li = i + 1;
  1405.             aNum++;
  1406.         }
  1407.         i++;
  1408.     }
  1409. }
  1410. Function MOD_VERSIONCHECK(index, response, data[])return printf("\n\nDerzeitige Version: %.1f, Versionscheck: %.1f\n\n %s \n\n\n",MODVERSION+0.1,floatstr(data)+0.1,
  1411.  (MODVERSION+0.1 < floatstr(data)+0.1) ? ("Neue Version verfügbar!\n Siehe breadfish.de für weitere Informationen") : ("Vesion ist aktuell!") );
  1412.  
  1413.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement