Ich arbeite in PHP selten (vielleicht sollte ich das mal ändern) mit LEFT JOIN daher ist das neuland für mich.
public OnLoadBiz(){
new rows, string[256];
cache_get_row_count(rows);
printf("Einträge: %i", rows);
for(new i = 0; i < rows; i++){
cache_get_value_name_int(i, "id", bInfo[i][biz_id]);
cache_get_value_name_int(i, "biz_typ", bInfo[i][biz_typ]);
cache_get_value_name(i, "biz_name", bInfo[i][biz_name], 256);
cache_get_value_name_int(i, "biz_owner", bInfo[i][biz_owner]);
cache_get_value_name_int(i, "biz_sowner", bInfo[i][biz_sowner]);
cache_get_value_name_int(i, "biz_level", bInfo[i][biz_level]);
cache_get_value_name_int(i, "int_id", bInfo[i][int_id]);
cache_get_value_name_float(i, "bizkosten", bInfo[i][biz_kosten]);
cache_get_value_name_float(i, "bizkasse", bInfo[i][biz_kasse]);
cache_get_value_name_float(i, "biz_x", bInfo[i][biz_x]);
cache_get_value_name_float(i, "biz_y", bInfo[i][biz_y]);
cache_get_value_name_float(i, "biz_z", bInfo[i][biz_z]);
cache_get_value_name_float(i, "int_x", bInfo[i][int_x]);
cache_get_value_name_float(i, "int_y", bInfo[i][int_y]);
cache_get_value_name_float(i, "int_z", bInfo[i][int_z]);
cache_get_value_name_float(i, "i_x", bInfo[i][i_x]);
cache_get_value_name_float(i, "i_y", bInfo[i][i_y]);
cache_get_value_name_float(i, "i_z", bInfo[i][i_z]);
cache_get_value_name_int(i, "actor_skin", bInfo[i][actor_skin]);
cache_get_value_name_float(i, "actor_x", bInfo[i][actor_x]);
cache_get_value_name_float(i, "actor_y", bInfo[i][actor_y]);
cache_get_value_name_float(i, "actor_z", bInfo[i][actor_z]);
cache_get_value_name_float(i, "actor_r", bInfo[i][actor_r]);
cache_get_value_name_float(i, "liefer_x", bInfo[i][liefer_x]);
cache_get_value_name_float(i, "liefer_y", bInfo[i][liefer_y]);
cache_get_value_name_float(i, "liefer_z", bInfo[i][liefer_z]);
printf("%i", bInfo[i][biz_owner]);
new teilhaber[MAX_PLAYER_NAME], inhaber[MAX_PLAYER_NAME];
if(bInfo[i][biz_owner] == 0){
bizPickup[i] = CreatePickup(1274, 1, bInfo[i][biz_x], bInfo[i][biz_y], bInfo[i][biz_z], 0);
format(string, sizeof(string), "{00AFFF}%s - Zum Verkauf\n{00AFFF}Kosten: {FFFFFF}%0.0f€\n{00AFFF}Benötigtes Level: {FFFFFF}%i\n\nZum Betreten /enter oder Z", bInfo[i][biz_name], bInfo[i][biz_kosten], bInfo[i][biz_level]);
}else{
if(bInfo[i][biz_sowner] == 0){
teilhaber = "Niemand";
}else{
teilhaber = GetDBName(bInfo[i][biz_sowner]);
}
new query[512];
mysql_format(handle, query, sizeof(query), "SELECT * FROM geschaefte LEFT JOIN user ON geschaefte.biz_owner = user.id");
mysql_query(handle, query);
cache_get_value_name(0, "name", inhaber, MAX_PLAYER_NAME);
printf("%s", query);
bizPickup[i] = CreatePickup(1239, 1, bInfo[i][biz_x], bInfo[i][biz_y], bInfo[i][biz_z], 0);
format(string, sizeof(string), "{00AFFF}%s\nInhaber: {FFFFFF}%s\n{00AFFF}Teilhaber: {FFFFFF}%s\n\nZum Betreten /enter oder Z", bInfo[i][biz_name], inhaber, teilhaber);
}
bizLabel[i] = Create3DTextLabel(string, COLOR_WHITE, bInfo[i][biz_x], bInfo[i][biz_y], bInfo[i][biz_z], 10, 0, 0);
format(string, sizeof(string), "%s - Lieferpunkt\n\n/beliefern", bInfo[i][biz_name]);
lieferLabel[i] = Create3DTextLabel(string, COLOR_RED, bInfo[i][liefer_x], bInfo[i][liefer_y], bInfo[i][liefer_z], 10.0, 0, 0);
CreatePickup(1239, 1, bInfo[i][liefer_x], bInfo[i][liefer_y], bInfo[i][liefer_z], 0);
bizActor[i] = CreateActor(bInfo[i][actor_skin], bInfo[i][actor_x], bInfo[i][actor_y], bInfo[i][actor_z], bInfo[i][actor_r]);
format(string, sizeof(string), "%s - Personal", bInfo[i][biz_name]);
bizActorLabel[i] = Create3DTextLabel(string, COLOR_WHITE, bInfo[i][actor_x], bInfo[i][actor_y], bInfo[i][actor_z]+1, 10.0, bInfo[i][biz_id], 0);
SetActorVirtualWorld(bizActor[i], bInfo[i][biz_id]);
printf("BizID: %i | Biz Name: %s | Inhaber: %s | Teilhaber: %s", bInfo[i][biz_id], bInfo[i][biz_name], inhaber, teilhaber);
if(i == 2) break;
}
print(" ");
printf("|__________%i/%i Geschäfte wurden Geladen__________|", rows, MAX_BIZ);
new query[1024];
//Tankstellen
mysql_format(handle, query, sizeof(query), "SELECT * FROM tankstellen");
mysql_pquery(handle, query, "OnLoadTanke");
return 1;
}
Alles anzeigen