Code
stock CreatePlayerVehicle(playerid, vehmodel, Float:posx, Float:posy, Float:posz, Float:posa, preis, neon, color1, color2)
{
new mainQuery[1537], secondQuery[256];
for(new slot=0;slot<MAX_PLAYER_VEHICLES;slot++)
{
if(PrivateVehicle[playerid][slot][CarModel] == 0)
{
if(!PlayerHaveCar[playerid][slot])
{
format(PrivateVehicle[playerid][slot][vehBesitzer], 24, "%s", GetName(playerid));
PrivateVehicle[playerid][slot][CarModel] = vehmodel;
PrivateVehicle[playerid][slot][vehPosX] = posx;
PrivateVehicle[playerid][slot][vehPosY] = posy;
PrivateVehicle[playerid][slot][vehPosZ] = posz;
PrivateVehicle[playerid][slot][vehPosA] = posa;
PrivateVehicle[playerid][slot][vehInterior] = GetPlayerInterior(playerid);
PrivateVehicle[playerid][slot][vehWorld] = GetPlayerVirtualWorld(playerid);
PrivateVehicle[playerid][slot][vehColor1] = color1;
PrivateVehicle[playerid][slot][vehColor2] = color2;
PrivateVehicle[playerid][slot][vehPaintjob] = -1;
PrivateVehicle[playerid][slot][vehSpoiler] = 0;
PrivateVehicle[playerid][slot][vehHood] = 0;
PrivateVehicle[playerid][slot][vehRoof] = 0;
PrivateVehicle[playerid][slot][vehSideskirt] = 0;
PrivateVehicle[playerid][slot][vehLamps] = 0;
PrivateVehicle[playerid][slot][vehNitro] = 0;
PrivateVehicle[playerid][slot][vehExhaust] = 0;
PrivateVehicle[playerid][slot][vehWheels] = 0;
PrivateVehicle[playerid][slot][vehStereo] = 0;
PrivateVehicle[playerid][slot][vehHydraulics] = 0;
PrivateVehicle[playerid][slot][vehFrontBumper] = 0;
PrivateVehicle[playerid][slot][vehRearBumper] = 0;
PrivateVehicle[playerid][slot][vehVentRight] = 0;
PrivateVehicle[playerid][slot][vehVentLeft] = 0;
PrivateVehicle[playerid][slot][vehPreis] = preis;
PrivateVehicle[playerid][slot][vehNeonID] = neon;
PrivateVehicle[playerid][slot][vehKMStand] = 0;
PrivateVehicle[playerid][slot][vehState] = e_Vehicle_Status_Normal;
PrivateVehicle[playerid][slot][vehTUV] = 0;
PlayerHaveCar[playerid][slot] = 1;
PrivateVehicle[playerid][slot][vehID] = INVALID_VEHICLE_ID;
if( PrivateVehicle[playerid][slot][vehState] == e_Vehicle_Status_Destroyed ) {
printf("Das Fahrzeug von %s konnte nicht erstellt werden. Grund: Zerstört",GetName(playerid));
return false;
}
format(PrivateVehicle[playerid][slot][vehNumberPlate], 64, KEIN_KENNZEICHEN);
PrivateVehicle[playerid][slot][vehID] = CreateVehicle(PrivateVehicle[playerid][slot][CarModel], PrivateVehicle[playerid][slot][vehPosX], PrivateVehicle[playerid][slot][vehPosY], PrivateVehicle[playerid][slot][vehPosZ], PrivateVehicle[playerid][slot][vehPosA], PrivateVehicle[playerid][slot][vehColor1], PrivateVehicle[playerid][slot][vehColor2], -1);
aiVehicles[PrivateVehicle[playerid][slot][vehID]] = VEH_PRIVAT;
if(!strcmp(PrivateVehicle[playerid][slot][vehNumberPlate], KEIN_KENNZEICHEN)) {
SetVehicleNumberPlate(PrivateVehicle[playerid][slot][vehID], "." );
}
else {
SetVehicleNumberPlate(PrivateVehicle[playerid][slot][vehID], PrivateVehicle[playerid][slot][vehNumberPlate]);
}
g_VehicleDistance[PrivateVehicle[playerid][slot][vehID]] = PrivateVehicle[playerid][slot][vehKMStand];
LockCar(PrivateVehicle[playerid][slot][vehID]);
strdel(mainQuery, 0, sizeof(mainQuery));
strcat(mainQuery, "INSERT INTO `server_vehicles` (`vehBesitzer`, `slot`, `modelid`, `vehPosX`, `vehPosY`, `vehPosZ`, `vehPosA`, `vehColor1`, `vehColor2`, ");
strcat(mainQuery, "`vehPaintjob`, `vehSpoiler`, `vehHood`, `vehRoof`, `vehSideskirt`, `vehLamps`, `vehNitro`, `vehExhaust`, `vehWheels`, `vehStereo`, `vehHydraulics`, ");
strcat(mainQuery, "`vehFrontBumper`, `vehRearBumper`, `vehVentRight`, `vehVentLeft`, `vehPreis`, `vehNeonID`, `vehNumberPlate`, `vehFuel`, `vehKMStand`, `vehInterior`, ");
strcat(mainQuery, "`vehWorld`,`vehTUV`,`vehState`) VALUES (");
format(secondQuery, sizeof(secondQuery), "'%s', '%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d', ",
PrivateVehicle[playerid][slot][vehBesitzer], slot, PrivateVehicle[playerid][slot][CarModel], PrivateVehicle[playerid][slot][vehPosX],
PrivateVehicle[playerid][slot][vehPosY], PrivateVehicle[playerid][slot][vehPosZ], PrivateVehicle[playerid][slot][vehPosA],
PrivateVehicle[playerid][slot][vehColor1], PrivateVehicle[playerid][slot][vehColor2]);
strcat(mainQuery, secondQuery);
format(secondQuery, sizeof(secondQuery), "'%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', ",
PrivateVehicle[playerid][slot][vehPaintjob], PrivateVehicle[playerid][slot][vehSpoiler], PrivateVehicle[playerid][slot][vehHood],
PrivateVehicle[playerid][slot][vehRoof], PrivateVehicle[playerid][slot][vehSideskirt], PrivateVehicle[playerid][slot][vehLamps],
PrivateVehicle[playerid][slot][vehNitro], PrivateVehicle[playerid][slot][vehExhaust], PrivateVehicle[playerid][slot][vehWheels],
PrivateVehicle[playerid][slot][vehStereo], PrivateVehicle[playerid][slot][vehHydraulics]);
strcat(mainQuery, secondQuery);
format(secondQuery, sizeof(secondQuery), "'%d', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d')",
PrivateVehicle[playerid][slot][vehFrontBumper], PrivateVehicle[playerid][slot][vehRearBumper], PrivateVehicle[playerid][slot][vehVentRight],
PrivateVehicle[playerid][slot][vehVentLeft], PrivateVehicle[playerid][slot][vehPreis], PrivateVehicle[playerid][slot][vehNeonID],
PrivateVehicle[playerid][slot][vehNumberPlate], gGas[PrivateVehicle[playerid][slot][vehID]], g_VehicleDistance[PrivateVehicle[playerid][slot][vehID]],
PrivateVehicle[playerid][slot][vehInterior], PrivateVehicle[playerid][slot][vehWorld], PrivateVehicle[playerid][slot][vehTUV], PrivateVehicle[playerid][slot][vehState]);
strcat(mainQuery, secondQuery);
mysql_function_query(MySQLConnected, mainQuery, false, "", "");
SetVehicleToRespawn(PrivateVehicle[playerid][slot][vehID]);
gGas[PrivateVehicle[playerid][slot][vehID]] = PrivateVehicle[playerid][slot][vehFuel];
gMaxGas[PrivateVehicle[playerid][slot][vehID]] = GetMaxTank(PrivateVehicle[playerid][slot][vehID]);
return 1;
}
}
}
return 1;
}
Alles anzeigen
Hey,
Mein Fahrzeug spawnt immer mit 0 Liter aber in der Datenbank sind 100 Liter festgehalten?