hallo breadfish
ich habe folgendes Problem
und zwar habe ich ein neues Autohaus
und es liegt dabei wenn mann ein Auto kauft wird es nicht mal gespeichert somit auch nicht erstellt
hoffe ihr findet den fehler
ich habe das MSQL R39-3
public OnPlayerBuyCar(playerid,Model,Preis,Autohaus)//CARSYS{if(IsPlayerConnected(playerid) && !Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]]){CallRemoteFunction("M_GivePlayerMoney","id",playerid,-Preis);Gas[Model] = GetGasMax(GetVehicleModel(Model));/*if(Autohaus == 0){new bizzid=18;if(strcmp(GetName(playerid), SBizzInfo[Spielerinfo[playerid][pPbiskey]-100][sbOwner], true) != 0){SBizzInfo[bizzid][sbTill] += Preis;}}else if(Autohaus == 1){new bizzid=20;if(strcmp(GetName(playerid), SBizzInfo[Spielerinfo[playerid][pPbiskey]-100][sbOwner], true) != 0){SBizzInfo[bizzid][sbTill] += Preis;}}else if(Autohaus == 2){new bizzid=19;if(strcmp(GetName(playerid), SBizzInfo[Spielerinfo[playerid][pPbiskey]-100][sbOwner], true) != 0){SBizzInfo[bizzid][sbTill] += Preis;}}else if(Autohaus == 3){new bizzid=1;if(strcmp(GetName(playerid), SBizzInfo[Spielerinfo[playerid][pPbiskey]-100][sbOwner], true) != 0){SBizzInfo[bizzid][sbTill] += Preis;}}else if(Autohaus == 4){new bizzid=0;if(strcmp(GetName(playerid), SBizzInfo[Spielerinfo[playerid][pPbiskey]-100][sbOwner], true) != 0){SBizzInfo[bizzid][sbTill] += Preis;}}*/SetParkPlatz(playerid,Autohaus);new name[MAX_PLAYER_NAME], str[256], x = Dtc_PlayerKey[playerid];GetPlayerName(playerid, name, sizeof name);format(str, 256, "INSERT INTO `carsystem` (`CarOwner`) VALUES ('%s_%d')",name,x);mysql_pquery(handle, str);format(str, 256, "UPDATE `carsystem` SET `CarModel`='%d',`CarPos_X`='%f',`CarPos_Y`='%f',`CarPos_Z`='%f',`CarPos_A`='%f',`CarNitro`='0',`CarHyd`='0',`CarWheel`='0',`CarAusp`='0' WHERE `CarOwner`='%s_%d'",Model, PlayerCar[playerid][x][CarPos_x], PlayerCar[playerid][x][CarPos_y], PlayerCar[playerid][x][CarPos_z], PlayerCar[playerid][x][CarRotate], name, x);mysql_pquery(handle, str);format(str, 256, "UPDATE `carsystem` SET `CarSideL`='0',`CarSideR`='0',`CarFB`='0',`CarFB`='0',`CarRB`='0',`CarSpoiler`='0',`CarRoof`='0',`CarHood`='0',`CarVents`='0',`CarLamps`='0' WHERE `CarOwner`='%s_%d'",name, x);mysql_pquery(handle, str);format(str, 256, "UPDATE `carsystem` SET `CarPJ`='0',`CarC1`='0',`CarC2`='0',`Preis`='%d',`Neon`='0',`Plate`='0',`Number`='LoH-0',`Gesperrt`='0',`Sperrpreis`='0',`Kralle`='0' WHERE `CarOwner`='%s_%d'",Preis, name, x);mysql_pquery(handle, str);OnPlayerCarLogin(playerid);}}
public OnPlayerCarLogin(playerid){for(new x = 0; x < MaxVeh; x++){if(!Dtc_PlayerHaveCar[playerid][x]){new string2[256],string3[256];new playername2[MAX_PLAYER_NAME];GetPlayerName(playerid, playername2, sizeof(playername2));format(string3, sizeof(string3), "/Privatcars/%s%d.dtcar", playername2,x);new File: UserFile = fopen(string3, 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 , "Neon" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][Neon] = strval( val ); }if( strcmp( key , "Plate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPlate] = strval( val ); }if( strcmp( key , "Number" , true ) == 0 ) { val = ini_GetValue( Data ); format(PlayerCar[playerid][x][CarNumber], 32, "%s", val); }if( strcmp( key , "Gesperrt" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarGesperrt] = strval( val ); }if( strcmp( key , "Sperrpreis" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSperrpreis] = strval( val ); }if( strcmp( key , "Abgeschleppt", true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][Abgeschleppt] = strval( val ); }}fclose(UserFile);format(string2, 256, "INSERT INTO `carsystem` (`CarOwner`) VALUES ('%s_%d')",playername2,x);mysql_pquery(handle, string2);format(string2, 1024, "UPDATE `carsystem` SET `CarModel`='%d',`CarPos_X`='%f',`CarPos_Y`='%f',`CarPos_Z`='%f',`CarPos_A`='%f',`CarNitro`='%d',`CarHyd`='%d',`CarWheel`='%d',`CarAusp`='%d' WHERE `CarOwner`='%s_%d'",PlayerCar[playerid][x][CarModel], PlayerCar[playerid][x][CarPos_x], PlayerCar[playerid][x][CarPos_y], PlayerCar[playerid][x][CarPos_z],PlayerCar[playerid][x][CarRotate], PlayerCar[playerid][x][CarNitro],PlayerCar[playerid][x][CarHyd], PlayerCar[playerid][x][CarWheel], PlayerCar[playerid][x][CarAusp], playername2, x);mysql_pquery(handle, string2);format(string2, 1024, "UPDATE `carsystem` SET `CarSideL`='%d',`CarSideR`='%d',`CarFB`='%d',`CarFB`='%d',`CarRB`='%d',`CarSpoiler`='%d',`CarRoof`='%d',`CarHood`='%d',`CarVents`='%d',`CarLamps`='%d' WHERE `CarOwner`='%s_%d'",PlayerCar[playerid][x][CarSideL], PlayerCar[playerid][x][CarSideR], PlayerCar[playerid][x][CarFB], PlayerCar[playerid][x][CarRB],PlayerCar[playerid][x][CarSpoiler], PlayerCar[playerid][x][CarRoof],PlayerCar[playerid][x][CarHood], PlayerCar[playerid][x][CarVents], PlayerCar[playerid][x][CarLamps], playername2, x);mysql_pquery(handle, string2);format(string2, 1024, "UPDATE `carsystem` SET `CarPJ`='%d',`CarC1`='%d',`CarC2`='%d',`Preis`='%d',`Neon`='%d',`Plate`='%d',`Number`='%s',`Gesperrt`='%d',`Sperrpreis`='%d',`Kralle`='%d' WHERE `CarOwner`='%s_%d'",PlayerCar[playerid][x][CarPJ], PlayerCar[playerid][x][CarC1], PlayerCar[playerid][x][CarC2], PlayerCar[playerid][x][CarPreis],PlayerCar[playerid][x][Neon], PlayerCar[playerid][x][CarPlate],PlayerCar[playerid][x][CarNumber], PlayerCar[playerid][x][CarGesperrt], PlayerCar[playerid][x][CarSperrpreis], PlayerCar[playerid][x][Kralle], playername2, x);mysql_pquery(handle, string2);fremove(string3);PlayerCarSpawn(playerid,x);}else{format(string2, 256, "SELECT * FROM `carsystem` WHERE `CarOwner`='%s_%d'",playername2,x);mysql_pquery(handle, string2, "LoadMysqlCars", "sii", playername2,x,playerid, 0);}}}}
forward LoadMysqlCars(playername,x,playerid);public LoadMysqlCars(playername,x,playerid){new rows,fields,v[128];cache_get_data(rows,fields);if(rows) {Dtc_PlayerHaveCar[playerid][x] = 1;cache_get_field_content(0,"CarModel",v); PlayerCar[playerid][x][CarModel] = strval(v);cache_get_field_content(0,"CarPos_X",v); PlayerCar[playerid][x][CarPos_x] = floatstr(v);cache_get_field_content(0,"CarPos_Y",v); PlayerCar[playerid][x][CarPos_y] = floatstr(v);cache_get_field_content(0,"CarPos_Z",v); PlayerCar[playerid][x][CarPos_z] = floatstr(v);cache_get_field_content(0,"CarPos_A",v); PlayerCar[playerid][x][CarRotate] = floatstr(v);cache_get_field_content(0,"CarNitro",v); PlayerCar[playerid][x][CarNitro] = strval(v);cache_get_field_content(0,"CarHyd",v); PlayerCar[playerid][x][CarHyd] = strval(v);cache_get_field_content(0,"CarWheel",v); PlayerCar[playerid][x][CarWheel] = strval(v);cache_get_field_content(0,"CarAusp",v); PlayerCar[playerid][x][CarAusp] = strval(v);cache_get_field_content(0,"CarSideL",v); PlayerCar[playerid][x][CarSideL] = strval(v);cache_get_field_content(0,"CarSideR",v); PlayerCar[playerid][x][CarSideR] = strval(v);cache_get_field_content(0,"CarFB",v); PlayerCar[playerid][x][CarFB] = strval(v);cache_get_field_content(0,"CarRB",v); PlayerCar[playerid][x][CarRB] = strval(v);cache_get_field_content(0,"CarSpoiler",v); PlayerCar[playerid][x][CarSpoiler] = strval(v);cache_get_field_content(0,"CarRoof",v); PlayerCar[playerid][x][CarRoof] = strval(v);cache_get_field_content(0,"CarHood",v); PlayerCar[playerid][x][CarHood] = strval(v);cache_get_field_content(0,"CarVents",v); PlayerCar[playerid][x][CarVents] = strval(v);cache_get_field_content(0,"CarLamps",v); PlayerCar[playerid][x][CarLamps] = strval(v);cache_get_field_content(0,"CarPJ",v); PlayerCar[playerid][x][CarPJ] = strval(v);cache_get_field_content(0,"CarC1",v); PlayerCar[playerid][x][CarC1] = strval(v);cache_get_field_content(0,"CarC2",v); PlayerCar[playerid][x][CarC2] = strval(v);cache_get_field_content(0,"Preis",v); PlayerCar[playerid][x][CarPreis] = strval(v);cache_get_field_content(0,"Neon",v); PlayerCar[playerid][x][Neon] = strval(v);cache_get_field_content(0,"Plate",v); PlayerCar[playerid][x][CarPlate] = strval(v);cache_get_field_content(0,"Number",v); format(PlayerCar[playerid][x][CarNumber], 32, "%s", v);cache_get_field_content(0,"Gesperrt",v); PlayerCar[playerid][x][CarGesperrt] = strval(v);cache_get_field_content(0,"Sperrpreis",v); PlayerCar[playerid][x][CarSperrpreis] = strval(v);cache_get_field_content(0,"Kralle",v); PlayerCar[playerid][x][Kralle] = strval(v);PlayerCarSpawn(playerid,x);}}
public 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);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(PlayerCar[playerid][Slot][CarPlate] != 0) {SetVehicleNumberPlate(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarNumber]);}SetVehicleToRespawn(Slot);if(Dtc_LockOnSpawn == 1){Dtc_Carlock[PlayerCar[playerid][Slot][CarId]] = 1;Dtc_LockCar(PlayerCar[playerid][Slot][CarId]);}if(PlayerCar[playerid][Slot][Neon] == 1){new Float:x,Float:y,Float:z;Neonrohr[playerid][Neon] = CreateObject(18648,x,y,z,0,0,0,283);Neonrohr[playerid][Neon1] = CreateObject(18648,x,y,z,0,0,0,283);AttachObjectToVehicle(Neonrohr[playerid][Neon], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], 0.8,0,-0.70,0,0,0);AttachObjectToVehicle(Neonrohr[playerid][Neon1], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], -0.8,0,-0.70,0,0,0);}if(PlayerCar[playerid][Slot][Neon] == 2){new Float:x,Float:y,Float:z;Neonrohr[playerid][Neon] = CreateObject(18647,x,y,z,0,0,0,283);Neonrohr[playerid][Neon1] = CreateObject(18647,x,y,z,0,0,0,283);AttachObjectToVehicle(Neonrohr[playerid][Neon], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], 0.8,0,-0.70,0,0,0);AttachObjectToVehicle(Neonrohr[playerid][Neon1], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], -0.8,0,-0.70,0,0,0);}if(PlayerCar[playerid][Slot][Neon] == 3){new Float:x,Float:y,Float:z;Neonrohr[playerid][Neon] = CreateObject(18649,x,y,z,0,0,0,283);Neonrohr[playerid][Neon1] = CreateObject(18649,x,y,z,0,0,0,283);AttachObjectToVehicle(Neonrohr[playerid][Neon], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], 0.8,0,-0.70,0,0,0);AttachObjectToVehicle(Neonrohr[playerid][Neon1], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], -0.8,0,-0.70,0,0,0);}if(PlayerCar[playerid][Slot][Neon] == 4){new Float:x,Float:y,Float:z;Neonrohr[playerid][Neon] = CreateObject(18652,x,y,z,0,0,0,283);Neonrohr[playerid][Neon1] = CreateObject(18652,x,y,z,0,0,0,283);AttachObjectToVehicle(Neonrohr[playerid][Neon], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], 0.8,0,-0.70,0,0,0);AttachObjectToVehicle(Neonrohr[playerid][Neon1], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], -0.8,0,-0.70,0,0,0);}if(PlayerCar[playerid][Slot][Neon] == 5){new Float:x,Float:y,Float:z;Neonrohr[playerid][Neon] = CreateObject(18651,x,y,z,0,0,0,283);Neonrohr[playerid][Neon1] = CreateObject(18651,x,y,z,0,0,0,283);AttachObjectToVehicle(Neonrohr[playerid][Neon], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], 0.8,0,-0.70,0,0,0);AttachObjectToVehicle(Neonrohr[playerid][Neon1], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], -0.8,0,-0.70,0,0,0);}if(PlayerCar[playerid][Slot][Neon] == 6){new Float:x,Float:y,Float:z;Neonrohr[playerid][Neon] = CreateObject(18650,x,y,z,0,0,0,283);Neonrohr[playerid][Neon1] = CreateObject(18650,x,y,z,0,0,0,283);AttachObjectToVehicle(Neonrohr[playerid][Neon], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], 0.8,0,-0.70,0,0,0);AttachObjectToVehicle(Neonrohr[playerid][Neon1], PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId], -0.8,0,-0.70,0,0,0);}}}}