Halo an alle die dies lesen,
ich habe schon seit längeren ein großes Problem aus meinen Server.
Mein Autohaus-System will einfach nicht gehen.
Wenn ich mir ein Auto kaufe, funktonieren die Befehle wie z.b. /carlock usw. nicht mehr, da kommt immer "Server Unknown Comand"
anschließend wenn ich reloage, kommt kein Login-Fenster mehr.
Ich hoffe mir kann ürgendwer helfen, bin für jeden Tipp, der den Fehler behebn könnte dankbar.
Hier mein Autohaus-System :
#define MaxVeh 5 //Anzahl Möglicher Fahrzeuge pro Person! Achtung nicht zu hoch setzten! Das verbraucht Speicher und kann über das Carlimit hinausschiessen!
#define AUTOHAUSER 6 //Anzahl der Autohäuser
#define MAXPARKPLATZE 4 //Anzahl Parkplätze
new SideL, SideR, Dtc_Info[AUTOHAUSER];
new dtc_AutohausCar[MAX_PLAYERS], dtc_AutohausCat[MAX_PLAYERS], dtc_AutohausSCar[MAX_PLAYERS];
new Dtc_PlayerHaveCar[MAX_PLAYERS][MaxVeh];
new Dtc_PlayerKey[MAX_PLAYERS];
new RadZahl[AUTOHAUSER];
new Dtc_Carlock[700];
new Text: CarKauf[MAX_PLAYERS];
enum dtcCarModell
{
dtc_Autohaus,
dtc_CarModel,
dtc_CarPreis
};
new dtcKaufliste[][dtcCarModell] =
{
//0 = Bike Autohaus
{0,462,5000}, //Faggio
{0,581,70000}, //BF-400
{0,521,80000}, //FCR-900
{0,463,60000}, //Freeway
{0,461,90000}, //PCJ-600
{0,468,20000}, //Sanchez
{0,586,20000}, //Wayfarer
{0,522,120000}, //NRG
//1 = Vip Autohaus
//{1,486,100000}, //DOZER
//{1,494,130000}, //Hotring Racer
//{1,502,100000}, //Hotring Racer1
//{1,503,100000}, //Hotring Racer2
//{1,504,100000}, //Bloodring Racer
{1,495,104000}, //Sandking
//{1,444,110000}, //MonsterTruck
{1,531,50000}, //Farmtraktor
{1,508,80000}, //Journey
{1,539,10000}, //Vortex
{1,509,500}, //BIKE
{1,510,500}, //BIKR
//{1,556,100000}, //MonsterA
//{1,557,100000}, //MonsterB
{1,434,80000}, //Hotknife
{1,530,50000}, //Stabler
{1,571,50000}, //KART
{1,572,50000}, //MOWER
{1,573,150000}, //Dune
{1,574,50000}, //Sweeper
{1,583,100000}, //TUG
//{1,488,100000}, //SAN NEWS HELI
{1,471,24000}, //Quat
{1,516,40000}, //Nebula
{1,529,35000}, //Willard
//{1,544,12200}, //Feuerwehrwagen
{1,546,10300}, //Intruder
{1,549,14200}, //Tampa
{1,551,15200}, //Merit
{1,568,100000}, //Bandito
{1,576,120800}, //Tornado
{1,580,45500}, //Stefford
{1,603,12000}, //Phoenix
{1,409,135000}, //Stretch
{1,541,265000}, //Bullet
{1,411,100000}, //Infernus
{1,457,185000}, //Caddy
{1,424,305000}, //BF Injection
{1,565,100000}, //Flash
{1,403,74000}, //Linerunner
{1,514,68000}, //Tanker
{1,515,55000}, //Roadtrain
{1,470,44500}, //Patriot
// 2 = Biliges Autohaus
{2,467,6000}, //Oceanic
{2,536,10000}, //Blade
{2,534,7000}, //Remigton
{2,567,12000}, //Savanna
{2,535,27000}, //Slamvan
{2,412,7500}, //Voodo
{2,426,30000}, //Premier
{2,421,30000}, // Washington
{2,518,10000}, //Buccanee
{2,542,5000}, //Clover
{2,496,7500}, //Blistac
{2,587,12000}, //Euros
{2,439,15000}, //Stallion
{2,550,12000}, //Sunrise
{2,540,11000}, //Vincent
{2,404,9500}, //Peren
{2,413,15000}, //Pony
{2,458,12500}, //Solair
{2,479,12500}, //Regina
{2,440,25200}, //Rumpo
{2,423,15200}, //Eiswagen (Mrwhoop)
{2,483,14100}, //Camper
{2,500,12500}, //Mesa
{2,508,45600}, //Journey
{2,554,35000}, //Yosemite
{2,561,35700}, //Startum
{2,489,23000}, //Rancher
{2,543,15000}, //Sadler
{2,442,10000}, //Leichenwagen
{2,527,6000}, //Cadrona
// Luxus Autohaus
{3,533,70000}, //Feltzer
{3,579,57000}, //Huntley
{3,507,55000}, //Elegant
{3,419,12000}, //Esperant
{3,526,95500}, //Fortune
{3,602,74000}, //Alpha
{3,400,23000}, //Landstal
{3,545,12000}, //Hustler
{3,405,13000}, //Sentinel
{3,445,16500}, //Admiral
{3,475,15400}, //Sabre
{3,409,1200000}, //Stretch
{3,562,185000}, //Elegy
{3,560,205000}, //Sultan
{3,429,110000}, //Banshee
{3,402,100000}, //Buffalo
{3,541,1000000}, //Bullet
{3,411,1000000}, //Infernus
{3,415,240000}, //Cheetah
{3,589,170000}, //Club
{3,559,150000}, //Jester
{3,603,120000}, //Phönix
{3,506,250000}, //Supergt
{3,451,330000}, //Turismo
{3,558,180000}, //Uranus
{3,480,140000}, //Comet
{3,477,210000}, //Zr350
{3,565,150000}, //flash
{3,482,15000}, //burrito
{3,494,3000000}, //hotring
{3,502,3000000}, //hotring
{3,503,3000000}, //hotring
{3,495,1000000}, //sandking
{3,568,220000}, //Bandito
{3,580,50000}, //stafford
//2 = LS AIRPORT (Flugzeuge & Helikopter)
{4,487,600000}, //Maverick
{4,469,300000}, //Spearrow
{4,511,200000}, //Beagle
{4,593,150000}, //Dodo
{4,513,150000}, //Stunt Flugzeug
{4,563,400000}, //Raindance
{4,519,1000000}, //Shamal
// Boots Autohaus
//{5,430,600}, //Predator
{5,446,812000}, //Squallo
{5,452,452000}, //Speeder
{5,453,50000}, //Reefer
{5,454,380000}, //Tropic
{5,484,577000}, //Marquis
{5,472,75000}, //Coastguard
{5,473,100000}, //Dinghy
{5,493,665000} //Jetmax
};
new Float:DtcParkPlatz[AUTOHAUSER][MAXPARKPLATZE][6] = {
{//Bike Autohaus
{2471.7231, -1558.3952, 23.5809, 0.0},
{2474.7231, -1558.3952, 23.5751, 0.0},
{2477.7231, -1558.3952, 23.5771, 0.0},
{2480.7231, -1558.3952, 23.5921, 0.0}
},
{//Vipautohaus
{1358.6565,-1677.0625,14.2140, 0.0},
{1352.7611,-1635.9846,14.1316, 0.0},
{1358.8470,-1625.9791,14.2096, 0.0},
{1374.1926,-1667.9106,13.8534, 0.0}
},
{//LS Biliges Autohaus
{2148.0617, -1138.3233, 25.1975, 270.0},
{2148.5222, -1143.1345, 24.6887, 270.0},
{2147.8491, -1148.3714, 24.1134, 270.0},
{2147.5104, -1152.7818, 23.6500, 270.0}
},
{//LS Luxus Autohaus
{743.0629, -1334.0764, 13.2483, 180.0},
{748.0629, -1334.0764, 13.2708, 180.0},
{753.0629, -1334.0764, 13.2483, 180.0},
{758.0629, -1334.0764, 13.2708, 180.0}
},
{//LS AIRPORT
{1725.5981,-2414.4631,13.5547,91.2938},
{1648.4031,-2413.2231,13.5547,91.2938},
{1566.8810,-2416.3340,13.5547,89.3299},
{1899.1111,-2374.5435,13.8934,270.3974}
},
{//LS Boots Autohaus
{-143.5681,-1820.9989,-0.6451,257.6810},
{-139.4363,-1802.0128,-0.5331,258.8536},
{-135.3319,-1779.2094,-0.5934,258.2228},
{-131.6279,-1757.7664,-0.6196,259.0080}
}
};
new Float:DtcSonstiges[AUTOHAUSER][5][4] =
{
{// Bike Autohaus
{2471.0097, -1542.7354, 24.1628, 0.0}, // Info Zeichen etc.
{2475.3952, -1537.1600, 28.6523, 340.2388}, // LiveView Car
{2472.8505, -1533.2855, 29.0964, 0.0}, // LiveView Cam
{2468.4548, -1534.1237, 29.1007, 0.0}, // LiveView Player
{2470.8825, -1544.0834, 24.0406, 178.5745} // LiveView Player Exit
},
{// VIPAutohaus
{55.8692, -309.8162, 1.6051, 98.6395}, // Info Zeichen etc.
{2475.3952, -1537.1600, 28.6523, 340.2388}, // LiveView Car
{2472.8505, -1533.2855, 29.0964, 0.0}, // LiveView Cam
{2468.4548, -1534.1237, 29.1007, 0.0}, // LiveView Player
{1360.0192, -1658.7026, 13.3828, 272.6918} // LiveView Player Exit
},
{//LS Biliges Autohaus
{2131.7124, -1151.0965, 24.0838, 0.0}, // Info Zeichen etc.
{2131.7192, -1163.0882, 27.8755, 301.3163}, // LiveView Car
{2133.0817, -1156.3632, 28.1484, 0.0}, // LiveView Cam
{2133.0031, -1154.4589, 28.1484, 0.0}, // LiveView Player
{2131.7634, -1148.4149, 24.3788, 359.2809} // LiveView Player Exit
},
{//LS Luxus Autohaus
{750.7259, -1356.9744, 13.5000, 0.0}, // Info Zeichen etc.
{740.5779, -1365.2796, 25.4192, 225.3830}, // LiveView Car
{741.2583, -1370.9835, 25.6922, 0.0}, // LiveView Cam
{741.7747, -1376.3156, 25.6922, 0.0}, // LiveView Player
{753.6887, -1338.2799, 13.5320, 14.7941} // LiveView Player Exit
},
{//LS AIRPORT
{1774.7336,-2433.5491,13.5547,252.3329}, // Info Zeichen etc.
{1765.1451,-2286.7554,26.7960,313.5673}, // LiveView Car
{1765.4340,-2271.0989,31.0900,181.3627}, // LiveView Cam
{1765.4340,-2271.0989,31.0900,181.3627}, // LiveView Player
{1778.3945,-2432.7996,13.5547,171.6871} // LiveView Player Exit
},
{//LS Boots Autohaus
{-207.0457,-1778.9010,1.8197,83.5860}, // Info Zeichen etc.
{-224.6904,-1877.9922,-0.4114,42.8227}, // LiveView Car
{-246.4832, -1887.0842, 23.2854, 0.0}, // LiveView Cam
{-201.7943,-1778.6981,1.8197,262.2440}, // LiveView Player
{-201.7943,-1778.6981,1.8197,262.2440} // LiveView Player Exit
}
};
enum dtc_PlayerCar
{
CarId,
CarOwner[MAX_PLAYER_NAME],
CarModel,
Float:CarPos_x,
Float:CarPos_y,
Float:CarPos_z,
Float:CarRotate,
CarNitro,
CarHyd,
CarWheel,
CarAusp,
CarSideL,
CarSideR,
CarFB,
CarRB,
CarSpoiler,
CarRoof,
CarHood,
CarVents,
CarLamps,
CarPJ,
CarC1,
CarC2,
CarPreis,
CarArrest,
Plate[9],
};
new PlayerCar[MAX_PLAYERS][MaxVeh][dtc_PlayerCar];
new CarName[][] =
{
"Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
"Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
"Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
"Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
"Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
"Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
"Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
"Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "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", "Boxvillde", "Benson", "Mesa", "RC Goblin",
"Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
"Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "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", "Hustler", "Intruder", "Primo",
"Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
"Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratum",
"Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
"Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
"Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
"News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
"Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
"Police Car", "Police Car", "Police Ranger", "Picador", "#", "Alpha",
"Phoenix", "2. Gebrauchtwagen", "1. Gebrauchtwagen", "Luggage", "Luggage", "Stairs", "Boxville",
"Tiller", "Utility Trailer"
};
OnPlayerConnect
/*for(new i = 0; i < AUTOHAUSER; i++)
{
SetPlayerMapIcon(playerid, 30+i, DtcSonstiges[0][0],DtcSonstiges[0][1],DtcSonstiges[0][2], 55, COLOR_YELLOW);
}*/
dtc_AutohausCar[playerid] = 0;
dtc_AutohausCat[playerid] = 2000;
dtc_AutohausSCar[playerid] = 0;
Dtc_PlayerKey[playerid] = 0;
for(new i = 0; i < MaxVeh; i++)
{
Dtc_PlayerHaveCar[playerid] = 0;
}
OnPlayerCarLogin(playerid);
for(new i = 0; i < 700; i++)
{
if(Dtc_Carlock)
{
SetVehicleParamsForPlayer(i,playerid,0,1);
}
}
Function OnPlayerPickUpPickup(playerid,pickupid)
for(new x = 0; x < AUTOHAUSER;x++)
{
if(PlayerToPoint(1.5, playerid, DtcSonstiges[x][0][0],DtcSonstiges[x][0][1],DtcSonstiges[x][0][2]) && !Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]] || pickupid == Dtc_Info[x] && !Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
TogglePlayerControllable(playerid, 0);
SetPlayerVirtualWorld(playerid,55+playerid);
new string[246];
dtc_AutohausCar[playerid] = 0;
dtc_AutohausCat[playerid] = x;
new c1 = random(120);
new c2 = random(120);
new car;
new preis;
for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
{
if(car == 0 && dtcKaufliste[ah][dtc_Autohaus] == x)
{
car = dtcKaufliste[ah][dtc_CarModel];
preis = dtcKaufliste[ah][dtc_CarModel];
}
}
SetPlayerCameraPos(playerid, DtcSonstiges[x][2][0],DtcSonstiges[x][2][1],DtcSonstiges[x][2][2]);
SetPlayerCameraLookAt(playerid, DtcSonstiges[x][1][0],DtcSonstiges[x][1][1],DtcSonstiges[x][1][2]);
dtc_AutohausSCar[playerid] = CreateVehicle(car, DtcSonstiges[x][1][0],DtcSonstiges[x][1][1],DtcSonstiges[x][1][2],DtcSonstiges[x][1][3],c1,c2,-1);
SetPlayerPos(playerid, DtcSonstiges[x][3][0],DtcSonstiges[x][3][1],DtcSonstiges[x][3][2]);
SetVehicleVirtualWorld(dtc_AutohausSCar[playerid],55+playerid);
format(string,sizeof(string),"~r~---------- AUTOHAUS ----------~n~~g~Fahrzeug: ~w~%s~n~~g~Preis: ~w~$%d~n~~b~Auswaehlen:~n~~w~ <Num 4<~b~&~w~>Num 6> ~n~~b~Kaufen:~w~ Enter ~n~~b~Abbrechen:~w~ Tab",CarName[car-400],preis);
if(!CarKauf[playerid])
{
CarKauf[playerid] = TextDrawCreate(200,310,string);
TextDrawAlignment(CarKauf[playerid],1);
TextDrawUseBox(CarKauf[playerid],1);
TextDrawBoxColor(CarKauf[playerid],0x000000FF);
TextDrawSetOutline(CarKauf[playerid],1);
TextDrawBackgroundColor(CarKauf[playerid],COLOR_BLACK);
TextDrawSetOutline(CarKauf[playerid],1);
TextDrawFont(CarKauf[playerid], 2);
//TextDrawSetProportional(CarKauf[playerid], 2);
TextDrawTextSize(CarKauf[playerid],450,410);
TextDrawShowForPlayer(playerid,CarKauf[playerid]);
}
else
{
TextDrawHideForPlayer(playerid,CarKauf[playerid]);
TextDrawSetString(CarKauf[playerid],string);
TextDrawShowForPlayer(playerid,CarKauf[playerid]);
}
}
else if(PlayerToPoint(1.5, playerid, DtcSonstiges[x][0][0],DtcSonstiges[x][0][1],DtcSonstiges[x][0][2]) && Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]] || pickupid == Dtc_Info[x] && Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
new mv = MaxVeh;
if(mv > 1)
{
SendClientMessage(playerid, COLOR_GREY, " Du besitzt schon ein Fahrzeug mit deinem Ausgewählten Schlüssel !");
SendClientMessage(playerid, COLOR_GREY, " Verkaufe es mit /carsell oder wechsel den Schlüssel mit /carkey !");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Du besitzt schon ein Fahrzeug! Verkaufe es mit /carsell");
}
}
}
OnPlayerKeyStateChange
if(dtc_AutohausCat[playerid] != 2000)
{
new autohaus = dtc_AutohausCat[playerid];
new AhCars;
for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
{
if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
{
AhCars ++;
}
}
if(newkeys == KEY_ANALOG_RIGHT || newkeys == KEY_LOOK_RIGHT) //right (6 Numpad/e)
{
new carid = dtc_AutohausCar[playerid] +1;
if(carid >= AhCars)
{
carid = 0;
}
new car,preis,counter;
for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
{
if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
{
if( counter == carid)
{
car = dtcKaufliste[ah][dtc_CarModel];
preis = dtcKaufliste[ah][dtc_CarPreis];
}
counter ++;
}
}
new c1 = random(120);
new c2 = random(120);
DestroyVehicle(dtc_AutohausSCar[playerid]);
dtc_AutohausSCar[playerid] = CreateVehicle(car, DtcSonstiges[autohaus][1][0],DtcSonstiges[autohaus][1][1],DtcSonstiges[autohaus][1][2],DtcSonstiges[autohaus][1][3],c1,c2,-1);
SetVehicleVirtualWorld(dtc_AutohausSCar[playerid],55+playerid);
new string[246];
TextDrawHideForPlayer(playerid,CarKauf[playerid]);
TextDrawDestroy(CarKauf[playerid]);
format(string,sizeof(string),"~r~---------- AUTOHAUS ----------~n~~g~Fahrzeug: ~w~%s~n~~g~Preis: ~w~$%d~n~~b~Auswaehlen:~n~~w~ <Num 4<~b~&~w~>Num 6> ~n~~b~Kaufen:~w~ Enter ~n~~b~Abbrechen:~w~ Tab",CarName[car-400],preis);
CarKauf[playerid] = TextDrawCreate(200,310,string);
TextDrawAlignment(CarKauf[playerid],1);
TextDrawUseBox(CarKauf[playerid],1);
TextDrawBoxColor(CarKauf[playerid],0x000000FF);
TextDrawBackgroundColor(CarKauf[playerid],COLOR_BLACK);
TextDrawSetOutline(CarKauf[playerid],1);
TextDrawFont(CarKauf[playerid], 2);
//TextDrawSetProportional(CarKauf[playerid], 2);
TextDrawTextSize(CarKauf[playerid],450,410);
TextDrawShowForPlayer(playerid,CarKauf[playerid]);
dtc_AutohausCar[playerid] = carid;
}
if(newkeys == KEY_ANALOG_LEFT || newkeys == KEY_LOOK_LEFT) //left (4 Numpad/q)
{
new carid = dtc_AutohausCar[playerid] -1;
if(carid < 0)
{
carid = AhCars;
}
new car,preis,counter;
for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
{
if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
{
if( counter == carid)
{
car = dtcKaufliste[ah][dtc_CarModel];
preis = dtcKaufliste[ah][dtc_CarPreis];
}
counter ++;
}
}
new c1 = random(120);
new c2 = random(120);
DestroyVehicle(dtc_AutohausSCar[playerid]);
dtc_AutohausSCar[playerid] = CreateVehicle(car, DtcSonstiges[autohaus][1][0],DtcSonstiges[autohaus][1][1],DtcSonstiges[autohaus][1][2],DtcSonstiges[autohaus][1][3],c1,c2,-1);
SetVehicleVirtualWorld(dtc_AutohausSCar[playerid],55+playerid);
new string[246];
TextDrawHideForPlayer(playerid,CarKauf[playerid]);
TextDrawDestroy(CarKauf[playerid]);
format(string,sizeof(string),"~r~---------- AUTOHAUS ----------~n~~g~Fahrzeug: ~w~%s~n~~g~Preis: ~w~$%d~n~~b~Auswaehlen:~n~~w~ <Num 4<~b~&~w~>Num 6> ~n~~b~Kaufen:~w~ Enter ~n~~b~Abbrechen:~w~ Tab",CarName[car-400],preis);
CarKauf[playerid] = TextDrawCreate(200,310,string);
TextDrawAlignment(CarKauf[playerid],1);
TextDrawUseBox(CarKauf[playerid],1);
TextDrawBoxColor(CarKauf[playerid],0x000000FF);
TextDrawSetOutline(CarKauf[playerid],1);
TextDrawBackgroundColor(CarKauf[playerid],COLOR_BLACK);
TextDrawFont(CarKauf[playerid], 2);
//TextDrawSetProportional(CarKauf[playerid], 2);
TextDrawTextSize(CarKauf[playerid],450,410);
TextDrawShowForPlayer(playerid,CarKauf[playerid]);
dtc_AutohausCar[playerid] = carid;
}
if(newkeys == 16)//Enter
{
new carid = dtc_AutohausCar[playerid];
new car,preis,counter;
for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
{
if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
{
if( counter == carid)
{
car = dtcKaufliste[ah][dtc_CarModel];
preis = dtcKaufliste[ah][dtc_CarPreis];
}
counter ++;
}
}
if(GetPlayerMoney(playerid) < preis){SendClientMessage(playerid,COLOR_GREY,"Du hast nicht genug Geld um dieses Fahrzeug zu kaufen!");} else {OnPlayerBuyCar(playerid,car,preis,autohaus);}
//ResetPlayer
DestroyVehicle(dtc_AutohausSCar[playerid]);
SetPlayerPos(playerid, DtcSonstiges[autohaus][4][0],DtcSonstiges[autohaus][4][1],DtcSonstiges[autohaus][4][2]);
SetPlayerFacingAngle(playerid,DtcSonstiges[autohaus][4][3]);
dtc_AutohausCar[playerid] = 0;
dtc_AutohausCat[playerid] = 2000;
SetPlayerVirtualWorld(playerid,0);
TextDrawHideForPlayer(playerid,CarKauf[playerid]);
TextDrawDestroy(CarKauf[playerid]);
TogglePlayerControllable(playerid,1);
SetCameraBehindPlayer(playerid);
}
if(newkeys == KEY_ACTION) //Tab
{
//ResetPlayer
DestroyVehicle(dtc_AutohausSCar[playerid]);
SetPlayerPos(playerid, DtcSonstiges[autohaus][4][0],DtcSonstiges[autohaus][4][1],DtcSonstiges[autohaus][4][2]);
SetPlayerFacingAngle(playerid,DtcSonstiges[autohaus][4][3]);
dtc_AutohausCar[playerid] = 0;
dtc_AutohausCat[playerid] = 2000;
SetPlayerVirtualWorld(playerid,0);
TextDrawHideForPlayer(playerid,CarKauf[playerid]);
TextDrawDestroy(CarKauf[playerid]);
TogglePlayerControllable(playerid,1);
SetCameraBehindPlayer(playerid);
}
}
public OnGameModeInit()
/*for(new i = 0; i < AUTOHAUSER; i++)
{
Dtc_Info = CreatePickup(1210, 2, DtcSonstiges[0][0],DtcSonstiges[0][1],DtcSonstiges[0][2],0);
}*/
public OnGameModeExit()
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
OnPlayerCarUpdate(i);
PlayerUpdate(i);
gPlayerLogged = 0;
DisablePlayerCheckpoint(i);
}
}
for(new i = 0; i < AUTOHAUSER; i++)
{
DestroyPickup(Dtc_Info);
}
------------------------------------------------------------------------------------------------------------------
Function SetParkPlatz(playerid,Autohaus)
{
if(IsPlayerConnected(playerid) && !Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
if(Autohaus < AUTOHAUSER)
{
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_x] = DtcParkPlatz[Autohaus][RadZahl[Autohaus]][0];
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_y] = DtcParkPlatz[Autohaus][RadZahl[Autohaus]][1];
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_z] = DtcParkPlatz[Autohaus][RadZahl[Autohaus]][2];
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarRotate] = DtcParkPlatz[Autohaus][RadZahl[Autohaus]][3];
RadZahl[Autohaus] += 1;
if(RadZahl[Autohaus] >= MAXPARKPLATZE)
{
RadZahl[Autohaus] = 0;
}
}
}
}
Function OnPlayerBuyCar(playerid,Model,preis,Autohaus)//CARSYS
{
if(IsPlayerConnected(playerid) && !Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "*Du hast dir ein Auto gekauft.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "*Gehe zu der KFZ Stelle und hole dir ein Kennzeichen.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "*Fahre vorsichtig..Und denk an die StraßenVerkehrsOrdnung!");
SendClientMessage(playerid, COLOR_LIGHTRED, "*ACHTUNG: Wenn du dein Auto parkst wirst du vom System gekickt und musst dich neu einloggen!");
GivePlayerMoney(playerid, -preis);
PlayerInfo[playerid][pCash] -= preis;
SetParkPlatz(playerid,Autohaus);
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/Autos/%s%d.dtcar", name,Dtc_PlayerKey[playerid]);
new File: hFile = fopen(str, io_write);
if (hFile)
{
new var[32];
format(var, 32, "CarId=0\n");fwrite(hFile, var);
format(var, 32, "CarModel=%d\n",Model);fwrite(hFile, var);
format(var, 32, "CarPos_x=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_x]);fwrite(hFile, var);
format(var, 32, "CarPos_y=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_y]);fwrite(hFile, var);
format(var, 32, "CarPos_z=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_z]);fwrite(hFile, var);
format(var, 32, "CarRotate=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarRotate]);fwrite(hFile, var);
format(var, 32, "CarNitro=0\n");fwrite(hFile, var);
format(var, 32, "CarHyd=0\n");fwrite(hFile, var);
format(var, 32, "CarWheel=0\n");fwrite(hFile, var);
format(var, 32, "CarAusp=0\n");fwrite(hFile, var);
format(var, 32, "CarSideL=0\n");fwrite(hFile, var);
format(var, 32, "CarSideR=0\n");fwrite(hFile, var);
format(var, 32, "CarFB=0\n");fwrite(hFile, var);
format(var, 32, "CarRB=0\n");fwrite(hFile, var);
format(var, 32, "CarSpoiler=0\n");fwrite(hFile, var);
format(var, 32, "CarRoof=0\n");fwrite(hFile, var);
format(var, 32, "CarHood=0\n");fwrite(hFile, var);
format(var, 32, "CarVents=0\n");fwrite(hFile, var);
format(var, 32, "CarLamps=0\n");fwrite(hFile, var);
format(var, 32, "CarPJ=-1\n");fwrite(hFile, var);
format(var, 32, "CarC1=-1\n");fwrite(hFile, var);
format(var, 32, "CarC2=-1\n");fwrite(hFile, var);
format(var, 32, "Preis=%i\n",preis);fwrite(hFile, var);
format(var, 32, "Plate=XXX\n");fwrite(hFile, var);
fclose(hFile);
}
OnPlayerCarLogin(playerid);
}
}
Function OnPlayerCarLogin(playerid)
{
for(new x = 0; x < MaxVeh; x++)
{
if(!Dtc_PlayerHaveCar[playerid][x])
{
new string2[128];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "/Autos/%s%d.dtcar", playername2,x);
new File: UserFile = fopen(string2, io_read);
if (UserFile)
{
Dtc_PlayerHaveCar[playerid][x] = 1;
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "CarId" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarId] = strval( val ); }
if( strcmp( key , "CarModel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarModel] = strval( val ); }
if( strcmp( key , "CarPos_x" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_x] = floatstr( val ); }
if( strcmp( key , "CarPos_y" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_y] = floatstr( val ); }
if( strcmp( key , "CarPos_z" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_z] = floatstr( val ); }
if( strcmp( key , "CarRotate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRotate] = floatstr( val ); }
if( strcmp( key , "CarNitro" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarNitro] = strval( val ); }
if( strcmp( key , "CarHyd" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHyd] = strval( val ); }
if( strcmp( key , "CarWheel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarWheel] = strval( val ); }
if( strcmp( key , "CarAusp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarAusp] = strval( val ); }
if( strcmp( key , "CarSideL" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideL] = strval( val ); }
if( strcmp( key , "CarSideR" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideR] = strval( val ); }
if( strcmp( key , "CarFB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarFB] = strval( val ); }
if( strcmp( key , "CarRB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRB] = strval( val ); }
if( strcmp( key , "CarSpoiler" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSpoiler] = strval( val ); }
if( strcmp( key , "CarRoof" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRoof] = strval( val ); }
if( strcmp( key , "CarHood" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHood] = strval( val ); }
if( strcmp( key , "CarVents" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarVents] = strval( val ); }
if( strcmp( key , "CarLamps" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarLamps] = strval( val ); }
if( strcmp( key , "CarPJ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPJ] = strval( val ); }
if( strcmp( key , "CarC1" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC1] = strval( val ); }
if( strcmp( key , "CarC2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC2] = strval( val ); }
if( strcmp( key , "Preis" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPreis] = strval( val ); }
if( strcmp( key , "Plate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][Plate] = strval( val ); }
}
fclose(UserFile);
PlayerCarSpawn(playerid,x);
}
}
}
}
Function PlayerCarSpawn(playerid,Slot)
{
if(IsPlayerConnected(playerid))
{
if(Dtc_PlayerHaveCar[playerid][Slot])
{
PlayerCar[playerid][Slot][CarId] = CreateVehicle(PlayerCar[playerid][Slot][CarModel],PlayerCar[playerid][Slot][CarPos_x],PlayerCar[playerid][Slot][CarPos_y],PlayerCar[playerid][Slot][CarPos_z],PlayerCar[playerid][Slot][CarRotate],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2], 60000);/*vehicle spawn*/
ChangeVehicleColor(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2]);
if(PlayerCar[playerid][Slot][CarPJ] >= 0) {ChangeVehiclePaintjob(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarPJ]);}
if(PlayerCar[playerid][Slot][CarNitro] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarNitro]);}
if(PlayerCar[playerid][Slot][CarHyd] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHyd]);}
if(PlayerCar[playerid][Slot][CarWheel] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarWheel]);}
if(PlayerCar[playerid][Slot][CarAusp] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarAusp]);}
if(PlayerCar[playerid][Slot][CarSideL] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideL]);}
if(PlayerCar[playerid][Slot][CarSideR] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideR]);}
if(PlayerCar[playerid][Slot][CarFB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarFB]);}
if(PlayerCar[playerid][Slot][CarRB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRB]);}
if(PlayerCar[playerid][Slot][CarSpoiler] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSpoiler]);}
if(PlayerCar[playerid][Slot][CarRoof] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRoof]);}
if(PlayerCar[playerid][Slot][CarHood] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHood]);}
if(PlayerCar[playerid][Slot][CarVents] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarVents]);}
if(PlayerCar[playerid][Slot][CarLamps] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarLamps]);}
if(Dtc_LockOnSpawn)
{
Dtc_Carlock[PlayerCar[playerid][Slot][CarId]] = 1;
Dtc_LockCar(PlayerCar[playerid][Slot][CarId]);
}
new strings[9];
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/Autos/%s%d.dtcar", name,Dtc_PlayerKey[playerid]);
format(strings, sizeof(strings), "%s", dini_Get(str, "Plate"));
SetVehicleNumberPlate(PlayerCar[playerid][Slot][CarId], strings);
SetVehicleToRespawn(PlayerCar[playerid][Slot][CarId]);
for(new x = 0; x < MaxVeh; x++)
{
PlayerCar[playerid][x][Plate] = strings;
}
}
}
}
Function OnVehicleMod(playerid,vehicleid,componentid)
{
for(new x = 0; x < MaxVeh; x++)
{
if (vehicleid == PlayerCar[playerid][x][CarId] && Dtc_PlayerHaveCar[playerid][x])
{
if((componentid >= 1008) && (componentid <= 1010)) {PlayerCar[playerid][x][CarNitro] = componentid;}
if((componentid >= 1142) && (componentid <= 1145)) {PlayerCar[playerid][x][CarVents] = componentid;}
if((componentid == 1013) || (componentid == 1024)) {PlayerCar[playerid][x][CarLamps] = componentid;}
if((componentid >= 1004) && (componentid <= 1005)||(componentid >= 1011) && (componentid <= 1012)) {PlayerCar[playerid][x][CarHood] = componentid;}
if(componentid == 1087) {PlayerCar[playerid][x][CarHyd] = componentid;}
if(componentid == 1086) {PlayerCar[playerid][x][CarHyd] = componentid;}
if(IsAWheel(componentid)) {PlayerCar[playerid][x][CarWheel] = componentid;}
if(IsAExhaust(componentid)) {PlayerCar[playerid][x][CarAusp] = componentid;}
if(IsASideL(componentid)) {PlayerCar[playerid][x][CarSideL] = componentid; PlayerCar[playerid][x][CarSideR] = SideR;}
if(IsASideR(componentid)) {PlayerCar[playerid][x][CarSideR] = componentid; PlayerCar[playerid][x][CarSideL] = SideL;}
if(IsAFB(componentid)) {PlayerCar[playerid][x][CarFB] = componentid;}
if(IsARB(componentid)) {PlayerCar[playerid][x][CarRB] = componentid;}
if(IsASpoiler(componentid)) {PlayerCar[playerid][x][CarSpoiler] = componentid;}
if(IsARoof(componentid)) {PlayerCar[playerid][x][CarRoof] = componentid;}
}
}
return 1;
}
Function OnPlayerCarUpdate(playerid)
{
if(IsPlayerConnected(playerid))
{
for(new x = 0; x < MaxVeh; x++)
{
if(Dtc_PlayerHaveCar[playerid][x])
{
DestroyVehicle(PlayerCar[playerid][x][CarId]);
Dtc_Carlock[PlayerCar[playerid][x][CarId]] = 0;
Dtc_LockCar(PlayerCar[playerid][x][CarId]);
new string3[128];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "/Autos/%s%d.dtcar", playername3,x);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
new var[32];
format(var, 32, "CarId=%d\n",PlayerCar[playerid][x][CarId]);fwrite(hFile, var);
format(var, 32, "CarModel=%d\n",PlayerCar[playerid][x][CarModel]);fwrite(hFile, var);
format(var, 32, "CarPos_x=%.3f\n",PlayerCar[playerid][x][CarPos_x]);fwrite(hFile, var);
format(var, 32, "CarPos_y=%.3f\n",PlayerCar[playerid][x][CarPos_y]);fwrite(hFile, var);
format(var, 32, "CarPos_z=%.3f\n",PlayerCar[playerid][x][CarPos_z]);fwrite(hFile, var);
format(var, 32, "CarRotate=%.3f\n",PlayerCar[playerid][x][CarRotate]);fwrite(hFile, var);
format(var, 32, "CarNitro=%d\n",PlayerCar[playerid][x][CarNitro]);fwrite(hFile, var);
format(var, 32, "CarHyd=%d\n",PlayerCar[playerid][x][CarHyd]);fwrite(hFile, var);
format(var, 32, "CarWheel=%d\n",PlayerCar[playerid][x][CarWheel]);fwrite(hFile, var);
format(var, 32, "CarAusp=%d\n",PlayerCar[playerid][x][CarAusp]);fwrite(hFile, var);
format(var, 32, "CarSideL=%d\n",PlayerCar[playerid][x][CarSideL]);fwrite(hFile, var);
format(var, 32, "CarSideR=%d\n",PlayerCar[playerid][x][CarSideR]);fwrite(hFile, var);
format(var, 32, "CarFB=%d\n",PlayerCar[playerid][x][CarFB]);fwrite(hFile, var);
format(var, 32, "CarRB=%d\n",PlayerCar[playerid][x][CarRB]);fwrite(hFile, var);
format(var, 32, "CarSpoiler=%d\n",PlayerCar[playerid][x][CarSpoiler]);fwrite(hFile, var);
format(var, 32, "CarRoof=%d\n",PlayerCar[playerid][x][CarRoof]);fwrite(hFile, var);
format(var, 32, "CarHood=%d\n",PlayerCar[playerid][x][CarHood]);fwrite(hFile, var);
format(var, 32, "CarVents=%d\n",PlayerCar[playerid][x][CarVents]);fwrite(hFile, var);
format(var, 32, "CarLamps=%d\n",PlayerCar[playerid][x][CarLamps]);fwrite(hFile, var);
format(var, 32, "CarPJ=%d\n",PlayerCar[playerid][x][CarPJ]);fwrite(hFile, var);
format(var, 32, "CarC1=%d\n",PlayerCar[playerid][x][CarC1]);fwrite(hFile, var);
format(var, 32, "CarC2=%d\n",PlayerCar[playerid][x][CarC2]);fwrite(hFile, var);
format(var, 32, "Plate=%s\n",PlayerCar[playerid][x][Plate]);fwrite(hFile, var);
fclose(hFile);
}
}
}
}
}
Function Dtc_LockCar(carid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(carid,i,0,1);
}
}
}
Function Dtc_UnLockCar(carid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(carid,i,0,0);
}
}
}