Guten Abend Breadfish-Community,
ich versuche derzeitig mein Autosystem von Dini auf MySQL umzuschreiben, letztens hatte Jeffry mir wegen dem Carkey System weitergeholfe weil ich da nicht weiter kam
jedoch komme ich jetzt nicht beim Kennzeichen lade funktion weiter...
Lade Funktion:
Function OnPlayerCarLogin(playerid)
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
for(new x = 0; x < num_rows; x++)
{
if(!Dtc_PlayerHaveCar[playerid][x])
{
Dtc_PlayerHaveCar[playerid][x] = 1;
//Dtc_PlayerKey[playerid];
PlayerCar[playerid][x][CarId] = cache_get_field_content_int(x,"CarId",dbhandle);
PlayerCar[playerid][x][CarModel] = cache_get_field_content_int(x,"CarModel",dbhandle);
PlayerCar[playerid][x][CarPos_x] = cache_get_field_content_float(x,"CarPos_x",dbhandle);
PlayerCar[playerid][x][CarPos_y] = cache_get_field_content_float(x,"CarPos_y",dbhandle);
PlayerCar[playerid][x][CarPos_z] = cache_get_field_content_float(x,"CarPos_z",dbhandle);
PlayerCar[playerid][x][CarRotate] = cache_get_field_content_float(x,"CarRotate",dbhandle);
PlayerCar[playerid][x][CarNitro] = cache_get_field_content_int(x,"CarNitro",dbhandle);
PlayerCar[playerid][x][CarHyd] = cache_get_field_content_int(x,"CarHyd",dbhandle);
PlayerCar[playerid][x][CarAusp] = cache_get_field_content_int(x,"CarAusp",dbhandle);
PlayerCar[playerid][x][CarSideL] = cache_get_field_content_int(x,"CarSideL",dbhandle);
PlayerCar[playerid][x][CarSideR] = cache_get_field_content_int(x,"CarSideR",dbhandle);
PlayerCar[playerid][x][CarFB] = cache_get_field_content_int(x,"CarFB",dbhandle);
PlayerCar[playerid][x][CarRB] = cache_get_field_content_int(x,"CarRB",dbhandle);
PlayerCar[playerid][x][CarSpoiler] = cache_get_field_content_int(x,"CarSpoiler",dbhandle);
PlayerCar[playerid][x][CarRoof] = cache_get_field_content_int(x,"CarRoof",dbhandle);
PlayerCar[playerid][x][CarHood] = cache_get_field_content_int(x,"CarHood",dbhandle);
PlayerCar[playerid][x][CarVents] = cache_get_field_content_int(x,"CarVents",dbhandle);
PlayerCar[playerid][x][CarLamps] = cache_get_field_content_int(x,"CarLamps",dbhandle);
PlayerCar[playerid][x][CarPJ] = cache_get_field_content_int(x,"CarPJ",dbhandle);
PlayerCar[playerid][x][CarC1] = cache_get_field_content_int(x,"CarC1",dbhandle);
PlayerCar[playerid][x][CarC2] = cache_get_field_content_int(x,"CarC2",dbhandle);
PlayerCar[playerid][x][CarArrest] = cache_get_field_content_int(x,"CarArrest",dbhandle);
PlayerCar[playerid][x][Plate] = cache_get_field_content(x,"Plate",dbhandle);
printf("Kennzeichen: %s", PlayerCar[playerid][x][Plate]);
PlayerCarSpawn(playerid,x);
}
}
return 1;
}
Fehlermeldung:
(70554) : error 035: argument type mismatch (argument 3)
Zeile:
PlayerCar[playerid][x][Plate] = cache_get_field_content(x,"Plate",dbhandle);
ich verstehe nicht was habe ich bei "cache_get_field_content" falsch gemacht?
Und mein 2. Problem wäre beim Autokauf...
Sobald man sich ein Auto gekauft hat wird dies zwar in der Datenbank erstellt aber es wird nicht gespawnt..
Kaufen:
Function OnPlayerBuyCar(playerid,Model,Preis,Autohaus)
{
if(IsPlayerConnected(playerid) && !Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
CallRemoteFunction("M_GivePlayerMoney","id",playerid,-Preis);
if(Autohaus == 2) //Billig Autohaus
{
SBizzInfo[1][sbTill] += Preis/4; //Billig Autohaus
}
if(Autohaus == 3) // luxus
{
SBizzInfo[0][sbTill] += Preis/4; // luxus
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, "*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!");
SetPlayerCheckpoint(playerid, 3.0, 618.7498, -1458.5891, 14.0340);
CreateBox(playerid,"","Route ~r~gesetzt~w~...");
SetParkPlatz(playerid,Autohaus);
new name[MAX_PLAYER_NAME],query[500];
GetPlayerName(playerid, name, sizeof name);
format(query,sizeof(query),"INSERT INTO autos (Name,CarOwner,CarModel,CarPos_x,CarPos_y,CarPos_z,CarRotate,CarPreis) VALUES ('%s','%s','%d','%f','%f','%f','%f','%d')",
name,name,Model,PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_x],PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_y],PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_z],PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarRotate],Preis);
mysql_function_query(dbhandle,query,false,"OnPlayerCarLogin","i",playerid);
}
}
Auto Spawn:
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[15];
SetVehicleNumberPlate(PlayerCar[playerid][Slot][CarId], strings);
SetVehicleToRespawn(PlayerCar[playerid][Slot][CarId]);
for(new x = 0; x < MaxVeh; x++)
{
PlayerCar[playerid][x][Plate] = strings;
}
}
}
}
Auch nach dem Auto kaufen und dem Spawnen finde ich den fehler nicht...
Ich hoffe ihr könnt mir weiterhelfen
Vielen Dank für eure Hilfe im Vorraus!
lg
J0a9