Hallo!
Ich habe ein kleines Problem beim erstellen von Fahrzeugen.
stock CreatePlayerCar(playerid, modelid, Float:x, Float:y, Float:z, Float:r, col1, col2)
{
for(new i=0; i<MAX_VEHICLES; i++)
{
if(GetVehicleModel(i) != 0) continue;
vInfo[i][ParkX]=x;
vInfo[i][ParkY]=y;
vInfo[i][ParkZ]=z;
vInfo[i][ParkA]=r;
vInfo[i][model]=modelid;
vInfo[i][pVeh] = 1;
vInfo[i][ccolor1] = col1;
vInfo[i][ccolor2] = col2;
vInfo[i][id_x] = AddStaticVehicleEx(modelid, x, y, z, r, col1, col2, -1);
strins(vInfo[i][besitzer], pInfo[playerid][pName], 0);
printf("%s | %s", vInfo[i][besitzer], pInfo[playerid][pName]);
SaveCarToDB(i);
return 1;
}
return 1;
}
Was passieren soll: Fahrzeug soll erstellt werden und in die Datenbank eingefügt werden.
Was wirklich passiert: Es wird nur in die Datenbank eingefügt.
stock LoadPlayerCars(playerid)
{
new query[128];
format(query,sizeof(query),"SELECT * FROM cars WHERE besitzer='%s'",pInfo[playerid][pName]);
mysql_function_query(dbhandle,query,true,"OnPlayerCarsLoad","i",playerid);
return 1;
}
public OnPlayerCarsLoad(playerid)
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(!num_rows)return 1;
for(new i=0; i<num_rows; i++)
{
new modelid, color1, color2, Float:X, Float:Y, Float:Z, Float:A, id, besitzer1[MAX_PLAYER_NAME], carkey1[MAX_PLAYER_NAME], vehid;
modelid=cache_get_field_content_int(i,"modelid",dbhandle);
cache_get_field_content(0, "besitzer", besitzer1, dbhandle, sizeof(besitzer1));
cache_get_field_content(0, "carkey", carkey1, dbhandle, sizeof(carkey1));
X=cache_get_field_content_float(i,"x",dbhandle);
Y=cache_get_field_content_float(i,"y",dbhandle);
Z=cache_get_field_content_float(i,"z",dbhandle);
A=cache_get_field_content_float(i,"r",dbhandle);
id=cache_get_field_content_int(i,"id",dbhandle);
color1=cache_get_field_content_int(i,"color1",dbhandle);
color2=cache_get_field_content_int(i,"color2",dbhandle);
vehid=AddStaticVehicleEx(modelid, X, Y, Z, A, color1, color2, -1);
vInfo[vehid][besitzer] = besitzer1;
vInfo[vehid][db_id] = id;
vInfo[vehid][ParkX] = X;
vInfo[vehid][ParkY] = Y;
vInfo[vehid][ParkZ] = Z;
vInfo[vehid][ParkA] = A;
vInfo[vehid][ccolor1] = color1;
vInfo[vehid][ccolor2] = color2;
vInfo[vehid][model] = modelid;
vInfo[vehid][pVeh] = 1;
vInfo[vehid][carkey] = carkey1;
vInfo[vehid][id_x] = vehid;
}
return 1;
}
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(!num_rows)return 1;
for(new i=0; i<num_rows; i++)
{
new modelid, color1, color2, Float:X, Float:Y, Float:Z, Float:A, id, besitzer1[MAX_PLAYER_NAME], carkey1[MAX_PLAYER_NAME], vehid;
modelid=cache_get_field_content_int(i,"modelid",dbhandle);
cache_get_field_content(0, "besitzer", besitzer1, dbhandle, sizeof(besitzer1));
cache_get_field_content(0, "carkey", carkey1, dbhandle, sizeof(carkey1));
X=cache_get_field_content_float(i,"x",dbhandle);
Y=cache_get_field_content_float(i,"y",dbhandle);
Z=cache_get_field_content_float(i,"z",dbhandle);
A=cache_get_field_content_float(i,"r",dbhandle);
id=cache_get_field_content_int(i,"id",dbhandle);
color1=cache_get_field_content_int(i,"color1",dbhandle);
color2=cache_get_field_content_int(i,"color2",dbhandle);
vehid=AddStaticVehicleEx(modelid, X, Y, Z, A, color1, color2, -1);
vInfo[vehid][besitzer] = besitzer1;
vInfo[vehid][db_id] = id;
vInfo[vehid][ParkX] = X;
vInfo[vehid][ParkY] = Y;
vInfo[vehid][ParkZ] = Z;
vInfo[vehid][ParkA] = A;
vInfo[vehid][ccolor1] = color1;
vInfo[vehid][ccolor2] = color2;
vInfo[vehid][model] = modelid;
vInfo[vehid][pVeh] = 1;
vInfo[vehid][carkey] = carkey1;
vInfo[vehid][id_x] = vehid;
}
return 1;
}
Was passieren soll: Das Fahrzeug soll aus der Datenbank ausgelesen werden und erstellt werden.
Was wirklich passiert: Nichts.
In beiden fällen wird keine mysql_log datei erstellt. Ich hoffe mir kann jemand helfen!!
MfG