Guten Tag sobald ich mir ein Auto Kaufen möchte geht verliert der Player kein Geld
Die Preise
new dtcKaufliste[][dtcCarModell] =
{ //CARSYS
//0 = 2 Räder
{0,581,5090}, //BF-400
{0,521,1800}, //FCR-900
{0,463,12000}, //Freeway
{0,461,17000}, //PCJ-600
{0,468,20000}, //Sanchez
{0,586,9500}, //Wayfarer
{0,522,25000}, //NRG-500
//1 = Airport FLUGZEUG KAUF
{1,487,700000}, //Maverik
{1,593,1020000}, //DODO
{1,519,2000000}, //Shamal
// 2 = LS Count & Schutz (Billige-Gang)
{2,467,13000}, //Oceanic
{2,536,7500}, //Blade
{2,534,21000}, //Remigton
{2,567,9000}, //Savanna
{2,535,15500}, //Slamvan
{2,518,10000}, //Buccanee
{2,542,1950}, //Clover
{2,496,7500}, //Blistac
{2,587,30000}, //Euros
//3 = SF WangCars (Mittel-Gemischt)
{3,550,7500}, //Sunrise
{3,540,7500}, //Vincent
{3,413,8500}, //Pony
{3,483,23500}, //Camper
{3,500,6700}, //Mesa
{3,508,85000}, //Journey
//4 = SF Otto (Luxus-Renn Wagen)
{4,409,40000}, //Stretch
{4,562,25500}, //Elegy
{4,560,24500}, //Sultan
{4,429,35000}, //Banshee
{4,402,27000}, //Buffalo
{4,541,45000}, //Bullet
{4,480,120000}, //Comet
{4,411,65000}, //Infernus
{4,559,29500}, //Jester
{4,506,60500}, //Supergt
{4,451,62300} //Turismo
};
Unter OnPlayerPickupPickup deis
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),"~g~Fahrzeug:~w~%s~n~~g~Preis:~w~$%d~n~~b~Auswaehlen:~n~~w~Linke Maustaste~n~~b~Buy:~w~Enter~n~~b~Close:~w~Tab",CarName[car-400],preis);
if(!CarKauf[playerid])
{
GameTextForPlayer(playerid,string, 5000,3);
}
else
{
}
}
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_WHITE, "Dieser Schlüssel gehört zu einem anderen Fahrzeug!");
SendClientMessage(playerid, COLOR_WHITE, "Verkaufe dieses per /car sell oder wähle einen anderen Schüssel mit /car key!");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Du besitzt bereits ein Fahrzeug, verkaufe es mit /car sell");
}
}
Das Unter OnPlayerKeyChange
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_RIGHT || newkeys == KEY_FIRE )
{
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];
format(string,sizeof(string),"~g~Fahrzeug:~w~%s~n~~g~Preis:~w~$%d~n~~b~Auswaehlen:~n~~w~Linke Maustaste~n~~b~Buy:~w~Enter~n~~b~Close:~w~Tab",CarName[car-400],preis);
GameTextForPlayer(playerid,string, 5000,3);
dtc_AutohausCar[playerid] = carid;
}
if(newkeys == KEY_ANALOG_LEFT || newkeys == KEY_LOOK_LEFT)
{
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];
format(string,sizeof(string),"~g~Fahrzeug:~w~%s~n~~g~Preis:~w~$%d~n~~b~Auswaehlen:~n~~w~Linke Maustaste~n~~b~Buy:~w~Enter~n~~b~Close:~w~Tab",CarName[car-400],preis);
GameTextForPlayer(playerid,string, 5000,3);
dtc_AutohausCar[playerid] = carid;
}
if(newkeys == 16)
{
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_WHITE,"Du hast nicht genug Geld um dieses Fahrzeug zu kaufen!");
}
else
{
OnPlayerBuyCar(playerid,car,preis,autohaus);
SetPlayerCheckpoint(playerid, -2047.1213,-100.4485,35.2998, 5);
SendClientMessage(playerid,COLOR_GREEN,"Du hast Erfolgreich ein Fahrzeug gekauft nun begebe dich zum TüV, (/nummernschild)");
SendClientMessage(playerid,COLOR_GREEN,"(Makiert auf der Karte) und Melde dein Fahrzeug an! Checkpoint Löschen: /delcheck");
}
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);
}
Ich hoffe ihr könnt mir Helfen