hmm Ich möchte so eine Art Tüv system machen..
Sodass wenn man beim Kauf des autos wird ja zufällig ein nummernschild erstellt das hab ich ja schon hinbekommen...
So wie hier...
public PlayerCarSpawn(playerid,Slot)
{
if(IsPlayerConnected(playerid) && PlayerCar[playerid][Slot][CarD] == 0)
{
Dtc_PlayerHaveCar[playerid][Slot] = 1;
if(Dtc_PlayerHaveCar[playerid][Slot] == 1)
{
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],respawntime);/*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 kz[25];
new rand = random(99999);
format(kz, sizeof(kz), "DE-%d",rand);
SetVehicleNumberPlate(PlayerCar[playerid][Slot][CarId],kz);
}
}
}
else
{
DestroyVehicle(PlayerCar[playerid][Slot][CarId]);
}
return 1;
}
// dieser code wird nach dem Kauf aufgerufen
// Somit wird dem Auto ja ein Kennzeichen Zugewiesen
Ich möchte es jetzt aber auch in die Carfile Speichern so dass es wenn der Spieler wieder connectet gesetzt wird.
Verstehst was ich meine ? ...
Hier mal wie weiteren Funks
public OnPlayerBuyCar(playerid,Model,Preis)//CARSYS
{
if(!Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
CallRemoteFunction("M_GivePlayerMoney","id",playerid,-Preis);
//
SetParkPlatz(playerid);
new name[MAX_PLAYER_NAME], str[128], test;
test = (PlayerInfo[playerid][pAccount] * PlayerInfo[playerid][pLevel] * PlayerInfo[playerid][pChar]) / 5 ;
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof(str), "/Autos/%s.dtcar",name);
new File: hFile = fopen(str, io_write);
if (hFile)
{
new benzin = 100;
new var[32];
format(var, 32, "CarId=%d\n",test);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=%d\n",Preis);fwrite(hFile, var);
format(var, 32, "CarArrest=0\n");fwrite(hFile, var);
format(var, 32, "Benzin=%d\n",benzin);fwrite(hFile, var);
format(var, 32, "CarD=0\n");fwrite(hFile, var);
format(var, 32, "CarNumber=DE\n");fwrite(hFile, var);
format(var, 32, "CarPlus=0\n");fwrite(hFile, var);
format(var, 32, "CarMinus=0\n");fwrite(hFile, var);
format(var, 32, "CarPasswort=0\n");fwrite(hFile, var);
fclose(hFile);
}
printf("[INFO(CAR)]:Ein Auto wurde gekauft");
OnPlayerCarLogin(playerid);
}
return 1;
}
Sprich man geht zum Zollamt mach /schild registrieren <nummer> und dann wird die Nummer die Hinten am Auto steht in der carini gesavet..
Ich nutze ein Vorher editiertes GF Edit system ... das YVL
Und wollte da die /nummerschild TüV funk ausbessern da die ja dort nicht so geht...
Aber habs nicht hinbekommen also hab ich ein Zufälligs schild beim Kauf erstellen lassen
welches man jetzt beim Zollamt eintragen muss
So das wenn der Server Crasht oder neugestartet wird er das eingetragene Schild ausliest und ans auto bringt