Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLL VVVVV VVVVV
- LLLLLLLLLLLLLLLLLLL VVVVVVVVVVVV
- LLLLLLLLLLLLLLLLLLL VVVVVVVVVV
- LLLLLLLLLLLLLLLLLLL VVVVVVVV
- LITE VEHICLEOWNERSHIP
- by
- RRRRRRRRRRRRRRRRRR GGGGGGGGGGGGGGGGGGGGG
- RRRRRRRRRRRRRRRRRRR GGGGGGGGGGGGGGGGGGGGGGGG
- RRRRRRRRRRRRRRRRRRRRR GGGGGGGGGGGGGGGGGGGGGGGGGG
- RRRRRRR RRRRRRR GGGGGGGGG
- RRRRRRR RRRRRRR GGGGGGGG
- RRRRRRR RRRRRRR GGGGGGG
- RRRRRRR RRRRRRR GGGGGGG
- RRRRRRRRRRRRRRRRRRRRR GGGGGGG
- RRRRRRRRRRRRRRRRRRR GGGGGGG GGGGGGGGGG
- RRRRRRRRRRRRRRRRRR GGGGGGG GGGGGGGGGGG
- RRRRRRR RRRRRRR GGGGGGG GGGGGGGGGGG
- RRRRRRR RRRRRRR GGGGGGG GGGGGGG
- RRRRRRR RRRRRRR GGGGGGGG GGGGGGG
- RRRRRRR RRRRRRR GGGGGGGGG GGGGGGG
- RRRRRRR RRRRRRR GGGGGGGGGGGGGGGGGGGGGGGGGG
- RRRRRRR RRRRRRR GGGGGGGGGGGGGGGGGGGGGGGG
- RRRRRRR RRRRRRR GGGGGGGGGGGGGGGGGGGGG
- Vehicleownership lite v1.2.2 (C), RealGamer // STABLE BUILD
- */
- #include a_samp
- #include dini
- #include a_http
- //FARBEN
- #define ROT 0xAA3333AA
- #define GREEN 0x33AA33AA
- #define BLUE 0xFFFFFFFF
- // DIALOGE
- #define DIALOG_BUY 512
- #define DIALOG_CONFIG 513
- #define DIALOG_SETOWNER 514
- #define DIALOG_KEYSETTINGS 515
- #define DIALOG_EDITVEH 516
- #define DIALOG_EDIT 517
- #define DIALOG_EDITFUNC 518
- #define editfunctions "Gewählte FahrzeugID: %d\nModell: %s\nFarbe1: %d\nFarbe2: %d\nBesitzer: %s\nWert: %d"
- // EINSTELLUNGEN
- #define MAX_KEYS 10 // Definiere die maximale Anzahl an Keys
- #define MAX_NOM 20 // Definiere die maximale Länge der Namen
- #define MAX_OWNEDVEHICLES 200 // Definiere die maximale Anzahl an verkaufbaren Fahrzeugen
- #define drawdistance 10.0 // Definiere die Drawdistanz für die 3D Texte
- #define AUTOHAUS // Definiere, ob das Autohaus aktiv sein soll
- #define MOTORSYSTEM // Definiere, falls du KEIN Motorsystem besitzt
- #define MODVERSION 1.2
- //#define TESTMODE
- #define Function%0(%1) forward%0(%1); public%0(%1)
- #define DIFF 2.0
- #define CAMSPEED 1.0
- // NEW & ENUM
- new IsEngineOn[MAX_VEHICLES];
- new AreLightsOn[MAX_VEHICLES];
- new IsKaufbaresAuto[MAX_VEHICLES];
- new Emptyfile;
- enum pInfo
- {
- SelectedVeh,
- ChosenField,
- liveview,
- LiveViewPos,
- CurrVeh,
- CurrVehID,
- #if defined AUTOHAUS
- Text:Textdraw0,
- Text:Textdraw3,
- autokauf,
- #endif
- Float:PlayerPosX,
- Float:PlayerPosY,
- Float:PlayerPosZ
- }
- new SpielerData[MAX_PLAYERS][pInfo];
- enum CarInfo
- {
- ID,Model,Col1,Col2,
- Owner[MAX_NOM],Price,
- Keys[MAX_KEYS*MAX_NOM],
- Locked,Float:SpawnX,
- Float:SpawnY,Float:SpawnZ,
- Float:SpawnRot,Text3D:dtext,
- mod1,mod2,mod3,mod4,
- mod5,mod6,mod7,mod8,
- mod9,mod10,mod11,
- mod12,mod13,mod14,
- mod15,mod16,mod17,
- VehSkin
- }
- new AutoData[MAX_VEHICLES][CarInfo];
- #if defined AUTOHAUS
- #tryinclude CameraMoving
- #if !defined MovePlayerCamera
- #define ERROR 1
- #undef AUTOHAUS
- #endif
- #endif
- #if defined AUTOHAUS
- new Text:Textdraw1,Text:Textdraw2,
- Text:Textdraw4,Text:Textdraw5,
- Text:Textdraw6,Text:Textdraw7,
- Text:Textdraw8,Text:Textdraw9,
- Text:Textdraw10,Text:Textdraw11,
- Text:Textdraw12,Text:Textdraw13;
- enum AutoHausInformation
- {
- Float:PosX,
- Float:PosY,
- Float:PosZ,
- Float:VehSpawnX,
- Float:VehSpawnY,
- Float:VehSpawnZ,
- Float:VehSpawnRot,
- Text3D:Label,
- Pickup
- }
- new AutoHausInfo[AutoHausInformation];
- enum OwnerCarInfo
- {
- model1,
- price1
- }
- new OwnerVehicleInfo[][OwnerCarInfo] = { // Adde neue Fahrzeuge hier, Aufbau: {AUTOMODEL,PREIS}
- {423,5344},
- {411,50244},
- {420,4319},
- {560,66125},
- {520,1000000}
- };
- new Float:LiveViewCoords[][] = {
- {2061.8957519531,2428.55859375,49.5234375}, // Position für Spieler (Im Hintergrund, dient lediglich dafür, dass das Fahrzeug eingestreamt ist)
- {2091.6440429688,2407.1145019531,49.5234375}, // Position für Fahrzeug ID: 1
- {2088.2592773438,2426.8110351563,51.4299774}, // Position für 1.Start MovePlayerCamera ID: 2
- {2088.2592773438,2388.9240722656,51.4299774}, // Position für 1.Ziel MovePlayerCamera ID: 3
- {2095.8930664063,2388.9240722656,51.4299774}, // Position für 2.Start MovePlayerCamera ID: 4
- {2095.8930664063,2426.8110351563,51.4299774} // Position für 2.Ziel MovePlayerCamera ID: 5
- };
- #endif
- new VehicleNames[212][] = {
- "Landstalker","Bravura","Buffalo","Linerunner","Perrenial","Sentinel",
- "Dumper","Firetruck","Trashmaster","Stretch","Manana","Infernus","Voodoo",
- "Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto","Taxi",
- "Washington","Bobcat","Mr. Whoopee","BF. Injection","Hunter","Premier","Enforcer",
- "Securicar","Banshee","Predator","Bus","Rhino","Barracks","Hotknife","Article Trailer",
- "Previon","Coach","Cabbie","Stallion","Rumpo","RC Bandit","Romero","Packer","Monster",
- "Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Article Trailer 2","Turismo","Speeder",
- "Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer",
- "PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic","Sanchez",
- "Sparrow","Patriot","Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR-350",
- "Walton","Regina","Comet","BMX","Burrito","Camper","Marquis","Baggage","Dozer",
- "Maverick","News Chopper","Rancher","FBI Rancher","Virgo","Greenwood","Jetmax","Hotring",
- "Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa","RC Goblin",
- "Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT","Elegant",
- "Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","Roadtrain",
- "Nebula","Majestic","Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000",
- "Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck","Willard","Forklift",
- "Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight","Streak",
- "Vortex","Vincent","Bullet","Clover","Sadler","Firetruck LA","Hustler","Intruder",
- "Primo","Cargobob","Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor",
- "Monster A","Monster B","Uranus","Jester","Sultan","Stratum","Elegy","Raindance",
- "RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight Flat","Streak Carriage",
- "Kart","Mower","Dunerider","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley",
- "Stafford","BF-400","Newsvan","Tug","Article Trailer 3","Emperor","Wayfarer","Euros","Mobile Hotdog",
- "Club","Freight Carriage","Trailer 3","Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)",
- "Police Car (SFPD)","Police Car (LVPD)","Police Ranger","Picador","S.W.A.T Van","Alpha",
- "Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B","Stair Trailer",
- "Boxville","Farm Plow","Utility Trailer"
- };
- new spoiler[20]= {
- 1000,1001,1002,1003,1014,1015,1016,1023,1058,
- 1060,1049,1050,1138,1139,1146,1147,1158,1162,
- 1163,1164};
- new nitro[3] = {1008,1009,1010};
- new frontbumper[23]= {
- 1117,1152,1153,1155,1157,1160,1165,1167,1169,
- 1170,1171,1172,1173,1174,1175,1179,1181,1182,
- 1185,1188,1189,1192,1193};
- new rbumper[22]= {
- 1140,1141,1148,1149,1150,1151,1154,1156,1159,
- 1161,1166,1168,1176,1177,1178,1180,1183,1184,
- 1186,1187,1190,1191};
- new exhaust[28]= {
- 1018,1019,1020,1021,1022,1028,1029,1037,1043,
- 1044,1045,1046,1059,1064,1065,1066,1089,1092,
- 1104,1105,1113,1114,1126,1127,1129,1132,1135,
- 1136};
- new bventr[2]= {1042,1044};
- new bventl[2]= {1043,1045};
- new bscoop[4]= {1004,1005,1011,1012};
- new rscoop[13]= {
- 1006,1032,1033,1035,1038,1053,1054,1055,1061,
- 1067,1068,1088,1091};
- new lskirt[21]= {
- 1007,1026,1031,1036,1039,1042,1047,1048,1056,
- 1057,1069,1070,1090,1093,1106,1108,1118,1119,
- 1133,1122,1134};
- new rskirt[21]= {
- 1017,1027,1030,1040,1041,1051,1052,1062,1063,
- 1071,1072,1094,1095,1099,1101,1102,1107,1120,
- 1121,1124,1137};
- new hydraulics= 1087;
- new base= 1086;
- new rbbars[2]= {1109,1110};
- new fbbars[2]= {1115,1116};
- new wheels[17]= {
- 1025,1073,1074,1075,1076,1077,1078,1079,1080,
- 1081,1082,1083,1084,1085,1096,1097,1098};
- new light[2]= {1013,1024};
- public OnFilterScriptInit()
- {
- print("\n\n\nRV Vehicleownership wird initialisiert...");
- ManualVehicleEngineAndLights();
- #if defined AUTOHAUS
- print("Lade Autohausdaten...");
- Textdraw1 = TextDrawCreate(0.000000, 0.000000, "Autohaus-Computer");
- TextDrawBackgroundColor(Textdraw1, 255);
- TextDrawFont(Textdraw1, 1);
- TextDrawLetterSize(Textdraw1, 0.619999, 3.099999);
- TextDrawColor(Textdraw1, -1);
- TextDrawSetOutline(Textdraw1, 0);
- TextDrawSetProportional(Textdraw1, 1);
- TextDrawSetShadow(Textdraw1, 1);
- TextDrawUseBox(Textdraw1, 1);
- TextDrawBoxColor(Textdraw1, 255);
- TextDrawTextSize(Textdraw1, 656.000000, 37.000000);
- Textdraw2 = TextDrawCreate(-3.000000, 303.000000, "OKPWADJ AWDJO OWAP DJAOIWD A awidOIAW jdA");
- TextDrawBackgroundColor(Textdraw2, 255);
- TextDrawFont(Textdraw2, 1);
- TextDrawLetterSize(Textdraw2, -0.769999, 14.199999);
- TextDrawColor(Textdraw2, 10);
- TextDrawSetOutline(Textdraw2, 0);
- TextDrawSetProportional(Textdraw2, 0);
- TextDrawSetShadow(Textdraw2, 0);
- TextDrawUseBox(Textdraw2, 1);
- TextDrawBoxColor(Textdraw2, 200);
- TextDrawTextSize(Textdraw2, 679.000000, 254.000000);
- Textdraw4 = TextDrawCreate(-88.000000, 313.000000, "df sd fsdf we fse fsef s");
- TextDrawBackgroundColor(Textdraw4, 255);
- TextDrawFont(Textdraw4, 0);
- TextDrawLetterSize(Textdraw4, 0.050000, 6.399999);
- TextDrawColor(Textdraw4, -1);
- TextDrawSetOutline(Textdraw4, 0);
- TextDrawSetProportional(Textdraw4, 1);
- TextDrawSetShadow(Textdraw4, 1);
- TextDrawUseBox(Textdraw4, 1);
- TextDrawBoxColor(Textdraw4, -1);
- TextDrawTextSize(Textdraw4, 218.000000, 254.000000);
- Textdraw5 = TextDrawCreate(245.000000, 315.000000, "Benutze ~r~SHIFT~w~ um das gewaehlte Fahrzeug");
- TextDrawBackgroundColor(Textdraw5, 255);
- TextDrawFont(Textdraw5, 1);
- TextDrawLetterSize(Textdraw5, 0.500000, 1.000000);
- TextDrawColor(Textdraw5, -1);
- TextDrawSetOutline(Textdraw5, 0);
- TextDrawSetProportional(Textdraw5, 1);
- TextDrawSetShadow(Textdraw5, 1);
- Textdraw6 = TextDrawCreate(246.000000, 327.000000, "zu kaufen");
- TextDrawBackgroundColor(Textdraw6, 255);
- TextDrawFont(Textdraw6, 1);
- TextDrawLetterSize(Textdraw6, 0.500000, 1.000000);
- TextDrawColor(Textdraw6, -1);
- TextDrawSetOutline(Textdraw6, 0);
- TextDrawSetProportional(Textdraw6, 1);
- TextDrawSetShadow(Textdraw6, 1);
- Textdraw7 = TextDrawCreate(247.000000, 339.000000, "Nutze ~r~Numpad Links/Rechts~w~ um die");
- TextDrawBackgroundColor(Textdraw7, 255);
- TextDrawFont(Textdraw7, 1);
- TextDrawLetterSize(Textdraw7, 0.500000, 1.000000);
- TextDrawColor(Textdraw7, -1);
- TextDrawSetOutline(Textdraw7, 0);
- TextDrawSetProportional(Textdraw7, 1);
- TextDrawSetShadow(Textdraw7, 1);
- Textdraw8 = TextDrawCreate(249.000000, 352.000000, "einzelnen Fahrzeuge durchzublaettern");
- TextDrawBackgroundColor(Textdraw8, 255);
- TextDrawFont(Textdraw8, 1);
- TextDrawLetterSize(Textdraw8, 0.500000, 1.000000);
- TextDrawColor(Textdraw8, -1);
- TextDrawSetOutline(Textdraw8, 0);
- TextDrawSetProportional(Textdraw8, 1);
- TextDrawSetShadow(Textdraw8, 1);
- Textdraw9 = TextDrawCreate(36.000000, 383.000000, "Nutze ~r~F/Enter~w~ um das Autohaus zu verlassen");
- TextDrawBackgroundColor(Textdraw9, 255);
- TextDrawFont(Textdraw9, 1);
- TextDrawLetterSize(Textdraw9, 0.500000, 1.000000);
- TextDrawColor(Textdraw9, -1);
- TextDrawSetOutline(Textdraw9, 0);
- TextDrawSetProportional(Textdraw9, 1);
- TextDrawSetShadow(Textdraw9, 1);
- 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\
- 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 ");
- TextDrawBackgroundColor(Textdraw10, 255);
- TextDrawFont(Textdraw10, 1);
- TextDrawLetterSize(Textdraw10, 0.549999, 1.800000);
- TextDrawColor(Textdraw10, 255);
- TextDrawSetOutline(Textdraw10, 0);
- TextDrawSetProportional(Textdraw10, 1);
- TextDrawSetShadow(Textdraw10, 1);
- TextDrawUseBox(Textdraw10, 1);
- TextDrawBoxColor(Textdraw10, 255);
- TextDrawTextSize(Textdraw10, 32.000000, 37.000000);
- Textdraw11 = TextDrawCreate(10.000000, 421.000000, "Unten");
- TextDrawBackgroundColor(Textdraw11, 255);
- TextDrawFont(Textdraw11, 1);
- TextDrawLetterSize(Textdraw11, 0.549999, 2.999999);
- TextDrawColor(Textdraw11, 255);
- TextDrawSetOutline(Textdraw11, 0);
- TextDrawSetProportional(Textdraw11, 1);
- TextDrawSetShadow(Textdraw11, 1);
- TextDrawUseBox(Textdraw11, 1);
- TextDrawBoxColor(Textdraw11, 255);
- TextDrawTextSize(Textdraw11, 656.000000, 37.000000);
- 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 ");
- TextDrawBackgroundColor(Textdraw12, 255);
- TextDrawFont(Textdraw12, 1);
- TextDrawLetterSize(Textdraw12, 0.549999, 1.800000);
- TextDrawColor(Textdraw12, 255);
- TextDrawSetOutline(Textdraw12, 0);
- TextDrawSetProportional(Textdraw12, 1);
- TextDrawSetShadow(Textdraw12, 1);
- TextDrawUseBox(Textdraw12, 1);
- TextDrawBoxColor(Textdraw12, 255);
- TextDrawTextSize(Textdraw12, 603.000000, 37.000000);
- Textdraw13 = TextDrawCreate(476.000000, 417.000000, "~r~ | ~w~ ||");
- TextDrawBackgroundColor(Textdraw13, 255);
- TextDrawFont(Textdraw13, 1);
- TextDrawLetterSize(Textdraw13, 1.420000, 7.199999);
- TextDrawColor(Textdraw13, -1);
- TextDrawSetOutline(Textdraw13, 0);
- TextDrawSetProportional(Textdraw13, 1);
- TextDrawSetShadow(Textdraw13, 1);
- loadAutoHausInformation();
- AutoHausInfo[Label] = Text3D:-1;
- AutoHausInfo[Pickup] = -1;
- SetTimer("SaveAutoHausInformation",30000,1);
- #endif
- #if defined ERROR
- print("\n\n WARNUNG: Das Autohaus konnte nicht initialisiert werden,\n da das Include \"CameraMoving\" nicht implentiert wurde...\n\n");
- #endif
- print("Lade Fahrzeuge...\n\n");
- LoadVehicles();
- print("Suche nach Updates...\nBitte warten\n\n");
- HTTP(0, HTTP_GET, "www.all-web-vserver.de/MyStuff/RVVehicle/index.php", "", "MOD_VERSIONCHECK");
- return 1;
- }
- public OnFilterScriptExit()
- {
- #if defined AUTOHAUS
- Delete3DTextLabel(AutoHausInfo[Label]);
- DestroyPickup(AutoHausInfo[Pickup]);
- TextDrawDestroy(Textdraw1);
- TextDrawDestroy(Textdraw2);
- TextDrawDestroy(Textdraw4);
- TextDrawDestroy(Textdraw5);
- TextDrawDestroy(Textdraw6);
- TextDrawDestroy(Textdraw7);
- TextDrawDestroy(Textdraw8);
- TextDrawDestroy(Textdraw9);
- for(new i = 0;i<MAX_PLAYERS;i++)
- if(IsPlayerConnected(i))
- {
- TextDrawDestroy(SpielerData[i][Textdraw0]);
- TextDrawDestroy(SpielerData[i][Textdraw3]);
- }
- #endif
- for(new i = 0;i< MAX_VEHICLES;i++)
- if(IsKaufbaresAuto[i])
- {
- DestroyVehicle(i);
- SaveVehicle(i);
- if(strmatch(AutoData[i][Owner],"Niemand"))
- Delete3DTextLabel(AutoData[i][dtext]);
- }
- }
- public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
- {
- switch(dialogid)
- {
- case DIALOG_BUY:
- {
- if(response == 1)
- {
- if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,ROT,"Du befindest dich in keinem Auto");
- if(!IsKaufbaresAuto[GetPlayerVehicleID(playerid)]) return SendClientMessage(playerid,ROT,"Dieses Auto steht nicht zum Verkauf");
- if(GetPlayerMoney(playerid) < AutoData[GetPlayerVehicleID(playerid)][Price]) return SendClientMessage(playerid,ROT,"Du hast zuwenig Geld!"),
- RemovePlayerFromVehicle(playerid);
- GivePlayerMoney(playerid,-AutoData[GetPlayerVehicleID(playerid)][Price]);
- strmid(AutoData[GetPlayerVehicleID(playerid)][Owner],PlayerName(playerid),0,MAX_NOM,MAX_NOM);
- SendClientMessage(playerid,GREEN,"Glückwunsch zu Ihrem neuen Fahrzeug!");
- strmid(AutoData[GetPlayerVehicleID(playerid)][Keys],PlayerName(playerid),0,20,20);
- SaveVehicle(GetPlayerVehicleID(playerid));
- Delete3DTextLabel(AutoData[GetPlayerVehicleID(playerid)][dtext]);
- }
- else return RemovePlayerFromVehicle(playerid);
- }
- case DIALOG_CONFIG:
- {
- if(listitem == 1 && response == 1)
- ShowPlayerDialog(playerid,DIALOG_SETOWNER,DIALOG_STYLE_INPUT,"Besitzer ändern","Geben Sie hier den neuen Besitzer ein:","Bestätigen","Zurück");
- if(listitem == 0 && response == 1)
- {
- new string[1024],Keysplit[MAX_KEYS][MAX_NOM];
- split(AutoData[GetPlayerVehicleID(playerid)][Keys],Keysplit,',');
- for(new i=0;i<MAX_KEYS;i++)
- {
- if(!strmatch(Keysplit[i],""))
- format(string,1024,"%s\n%s",string,Keysplit[i]);
- }
- format(string,1024,"Um einen Schlüssel hinzuzufügen, tippen Sie den Namen unten ein\nUm einen Schlüssel zu entfernen,\
- tippen Sie den Namen unten ein\n\n\n------Aktuelle Schlüssel:------\n%s",string);
- ShowPlayerDialog(playerid,DIALOG_KEYSETTINGS,DIALOG_STYLE_INPUT,"Schlüsselverteilung ändern",string,"Bestätigen","Zurück");
- }
- }
- case DIALOG_KEYSETTINGS:
- {
- if(response == 0) return ShowPlayerDialog(playerid,DIALOG_CONFIG,DIALOG_STYLE_LIST,"Autokonfiguration","Schlüsselverteilung\nBesitzer ändern","Wählen","Verlassen");
- if(HasPlayerKey(inputtext,GetPlayerVehicleID(playerid)))
- if(RemovePlayerKey(inputtext,GetPlayerVehicleID(playerid)))return SendClientMessage(playerid,GREEN,"Schlüssel erfolgreich entfernt!");
- else return SendClientMessage(playerid,ROT,"Schlüssel konnte nicht entfernt werden!");
- if(!HasPlayerKey(inputtext,GetPlayerVehicleID(playerid)))
- if(AddPlayerKey(inputtext,GetPlayerVehicleID(playerid)))return SendClientMessage(playerid,GREEN,"Schlüssel erfolgreich geaddet!");
- else return SendClientMessage(playerid,ROT,"Schlüssel konnte nicht geaddet werden!");
- }
- case DIALOG_SETOWNER:
- {
- if(response == 0) return ShowPlayerDialog(playerid,DIALOG_CONFIG,DIALOG_STYLE_LIST,"Autokonfiguration","Schlüsselverteilung\nBesitzer ändern","Wählen","Verlassen");
- strmid(AutoData[GetPlayerVehicleID(playerid)][Owner],inputtext,0,20,20);
- SaveVehicle(GetPlayerVehicleID(playerid));
- SendClientMessage(playerid,GREEN,"Du hast den Besitzer erfolgreich geändert!");
- }
- case DIALOG_EDITVEH:
- {
- new string1[128],string2[128],id=strval(inputtext);
- format(string1,128,"FahrzeugID %d",id);
- format(string2,128,editfunctions,id,GetVehicleModelName(id),AutoData[id][Col1],AutoData[id][Col2],AutoData[id][Owner],AutoData[id][Price]);
- if(!IsKaufbaresAuto[id]) return SendClientMessage(playerid,ROT,"Dieses Auto kann nicht bearbeitet werden!");
- SpielerData[playerid][SelectedVeh]=id;
- ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,string1,string2,"Wählen","Zurück");
- }
- case DIALOG_EDIT:
- {
- if(response == 1)
- {
- if(listitem == 0)
- {
- new string1[128],string2[128],id=SpielerData[playerid][SelectedVeh];
- format(string1,128,"FahrzeugID %d",id);
- format(string2,128,editfunctions,id,GetVehicleModelName(id),AutoData[id][Col1],AutoData[id][Col2],AutoData[id][Owner],AutoData[id][Price]);
- if(!IsKaufbaresAuto[id]) return SendClientMessage(playerid,ROT,"Dieses Auto kann nicht bearbeitet werden!");
- return ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,string1,string2,"Wählen","Zurück");
- }
- ShowPlayerDialog(playerid,DIALOG_EDITFUNC,DIALOG_STYLE_INPUT,"Eingabe","Geben Sie nun einen neuen Wert ein:","Bestätigen","Zurück");
- return SpielerData[playerid][ChosenField]=listitem;
- }
- }
- case DIALOG_EDITFUNC:
- {
- if(response == 1)
- {
- new newvalue = strval(inputtext),vehid = SpielerData[playerid][SelectedVeh],string1[128],string2[128];
- switch(SpielerData[playerid][ChosenField])
- {
- case 1: AutoData[vehid][Model] = newvalue;
- case 2: AutoData[vehid][Col1] = newvalue;
- case 3: AutoData[vehid][Col2] = newvalue;
- case 4:
- {
- if(strmatch(AutoData[vehid][Owner],"Niemand"))
- Delete3DTextLabel(AutoData[vehid][dtext]);
- strmid(AutoData[vehid][Owner],inputtext,0,strlen(inputtext),MAX_NOM);
- }
- case 5: AutoData[vehid][Price] = newvalue;
- }
- format(string1,128,"FahrzeugID %d",vehid);
- format(string2,128,editfunctions,vehid,GetVehicleModelName(vehid),AutoData[vehid][Col1],AutoData[vehid][Col2],AutoData[vehid][Owner],AutoData[vehid][Price]);
- if(!IsKaufbaresAuto[vehid]) return SendClientMessage(playerid,ROT,"Dieses Auto kann nicht bearbeitet werden!");
- ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,string1,string2,"Wählen","Zurück");
- RespawnVehicle(vehid);
- }
- if(response == 0) return ShowPlayerDialog(playerid,DIALOG_EDITVEH,DIALOG_STYLE_INPUT,"Fahrzeug-Bearbeitung","Bitte geben Sie die zu\
- bearbeitende Fahrzeug ID ein:","Absenden","Abbrechen");
- }
- }
- return 0;
- }
- public OnPlayerDisconnect(playerid)
- {
- #if defined AUTOHAUS
- TextDrawDestroy(SpielerData[playerid][Textdraw0]);
- TextDrawDestroy(SpielerData[playerid][Textdraw3]);
- TogglePlayerLiveView(playerid);
- #endif
- SpielerData[playerid][SelectedVeh] = 0;
- SpielerData[playerid][liveview] = 0;
- SpielerData[playerid][LiveViewPos] = 0;
- SpielerData[playerid][CurrVeh] = 0;
- SpielerData[playerid][CurrVehID] = 0;
- return 1;
- }
- #if defined AUTOHAUS
- public OnPlayerEnterCheckpoint(playerid)if(SpielerData[playerid][autokauf] == 1)return DisablePlayerCheckpoint(playerid)&(SpielerData[playerid][autokauf] = 0);
- else return 0;
- public OnPlayerConnect(playerid)return CreatePlayersTextDraws(playerid);
- stock CreatePlayersTextDraws(playerid)
- {
- // Erstelle die textdraws:
- SpielerData[playerid][Textdraw0] = TextDrawCreate(36.000000, 339.000000, "Preis:");
- TextDrawBackgroundColor(SpielerData[playerid][Textdraw0], 255);
- TextDrawFont(SpielerData[playerid][Textdraw0], 1);
- TextDrawLetterSize(SpielerData[playerid][Textdraw0], 0.430000, 2.200000);
- TextDrawColor(SpielerData[playerid][Textdraw0], -1);
- TextDrawSetOutline(SpielerData[playerid][Textdraw0], 0);
- TextDrawSetProportional(SpielerData[playerid][Textdraw0], 1);
- TextDrawSetShadow(SpielerData[playerid][Textdraw0], 1);
- SpielerData[playerid][Textdraw3] = TextDrawCreate(35.000000, 319.000000, "Modell:");
- TextDrawBackgroundColor(SpielerData[playerid][Textdraw3], 255);
- TextDrawFont(SpielerData[playerid][Textdraw3], 1);
- TextDrawLetterSize(SpielerData[playerid][Textdraw3], 0.430000, 2.200000);
- TextDrawColor(SpielerData[playerid][Textdraw3], -1);
- TextDrawSetOutline(SpielerData[playerid][Textdraw3], 0);
- TextDrawSetProportional(SpielerData[playerid][Textdraw3], 1);
- TextDrawSetShadow(SpielerData[playerid][Textdraw3], 1);
- return 1;
- }
- stock ShowPlayerAutohausVehicle(playerid,count)
- {
- if(SpielerData[playerid][liveview] != 1) return 0;
- new chosenveh = SpielerData[playerid][CurrVeh]+count;
- SpielerData[playerid][CurrVeh]+=count;
- DestroyVehicle(SpielerData[playerid][CurrVehID]);
- SpielerData[playerid][CurrVehID] = CreateVehicle(OwnerVehicleInfo[chosenveh][model1],
- LiveViewCoords[1][0],LiveViewCoords[1][1],LiveViewCoords[1][2],0.0,0,0,-1);
- SetVehicleVirtualWorld(SpielerData[playerid][CurrVehID],playerid+1);
- new tmpstring[64];
- format(tmpstring,64,"Preis: %d$",OwnerVehicleInfo[chosenveh][price1]);
- TextDrawSetString(SpielerData[playerid][Textdraw0],tmpstring);
- format(tmpstring,64,"Modell: %s",GetVehicleModelName(SpielerData[playerid][CurrVehID]));
- TextDrawSetString(SpielerData[playerid][Textdraw3],tmpstring);
- return 1;
- }
- stock loadAutoHausInformation()// PLATZHALTER: DELETE
- {
- new formatLD[256];
- format(formatLD,256,"Cars/AutohausInformation.cfg");
- if(dini_Exists(formatLD))
- {
- AutoHausInfo[PosX] = dini_Float(formatLD,"PosX");
- AutoHausInfo[PosY] = dini_Float(formatLD,"PosY");
- AutoHausInfo[PosZ] = dini_Float(formatLD,"PosZ");
- AutoHausInfo[VehSpawnX] = dini_Float(formatLD,"VehSpawnX");
- AutoHausInfo[VehSpawnY] = dini_Float(formatLD,"VehSpawnY");
- AutoHausInfo[VehSpawnZ] = dini_Float(formatLD,"VehSpawnZ");
- AutoHausInfo[VehSpawnRot] = dini_Float(formatLD,"VehSpawnRot");
- AutoHausInfo[Label] = Create3DTextLabel("Tippe hier /autohaus\num zur Autoauswahl\nzu gelangen",BLUE,
- AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],drawdistance,0,1);
- AutoHausInfo[Pickup] = CreatePickup(1239,1,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],0);
- }
- else
- {
- dini_Create(formatLD);
- }
- return 1;
- }
- stock loadAutoHausInformations() // PLATZHALTER: GO ON
- {
- new formatLD[256];
- for(new i = 0;i < MAX_AUTOHAUSES;i++)
- {
- format(formatLD,256,"Cars/Ownership_%d.cfg",i);
- if(dini_Exists(formatLD))
- {
- AutoHausInfoNew[i][PosX] = dini_Float(formatLD,"PosX");
- AutoHausInfoNew[i][PosY] = dini_Float(formatLD,"PosY");
- AutoHausInfoNew[i][PosZ] = dini_Float(formatLD,"PosZ");
- AutoHausInfoNew[i][VehSpawnX] = dini_Float(formatLD,"VehSpawnX");
- AutoHausInfoNew[i][VehSpawnY] = dini_Float(formatLD,"VehSpawnY");
- AutoHausInfoNew[i][VehSpawnZ] = dini_Float(formatLD,"VehSpawnZ");
- AutoHausInfoNew[i][VehSpawnRot] = dini_Float(formatLD,"VehSpawnRot");
- AutoHausInfoNew[i][VehSpawnRot] = Create3DTextLabel("Tippe hier /autohaus\num zur Autoauswahl\nzu gelangen",BLUE,
- AutoHausInfoNew[i][PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],drawdistance,0,1);
- AutoHausInfoNew[i][Pickup] = CreatePickup(1239,1,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],0);
- }
- }
- return 1;
- }
- Function SaveAutoHausInformation()
- {
- new formatLD[256];
- format(formatLD,256,"Cars/AutohausInformation.cfg");
- if(dini_Exists(formatLD))
- {
- dini_FloatSet(formatLD,"PosX",AutoHausInfo[PosX]);
- dini_FloatSet(formatLD,"PosY",AutoHausInfo[PosY]);
- dini_FloatSet(formatLD,"PosZ",AutoHausInfo[PosZ]);
- dini_FloatSet(formatLD,"VehSpawnX",AutoHausInfo[VehSpawnX]);
- dini_FloatSet(formatLD,"VehSpawnY",AutoHausInfo[VehSpawnY]);
- dini_FloatSet(formatLD,"VehSpawnZ",AutoHausInfo[VehSpawnZ]);
- dini_FloatSet(formatLD,"VehSpawnRot",AutoHausInfo[VehSpawnRot]);
- }
- else
- {
- dini_Create(formatLD);
- }
- }
- stock TogglePlayerLiveView(playerid,toggle = 0)
- {
- if(toggle == 0)
- {
- SetPlayerVirtualWorld(playerid,0);
- SetPlayerInterior(playerid,0);
- SetPlayerPos(playerid,SpielerData[playerid][PlayerPosX],SpielerData[playerid][PlayerPosY],SpielerData[playerid][PlayerPosZ]);
- DestroyVehicle(SpielerData[playerid][CurrVehID]);
- SpielerData[playerid][liveview] = 0;
- SpielerData[playerid][LiveViewPos] = 1;
- SpielerData[playerid][CurrVehID] = -1;
- PauseCameraMoving(playerid);
- SetCameraBehindPlayer(playerid);
- TextDrawHideForPlayer(playerid,SpielerData[playerid][Textdraw0]);
- TextDrawHideForPlayer(playerid,Textdraw1);
- TextDrawHideForPlayer(playerid,Textdraw2);
- TextDrawHideForPlayer(playerid,SpielerData[playerid][Textdraw3]);
- TextDrawHideForPlayer(playerid,Textdraw4);
- TextDrawHideForPlayer(playerid,Textdraw5);
- TextDrawHideForPlayer(playerid,Textdraw6);
- TextDrawHideForPlayer(playerid,Textdraw7);
- TextDrawHideForPlayer(playerid,Textdraw8);
- TextDrawHideForPlayer(playerid,Textdraw9);
- TextDrawHideForPlayer(playerid,Textdraw10);
- TextDrawHideForPlayer(playerid,Textdraw11);
- TextDrawHideForPlayer(playerid,Textdraw12);
- TextDrawHideForPlayer(playerid,Textdraw13);
- TogglePlayerControllable(playerid,1);
- return 1;
- }
- else
- {
- GetPlayerPos(playerid,SpielerData[playerid][PlayerPosX],SpielerData[playerid][PlayerPosY],SpielerData[playerid][PlayerPosZ]);
- SetPlayerVirtualWorld(playerid,playerid+1);
- SetPlayerInterior(playerid,0);
- SetPlayerPos(playerid,LiveViewCoords[0][0],LiveViewCoords[0][1],LiveViewCoords[0][2]);
- SpielerData[playerid][liveview] = 1;
- SpielerData[playerid][LiveViewPos] = 2;
- TextDrawShowForPlayer(playerid,SpielerData[playerid][Textdraw0]);
- TextDrawShowForPlayer(playerid,Textdraw1);
- TextDrawShowForPlayer(playerid,Textdraw2);
- TextDrawShowForPlayer(playerid,SpielerData[playerid][Textdraw3]);
- TextDrawShowForPlayer(playerid,Textdraw4);
- TextDrawShowForPlayer(playerid,Textdraw5);
- TextDrawShowForPlayer(playerid,Textdraw6);
- TextDrawShowForPlayer(playerid,Textdraw7);
- TextDrawShowForPlayer(playerid,Textdraw8);
- TextDrawShowForPlayer(playerid,Textdraw9);
- TextDrawShowForPlayer(playerid,Textdraw10);
- TextDrawShowForPlayer(playerid,Textdraw11);
- TextDrawShowForPlayer(playerid,Textdraw12);
- TextDrawShowForPlayer(playerid,Textdraw13);
- ShowPlayerAutohausVehicle(playerid,0);
- PauseCameraMoving(playerid);
- SetPlayerCameraPos(playerid,LiveViewCoords[2][0],LiveViewCoords[2][1],LiveViewCoords[2][2]);
- MovePlayerCameraEx(playerid,LiveViewCoords[2][0],LiveViewCoords[2][1],LiveViewCoords[2][2],
- LiveViewCoords[3][0],LiveViewCoords[3][1],LiveViewCoords[3][2],LiveViewCoords[1][0],
- LiveViewCoords[1][1],LiveViewCoords[1][2]-DIFF,CAMSPEED);
- TogglePlayerControllable(playerid,0);
- return 1;
- }
- }
- public OnCameraMoveFinish(playerid)
- {
- if(SpielerData[playerid][liveview] == 1)
- {
- new Pos = (SpielerData[playerid][LiveViewPos] == 2) ? 4 : 2;
- MovePlayerCameraEx(playerid, LiveViewCoords[Pos][0],LiveViewCoords[Pos][1],LiveViewCoords[Pos][2],
- LiveViewCoords[Pos+1][0],LiveViewCoords[Pos+1][1],LiveViewCoords[Pos+1][2],LiveViewCoords[1][0],
- LiveViewCoords[1][1],LiveViewCoords[1][2]-DIFF,CAMSPEED);
- return SpielerData[playerid][LiveViewPos] = (Pos == 4) ? 1 : 2;
- }
- else return TogglePlayerLiveView(playerid);
- }
- /*
- public OnCameraMoveFinish(playerid)
- {
- if(SpielerData[playerid][liveview] == 1)
- {
- if(SpielerData[playerid][LiveViewPos] == 2)
- {
- MovePlayerCameraEx(playerid,LiveViewCoords[4][0],LiveViewCoords[4][1],LiveViewCoords[4][2],
- LiveViewCoords[5][0],LiveViewCoords[5][1],LiveViewCoords[5][2],LiveViewCoords[1][0],
- LiveViewCoords[1][1],LiveViewCoords[1][2]-DIFF,CAMSPEED);
- return SpielerData[playerid][LiveViewPos] = 1;
- }
- if(SpielerData[playerid][LiveViewPos] == 1)
- {
- MovePlayerCameraEx(playerid,LiveViewCoords[2][0],LiveViewCoords[2][1],LiveViewCoords[2][2],
- LiveViewCoords[3][0],LiveViewCoords[3][1],LiveViewCoords[3][2],LiveViewCoords[1][0],
- LiveViewCoords[1][1],LiveViewCoords[1][2]-DIFF,CAMSPEED);
- SpielerData[playerid][LiveViewPos] = 2;
- }
- }
- #define host "db4free.net:3306" #define mysqluser "tmthebess" #define mysqlpass "rauchen" #define database "tmthebess"
- else return TogglePlayerLiveView(playerid);
- return 1;
- }*/
- #endif
- stock LoadVehicles() //Fertig
- {
- for(new i = 0; i< MAX_OWNEDVEHICLES;i++)
- {
- new formatLD[256];
- format(formatLD,256,"Cars/%d_ownerauto.ini",i);
- if(dini_Exists(formatLD))
- {
- new model,price,col1,col2,locked,Float:x,Float:y,Float:z,Float:r;
- model=dini_Int(formatLD, "Model");
- price=dini_Int(formatLD, "Price");
- col1=dini_Int(formatLD, "Col1");
- col2=dini_Int(formatLD, "Col2");
- locked=dini_Int(formatLD, "Locked");
- x=dini_Float(formatLD, "SpawnX");
- y=dini_Float(formatLD, "SpawnY");
- z=dini_Float(formatLD, "SpawnZ");
- r=dini_Float(formatLD, "SpawnRot");
- new veh = CreateVehicle(model,x,y,z,r,col1,col2,-1);
- strmid(AutoData[veh][Owner],dini_Get(formatLD, "Owner"),0,12,12);
- AutoData[veh][Model]=model;
- AutoData[veh][Price]=price;
- AutoData[veh][Col1]=col1;
- AutoData[veh][Col2]=col2;
- strmid(AutoData[veh][Keys],dini_Get(formatLD, "Keys"),0,MAX_NOM*MAX_KEYS,MAX_NOM*MAX_KEYS);
- AutoData[veh][Locked]=locked;
- AutoData[veh][SpawnX]=x;
- AutoData[veh][SpawnY]=y;
- AutoData[veh][SpawnZ]=z;
- AutoData[veh][SpawnRot]=r;
- IsKaufbaresAuto[veh] = 1;
- AutoData[veh][ID]= i;
- AutoData[veh][dtext] = Text3D:-1;
- AutoData[veh][mod1] = dini_Int(formatLD, "mod1");
- AutoData[veh][mod2] = dini_Int(formatLD, "mod2");
- AutoData[veh][mod3] = dini_Int(formatLD, "mod3");
- AutoData[veh][mod4] = dini_Int(formatLD, "mod4");
- AutoData[veh][mod5] = dini_Int(formatLD, "mod5");
- AutoData[veh][mod6] = dini_Int(formatLD, "mod6");
- AutoData[veh][mod7] = dini_Int(formatLD, "mod7");
- AutoData[veh][mod8] = dini_Int(formatLD, "mod8");
- AutoData[veh][mod9] = dini_Int(formatLD, "mod9");
- AutoData[veh][mod10] = dini_Int(formatLD, "mod10");
- AutoData[veh][mod11] = dini_Int(formatLD, "mod11");
- AutoData[veh][mod12] = dini_Int(formatLD, "mod12");
- AutoData[veh][mod13] = dini_Int(formatLD, "mod13");
- AutoData[veh][mod14] = dini_Int(formatLD, "mod14");
- AutoData[veh][mod15] = dini_Int(formatLD, "mod15");
- AutoData[veh][mod16] = dini_Int(formatLD, "mod16");
- AutoData[veh][mod17] = dini_Int(formatLD, "mod17");
- AutoData[veh][VehSkin] = dini_Int(formatLD, "VehSkin");
- AddCarComponents(veh);
- SetVehicleNumberPlate(veh,AutoData[veh][Owner]);
- if(strmatch(AutoData[veh][Owner],"Niemand"))
- {
- new string[256];
- SetVehicleNumberPlate(veh,"FOR SALE");
- format(string,256,"Dieses Fahrzeug steht zum Verkauf\nModell:%s\nPreis:%d$",GetVehicleModelName(veh),AutoData[veh][Price]);
- AutoData[veh][dtext]=Create3DTextLabel(string,BLUE,0.0,0.0,0.0,drawdistance,1);
- Attach3DTextLabelToVehicle(AutoData[veh][dtext],veh,0,0,0.0);
- }
- }
- }
- GetEmptyFile();
- return 1;
- }
- stock SaveVehicle(vehicleid) // Fertig
- {
- if(!IsKaufbaresAuto[vehicleid]) return 0;
- new formatLD[256];
- format(formatLD,256,"Cars/%d_ownerauto.ini",AutoData[vehicleid][ID]);
- if(dini_Exists(formatLD))
- {
- dini_Set(formatLD,"Owner",AutoData[vehicleid][Owner]);
- dini_IntSet(formatLD,"Model",AutoData[vehicleid][Model]);
- dini_IntSet(formatLD,"Col1",AutoData[vehicleid][Col1]);
- dini_IntSet(formatLD,"Col2",AutoData[vehicleid][Col2]);
- dini_IntSet(formatLD,"Price",AutoData[vehicleid][Price]);
- dini_Set(formatLD,"Keys",AutoData[vehicleid][Keys]);
- dini_IntSet(formatLD,"Locked",AutoData[vehicleid][Locked]);
- dini_FloatSet(formatLD,"SpawnX",AutoData[vehicleid][SpawnX]);
- dini_FloatSet(formatLD,"SpawnY",AutoData[vehicleid][SpawnY]);
- dini_FloatSet(formatLD,"SpawnZ",AutoData[vehicleid][SpawnZ]);
- dini_FloatSet(formatLD,"SpawnRot",AutoData[vehicleid][SpawnRot]);
- dini_IntSet(formatLD,"mod1",AutoData[vehicleid][mod1]);
- dini_IntSet(formatLD,"mod2",AutoData[vehicleid][mod2]);
- dini_IntSet(formatLD,"mod3",AutoData[vehicleid][mod3]);
- dini_IntSet(formatLD,"mod4",AutoData[vehicleid][mod4]);
- dini_IntSet(formatLD,"mod5",AutoData[vehicleid][mod5]);
- dini_IntSet(formatLD,"mod6",AutoData[vehicleid][mod6]);
- dini_IntSet(formatLD,"mod7",AutoData[vehicleid][mod8]);
- dini_IntSet(formatLD,"mod9",AutoData[vehicleid][mod9]);
- dini_IntSet(formatLD,"mod10",AutoData[vehicleid][mod10]);
- dini_IntSet(formatLD,"mod11",AutoData[vehicleid][mod11]);
- dini_IntSet(formatLD,"mod12",AutoData[vehicleid][mod12]);
- dini_IntSet(formatLD,"mod13",AutoData[vehicleid][mod13]);
- dini_IntSet(formatLD,"mod14",AutoData[vehicleid][mod14]);
- dini_IntSet(formatLD,"mod15",AutoData[vehicleid][mod15]);
- dini_IntSet(formatLD,"mod16",AutoData[vehicleid][mod16]);
- dini_IntSet(formatLD,"mod17",AutoData[vehicleid][mod17]);
- dini_IntSet(formatLD,"VehSkin",AutoData[vehicleid][VehSkin]);
- }
- else
- {
- dini_Create(formatLD);
- SaveVehicle(vehicleid); // Wiederhole Befehl nachdem Datei erstellt
- }
- return 1;
- }
- stock GetEmptyFile()
- {
- new formatLD[256];
- for(new id = 0; id<MAX_OWNEDVEHICLES;id++)
- {
- format(formatLD,256,"Cars/%d_ownerauto.ini",id);
- if(!fexist(formatLD))
- Emptyfile=id;
- }
- return 1;
- }
- stock DestroyOwnedVehicle(vehicleid)
- {
- new formatLD[256];
- format(formatLD,256,"Cars/%d_ownerauto.ini",AutoData[vehicleid][ID]);
- if(!dini_Exists(formatLD)) return 0;
- else
- {
- DestroyVehicle(vehicleid);
- IsKaufbaresAuto[vehicleid] = 0;
- dini_Remove(formatLD);
- if(strmatch(AutoData[vehicleid][Owner],"Niemand"))
- Delete3DTextLabel(AutoData[vehicleid][dtext]);
- }
- return 1;
- }
- stock CreateNewVehicle(model,Float:x,Float:y,Float:z,Float:rot,price,col1,col2) // Fertig
- {
- GetEmptyFile();
- new tmpid = CreateVehicle(model,x,y,z,rot,col1,col2,-1);
- new formatLD[256];
- format(formatLD,256,"Cars/%d_ownerauto.ini",Emptyfile);
- if(dini_Exists(formatLD)) return GetEmptyFile();
- strmid(AutoData[tmpid][Owner],"Niemand",0,7,MAX_NOM);
- AutoData[tmpid][Model]=model;
- AutoData[tmpid][ID] = Emptyfile;
- AutoData[tmpid][Price]=price;
- AutoData[tmpid][Col1]=col1;
- AutoData[tmpid][Col2]=col2;
- strmid(AutoData[tmpid][Keys],"",0,0,MAX_KEYS*MAX_NOM);
- AutoData[tmpid][Locked]=0;
- AutoData[tmpid][SpawnX]=x;
- AutoData[tmpid][SpawnY]=y;
- AutoData[tmpid][SpawnZ]=z;
- AutoData[tmpid][SpawnRot]=rot;
- IsKaufbaresAuto[tmpid]= 1;
- new string[256];
- SetVehicleNumberPlate(tmpid,"FOR SALE");
- format(string,256,"Dieses Fahrzeug steht zum Verkauf\nModell:%s\nPreis:%d$",GetVehicleModelName(tmpid),AutoData[tmpid][Price]);
- AutoData[tmpid][dtext]=Create3DTextLabel(string,BLUE,x,y,z,drawdistance,1);
- Attach3DTextLabelToVehicle(AutoData[tmpid][dtext],tmpid,0,0,0.0);
- IsKaufbaresAuto[tmpid] = 1;
- dini_Create(formatLD);
- SaveVehicle(tmpid);
- return tmpid;
- }
- stock strmatch(const String1[], const String2[])
- {
- if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- stock AddCarComponents(vehicleid)
- {
- if(AutoData[vehicleid][mod1]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod1]);
- if(AutoData[vehicleid][mod2]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod2]);
- if(AutoData[vehicleid][mod3]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod3]);
- if(AutoData[vehicleid][mod4]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod4]);
- if(AutoData[vehicleid][mod5]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod5]);
- if(AutoData[vehicleid][mod6]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod6]);
- if(AutoData[vehicleid][mod7]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod7]);
- if(AutoData[vehicleid][mod8]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod8]);
- if(AutoData[vehicleid][mod9]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod9]);
- if(AutoData[vehicleid][mod10]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod10]);
- if(AutoData[vehicleid][mod11]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod11]);
- if(AutoData[vehicleid][mod12]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod12]);
- if(AutoData[vehicleid][mod13]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod13]);
- if(AutoData[vehicleid][mod14]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod14]);
- if(AutoData[vehicleid][mod15]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod15]);
- if(AutoData[vehicleid][mod16]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod16]);
- if(AutoData[vehicleid][mod17]!=0) AddVehicleComponent(vehicleid,AutoData[vehicleid][mod17]);
- if(AutoData[vehicleid][VehSkin]!=0) ChangeVehiclePaintjob(vehicleid,AutoData[vehicleid][VehSkin]);
- return 1;
- }
- stock FindSlotID(componentid)
- {
- new i;
- for(i=0; i<20; i++)if(spoiler[i]==componentid) return 1;
- for(i=0; i<3; i++)if(nitro[i]==componentid) return 2;
- for(i=0; i<23; i++)if(frontbumper[i]==componentid) return 3;
- for(i=0; i<22; i++)if(rbumper[i]==componentid) return 4;
- for(i=0; i<28; i++)if(exhaust[i]==componentid) return 5;
- for(i=0; i<2; i++)if(bventr[i]==componentid) return 6;
- for(i=0; i<2; i++)if(bventl[i]==componentid) return 7;
- for(i=0; i<4; i++)if(bscoop[i]==componentid) return 8;
- for(i=0; i<13; i++)if(rscoop[i]==componentid) return 9;
- for(i=0; i<21; i++)if(lskirt[i]==componentid) return 10;
- for(i=0; i<21; i++)if(rskirt[i]==componentid) return 11;
- if(hydraulics==componentid) return 12;
- if(base==componentid) return 13;
- for(i=0; i<2; i++)if(rbbars[i]==componentid) return 14;
- for(i=0; i<2; i++)if(fbbars[i]==componentid) return 15;
- for(i=0; i<17; i++)if(wheels[i]==componentid) return 16;
- for(i=0; i<2; i++)if(light[i]==componentid) return 17;
- return 0;
- }
- public OnVehiclePaintjob(playerid,vehicleid, paintjobid)
- return AutoData[vehicleid][VehSkin]=paintjobid;
- public OnVehicleMod(playerid,vehicleid,componentid)
- {
- switch (FindSlotID(componentid))
- {
- case 1: AutoData[vehicleid][mod1]=componentid;
- case 2: AutoData[vehicleid][mod2]=componentid;
- case 3: AutoData[vehicleid][mod3]=componentid;
- case 4: AutoData[vehicleid][mod4]=componentid;
- case 5: AutoData[vehicleid][mod5]=componentid;
- case 6: AutoData[vehicleid][mod6]=componentid;
- case 7: AutoData[vehicleid][mod7]=componentid;
- case 8: AutoData[vehicleid][mod8]=componentid;
- case 9: AutoData[vehicleid][mod9]=componentid;
- case 10: AutoData[vehicleid][mod10]=componentid;
- case 11: AutoData[vehicleid][mod11]=componentid;
- case 12: AutoData[vehicleid][mod12]=componentid;
- case 13: AutoData[vehicleid][mod13]=componentid;
- case 14: AutoData[vehicleid][mod14]=componentid;
- case 15: AutoData[vehicleid][mod15]=componentid;
- case 16: AutoData[vehicleid][mod16]=componentid;
- case 17: AutoData[vehicleid][mod17]=componentid;
- }
- SaveVehicle(vehicleid);
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- if(newstate == 2)
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- #if defined MOTORSYSTEM
- if(!IsKaufbaresAuto[vehicleid])ToggleVehicleEngine(vehicleid,1);
- #endif
- new string[256];
- format(string,256,"Dieses Auto kostet %d$",AutoData[vehicleid][Price]);
- if(strmatch(AutoData[vehicleid][Owner],"Niemand")) ShowPlayerDialog(playerid,DIALOG_BUY,DIALOG_STYLE_MSGBOX,"Auto erwerben",string,"Kaufen","Abbrechen");
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new vehicle = GetPlayerVehicleID(playerid);
- if(newkeys == KEY_ANALOG_DOWN || newkeys == 4104 || newkeys == 4128 || newkeys == 4224)
- {
- if(!IsKaufbaresAuto[vehicle]) return 1;
- if(!IsPlayerDriver(playerid)) return 1;
- if(!HasPlayerKey(PlayerName(playerid),vehicle)) return SendClientMessage(playerid,ROT,"Du hast keinen Schlüssel!");
- if(IsEngineOn[vehicle])
- {
- ToggleVehicleEngine(vehicle);
- IsEngineOn[vehicle] = 0;
- }
- else { ToggleVehicleEngine(vehicle,1);IsEngineOn[vehicle] = 1;}
- }
- if(newkeys == KEY_ANALOG_UP || newkeys == 2056 || newkeys == 2080 || newkeys == 2176)
- {
- if(!IsKaufbaresAuto[vehicle]) return 1;
- if(!IsPlayerDriver(playerid)) return 1;
- if(!HasPlayerKey(PlayerName(playerid),vehicle)) return SendClientMessage(playerid,ROT,"Du hast keinen Schlüssel!");
- if(AreLightsOn[vehicle])
- {
- ToggleVehicleLights(vehicle);
- AreLightsOn[vehicle]= 0;
- }
- else { ToggleVehicleLights(vehicle,1);AreLightsOn[vehicle]= 1;}
- }
- }
- #if defined AUTOHAUS
- else if(SpielerData[playerid][liveview] == 1)
- {
- if(newkeys == KEY_JUMP)
- {
- if(GetPlayerMoney(playerid) < OwnerVehicleInfo[SpielerData[playerid][CurrVeh]][price1]) return SendClientMessage(playerid,ROT,"Du hast nicht genug Geld!");
- TogglePlayerLiveView(playerid);
- new newveh = CreateNewVehicle(OwnerVehicleInfo[SpielerData[playerid][CurrVeh]][model1],
- AutoHausInfo[VehSpawnX],AutoHausInfo[VehSpawnY],AutoHausInfo[VehSpawnZ],AutoHausInfo[VehSpawnRot],
- OwnerVehicleInfo[SpielerData[playerid][CurrVeh]][price1],0,0);
- new Float:x,Float:y,Float:z;
- GetVehiclePos(newveh,x,y,z);
- SetPlayerCheckpoint(playerid,x,y,z,5.0);
- SpielerData[playerid][autokauf] = 1;
- GivePlayerMoney(playerid,-OwnerVehicleInfo[SpielerData[playerid][CurrVeh]][price1]);
- AddPlayerKey(PlayerName(playerid),newveh);
- strmid(AutoData[newveh][Owner],PlayerName(playerid),0,MAX_PLAYER_NAME,MAX_NOM);
- Delete3DTextLabel(AutoData[newveh][dtext]);
- SaveVehicle(newveh);
- SetVehicleNumberPlate(newveh,AutoData[newveh][Owner]);
- SendClientMessage(playerid,GREEN,"Fahrzeug erfolgreich gekauft! Die Position deines neuen Fahrzeugs wurde an dein Handy geschickt.");
- }
- if(newkeys == KEY_ANALOG_LEFT)
- if(SpielerData[playerid][CurrVeh] <= 0)return PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); // Fehlerton
- else
- {
- PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); // Confirmation sound
- ShowPlayerAutohausVehicle(playerid,-1);
- }
- if(newkeys == KEY_ANALOG_RIGHT)
- if(SpielerData[playerid][CurrVeh] >= sizeof(OwnerVehicleInfo)-1)return PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); // Fehlerton
- else
- {
- PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); // Confirmation sound
- ShowPlayerAutohausVehicle(playerid,1);
- }
- if(newkeys == KEY_SECONDARY_ATTACK)
- if(IsPlayerInRangeOfPoint(playerid,5.0,LiveViewCoords[0][0],LiveViewCoords[0][1],LiveViewCoords[0][2]))
- TogglePlayerLiveView(playerid);
- }
- #endif
- return 0;
- }
- ToggleVehicleEngine(vehicleid,toggle = 0)
- {
- new engine,lights,alarm,doors,bonnet,boot,objective;
- GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
- if(toggle == 1)return SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
- else return SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
- }
- ToggleVehicleLights(vehicleid,toggle = 0)
- {
- new engine,lights,alarm,doors,bonnet,boot,objective;
- GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
- if(toggle == 1)return SetVehicleParamsEx(vehicleid,engine,1,alarm,doors,bonnet,boot,objective);
- else return SetVehicleParamsEx(vehicleid,engine,0,alarm,doors,bonnet,boot,objective);
- }
- stock IsPlayerDriver(playerid)
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return 1;else return 0;
- stock Float:GetDisBetweenPlayerAndCar(p1ayerid,carid)
- {
- new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
- if(!IsPlayerConnected(p1ayerid))
- {
- return -1.00;
- }
- GetPlayerPos(p1ayerid,x1,y1,z1);
- GetVehiclePos(carid,x2,y2,z2);
- return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
- }
- stock GetNearestVehicleToPlayer(playerid,Float:Radius) // Credits to... ehm, kP
- {
- new x,Float:dis,Float:dis2,car;
- car = 0;
- dis = 99999.99;
- for ( x = 0; x < MAX_VEHICLES; x++ )
- {
- dis2 = GetDisBetweenPlayerAndCar(playerid,x);
- if(dis2 < dis && dis2 < 8.0)
- {
- dis = dis2;
- car = x;
- }
- }
- return car;
- }
- public OnPlayerEnterVehicle(playerid,vehicleid)
- {
- if(AutoData[vehicleid][VehSkin]!=0)return ChangeVehiclePaintjob(vehicleid,AutoData[vehicleid][VehSkin]);
- return 0;
- }
- public OnPlayerExitVehicle(playerid,vehicleid)
- {
- SaveVehicle(vehicleid);
- #if defined MOTORSYSTEM
- if(!IsKaufbaresAuto[vehicleid])ToggleVehicleEngine(vehicleid,0);
- #endif
- return 0;
- }
- public OnPlayerCommandText(playerid,cmdtext[])
- {
- new idx,cmd[256];
- cmd = strtok(cmdtext,idx);
- if(!strcmp(cmd,"/createcar",true))
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ROT,"Diesen Befehl kannst du nicht nutzen!");
- new Float:X,Float:Y,Float:Z,Float:Rot,model,col1,col2,price;
- GetPlayerPos(playerid,X,Y,Z);
- GetPlayerFacingAngle(playerid,Rot);
- cmd = strtok(cmdtext,idx);
- if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /createcar [modelid] [col1] [col2] [preis]");
- model = strval(cmd);
- cmd = strtok(cmdtext,idx);
- if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /createcar [modelid] [col1] [col2] [preis]");
- col1 = strval(cmd);
- cmd = strtok(cmdtext,idx);
- if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /createcar [modelid] [col1] [col2] [preis]");
- col2 = strval(cmd);
- cmd = strtok(cmdtext,idx);
- if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /createcar [modelid] [col1] [col2] [preis]");
- price = strval(cmd);
- CreateNewVehicle(model,X,Y,Z,Rot,price,col1,col2);
- return 1;
- }
- #if defined TESTMODE
- if(!strcmp(cmd,"/GELD",true))return GivePlayerMoney(playerid,50000);
- if(!strcmp(cmd,"/jetz",true))
- {
- new tmpstring[56];
- format(tmpstring,56,"Jetzige CarID %d",GetPlayerVehicleID(playerid));
- SendClientMessage(playerid,ROT,tmpstring);
- return 1;
- }
- if(!strcmp(cmd,"/specautohaus",true))
- {
- TogglePlayerLiveView(playerid, 1);
- return 1;
- }
- if(!strcmp(cmd,"/Cameramove",true))
- {
- if(IsCameraMoving(playerid))return SendClientMessage(playerid,ROT,"Bewegt");
- if(!IsCameraMoving(playerid))return SendClientMessage(playerid,GREEN,"Bewegt nicht");
- }
- #endif
- #if defined AUTOHAUS
- if(!strcmp(cmd,"/autohaus",true))
- {
- if(IsPlayerInRangeOfPoint(playerid,5.0,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ]))return TogglePlayerLiveView(playerid, 1);
- else return SendClientMessage(playerid,ROT,"Du bist nicht nahe dem Autohaus!");
- }
- if(!strcmp(cmd,"/setautohaus",true))
- {
- if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,ROT,"Du bist nicht befugt!");
- GetPlayerPos(playerid,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ]);
- Delete3DTextLabel(AutoHausInfo[Label]);
- DestroyPickup(AutoHausInfo[Pickup]);
- AutoHausInfo[Label]=Create3DTextLabel("Tippe hier /autohaus\num zur Autoauswahl\nzu gelangen",BLUE,
- AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],drawdistance,0,1);
- AutoHausInfo[Pickup] = CreatePickup(1239,1,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],0);
- return SendClientMessage(playerid,GREEN,"Autohaus erfolgreich gesetzt!");
- }
- /*
- if(!strcmp(cmd,"/createautohaus",true)) // PLATZHALTER: GO ON
- {
- if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,ROT,"Du bist nicht befugt!");
- new hid = GetEmptyAutoHaus(),formatLD[60];
- format(formatLD,sizeof formatLD, "Ownership_%d.cfg",hid);
- dini_Create(formatLD);
- AutoHausInfo[hid][Label]=Create3DTextLabel("Tippe hier /autohaus\num zur Autoauswahl\nzu gelangen",BLUE,
- AutoHausInfo[hid][PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],drawdistance,0,1);
- AutoHausInfo[hid][Pickup] = CreatePickup(1239,1,AutoHausInfo[PosX],AutoHausInfo[PosY],AutoHausInfo[PosZ],0);
- format(formatLD,sizeof formatLD, "Autohaus erfolgreich erstellt!\n Setze nun noch den Spawnpunkt mit /setautohausspawn [hid] -> Neue hid = %d",hid);
- return SendClientMessage(playerid,GREEN,formatLD);
- }*/
- if(!strcmp(cmd,"/setautohausspawn",true))
- {
- if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,ROT,"Du bist nicht befugt!");
- if(!IsPlayerInAnyVehicle(playerid))
- {
- GetPlayerPos(playerid,AutoHausInfo[VehSpawnX],AutoHausInfo[VehSpawnY],AutoHausInfo[VehSpawnZ]);
- GetPlayerFacingAngle(playerid,AutoHausInfo[VehSpawnRot]);
- }
- else
- {
- GetVehiclePos(GetPlayerVehicleID(playerid),AutoHausInfo[VehSpawnX],AutoHausInfo[VehSpawnY],AutoHausInfo[VehSpawnZ]);
- GetVehicleZAngle(GetPlayerVehicleID(playerid),AutoHausInfo[VehSpawnRot]);
- }
- return SendClientMessage(playerid,GREEN,"Autohaus-Spawn erfolgreich gesetzt!");
- }
- #endif
- if(!strcmp(cmd,"/removecar",true))
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ROT,"Diesen Befehl kannst du nicht nutzen!");
- cmd = strtok(cmdtext,idx);
- if(!cmd[0]) return SendClientMessage(playerid,ROT,"Parameter: /removecar [vehicleid] //Dieser Befehl löscht ein Fahrzeug unwiderruflich");
- new vehid = strval(cmd);
- DestroyOwnedVehicle(vehid);
- SendClientMessage(playerid,GREEN,"Fahrzeug erfolgreich gelöscht!");
- return 1;
- }
- if(!strcmp(cmd,"/park",true))
- {
- if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,ROT,"Du befindest dich in keinem Auto");
- if(!HasPlayerKey(PlayerName(playerid),GetPlayerVehicleID(playerid))) return SendClientMessage(playerid,ROT,"Du hast keinen Schlüssel für dieses Fahrzeug!");
- new vehicleid = GetPlayerVehicleID(playerid),Float:x,Float:y,Float:z,Float:r;
- GetVehiclePos(vehicleid,x,y,z);
- GetVehicleZAngle(vehicleid,r);
- AutoData[vehicleid][SpawnX] = x;
- AutoData[vehicleid][SpawnY] = y;
- AutoData[vehicleid][SpawnZ] = z;
- AutoData[vehicleid][SpawnRot] = r;
- SaveVehicle(vehicleid);
- SendClientMessage(playerid,GREEN,"Fahrzeug erfolgreich geparkt!");
- return 1;
- }
- if(!strcmp(cmd,"/apark",true))
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ROT,"Du bist kein Admin!");
- if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,ROT,"Du befindest dich in keinem Auto");
- new vehicleid = GetPlayerVehicleID(playerid),Float:x,Float:y,Float:z,Float:r;
- GetVehiclePos(vehicleid,x,y,z);
- GetVehicleZAngle(vehicleid,r);
- AutoData[vehicleid][SpawnX] = x;
- AutoData[vehicleid][SpawnY] = y;
- AutoData[vehicleid][SpawnZ] = z;
- AutoData[vehicleid][SpawnRot] = r;
- SaveVehicle(vehicleid);
- SendClientMessage(playerid,GREEN,"Fahrzeug erfolgreich geparkt!");
- return 1;
- }
- if(!strcmp(cmd,"/configcar",true)||!strcmp(cmd,"/cc",true))
- if(IsPlayerInAnyVehicle(playerid))
- if(IsKaufbaresAuto[GetPlayerVehicleID(playerid)]&& IsPlayerAbleToConfig(playerid,GetPlayerVehicleID(playerid)))
- return ShowPlayerDialog(playerid,DIALOG_CONFIG,DIALOG_STYLE_LIST,"Autokonfiguration","Schlüsselverteilung\nBesitzer ändern","Wählen","Verlassen");
- else return SendClientMessage(playerid,ROT,"Du kannst dieses Auto nicht konfigurieren!");
- if(!strcmp(cmd,"/editcar",true))
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ROT,"Diesen Befehl kannst du nicht nutzen!");
- else return ShowPlayerDialog(playerid,DIALOG_EDITVEH,DIALOG_STYLE_INPUT,"Fahrzeug-Bearbeitung","Bitte geben Sie die zu bearbeitende Fahrzeug ID ein:","Absenden","Abbrechen");
- return 0;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- stock RespawnVehicle(vehicleid)
- {
- new Float:x,Float:y,Float:z,Float:r,Float:health;
- GetVehicleHealth(vehicleid,health);
- GetVehiclePos(vehicleid,x,y,z);
- GetVehicleZAngle(vehicleid,r);
- DestroyVehicle(vehicleid);
- vehicleid = CreateVehicle(AutoData[vehicleid][Model],x,y,z,r,AutoData[vehicleid][Col1],AutoData[vehicleid][Col2],-1);
- SetVehicleNumberPlate(vehicleid,AutoData[vehicleid][Owner]);
- if(strmatch(AutoData[vehicleid][Owner],"Niemand"))
- {
- Delete3DTextLabel(AutoData[vehicleid][dtext]);
- SetVehicleNumberPlate(vehicleid,"FOR SALE");
- new string[256];
- format(string,256,"Dieses Fahrzeug steht zum Verkauf\nModell:%s\nPreis:%d$",GetVehicleModelName(vehicleid),AutoData[vehicleid][Price]);
- AutoData[vehicleid][dtext]=Create3DTextLabel(string,BLUE,0.0,0.0,0.0,drawdistance,1);
- Attach3DTextLabelToVehicle(AutoData[vehicleid][dtext],vehicleid,0,0,0.0);
- }
- AddCarComponents(vehicleid);
- return 1;
- }
- stock GetVehicleModelName(vehicleid)
- {
- new string[128];
- format(string, sizeof(string), VehicleNames[GetVehicleModel(vehicleid)-400]);
- return string;
- }/*
- stock split(const strsrc[], strdest[][], delimiter = '|')
- {
- new i, li, aNum, len, srclen = strlen(strsrc);
- while(i <= srclen)
- {
- if (strsrc[i] == delimiter || i == srclen)
- {
- len = strmid(strdest[aNum], strsrc, li, i, 128);
- strdest[aNum][len] = 0;
- li = i + 1;
- aNum++;
- }
- i++;
- }
- }*/
- stock PlayerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, MAX_PLAYER_NAME);
- return name;
- }
- stock AddPlayerKey(playername[],vehicleid)
- {
- if(!IsKaufbaresAuto[vehicleid]) return 0;
- new Keysplit[MAX_KEYS][MAX_NOM];
- split(AutoData[vehicleid][Keys], Keysplit,',');
- for(new i = 0;i<MAX_KEYS;i++)
- if(strmatch(Keysplit[i],playername))return 0;
- else if(strmatch(Keysplit[i],""))
- {
- strmid(Keysplit[i],playername,0,120,120);
- strmid(AutoData[vehicleid][Keys],"",0,0,0);
- for(new u=0;u<MAX_KEYS;u++)
- if(!strmatch(Keysplit[u],""))
- format(AutoData[vehicleid][Keys],1024,"%s,%s",AutoData[vehicleid][Keys],Keysplit[u]);
- SaveVehicle(vehicleid);
- return 1;
- }
- return 0;
- }
- stock RemovePlayerKey(playername[],vehicleid)
- {
- if(!IsKaufbaresAuto[vehicleid]) return 0;
- new Keysplit[MAX_KEYS][MAX_NOM];
- split(AutoData[vehicleid][Keys], Keysplit,',');
- for(new i = 0;i<MAX_KEYS;i++)
- if(strmatch(Keysplit[i],playername))
- {
- strmid(Keysplit[i],"",0,0,0);
- strmid(AutoData[vehicleid][Keys],"",0,0,0);
- for(new u=0;u<MAX_KEYS;u++)
- if(!strmatch(Keysplit[u],""))
- format(AutoData[vehicleid][Keys],1024,"%s,%s",AutoData[vehicleid][Keys],Keysplit[u]);
- SaveVehicle(vehicleid);
- return 1;
- }
- return 0;
- }
- stock IsPlayerAbleToConfig(playerid,vehicleid)
- {
- if(!IsKaufbaresAuto[vehicleid]) return 0;
- if(strmatch(PlayerName(playerid),AutoData[vehicleid][Owner])) return 1;
- return 0;
- }
- stock HasPlayerKey(playername[],vehicleid)
- {
- if(!IsKaufbaresAuto[vehicleid]) return 0;
- new Keysplit[MAX_KEYS][MAX_NOM];
- split(AutoData[vehicleid][Keys], Keysplit,',');
- for(new i = 0;i<MAX_KEYS;i++)
- if(strmatch(Keysplit[i],playername))return 1;
- return 0;
- }
- stock split(const strsrc[], strdest[][], delimiter = '|')
- {
- new i, li, aNum, len, srclen = strlen(strsrc);
- while(i <= srclen)
- {
- if (strsrc[i] == delimiter || i == srclen)
- {
- len = strmid(strdest[aNum], strsrc, li, i, 128);
- strdest[aNum][len] = 0;
- li = i + 1;
- aNum++;
- }
- i++;
- }
- }
- 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,
- (MODVERSION+0.1 < floatstr(data)+0.1) ? ("Neue Version verfügbar!\n Siehe breadfish.de für weitere Informationen") : ("Vesion ist aktuell!") );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement