getFreeCarID()
{
for(new i=0; i<sizeof(AutoInfo); i++)
{
if(AutoInfo[i] [Fahrzeugid]==0)return i;
}
return 0;
}
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 id=getFreeCarID();
AutoInfo[i] [model]=cache_get_field_content_int(i,"Besitzer",dbhandle);
AutoInfo[i][Besitzer]=cache_get_field_content_int(i,"model",dbhandle);
AutoInfo[i][c_x]=cache_get_field_content_float(i,"c_x",dbhandle);
AutoInfo[i][c_y]=cache_get_field_content_float(i,"c_y",dbhandle);
AutoInfo[i][c_z]=cache_get_field_content_float(i,"c_z",dbhandle);
AutoInfo[i][c_r]=cache_get_field_content_float(i,"c_r",dbhandle);
AutoInfo[id] [db_id]=cache_get_field_content_int(i,"id",dbhandle);
AutoInfo[id][Fahrzeugid]=CreateVehicle(AutoInfo[i][model],AutoInfo[i][c_x],AutoInfo[i][c_y],AutoInfo[i][c_z],AutoInfo[i][c_r],-1,-1,-1);
}
return 1;
}
loadplayercars(playerid)
{
new query[128];
format(query,sizeof(query),"SELECT * FROM Autos WHERE Besitzer='%i' ",sInfo[playerid] [db_id]);
mysql_function_query(dbhandle,query,true,"OnPlayerCarsLoad","i"playerid);
return 1;
autos werden zwar in die db gespeichert aber werden nach server restart nicht aus der db geladen ich weiss leider auch nicht wo der fehler sein könnte