Beiträge von Jeffry

    format(query,sizeof(query),"SELECT `username` FROM `user` WHERE `IP` = '%s' AND NOT `username`='%s'",Spieler[playerid][p_IP], SpielerName(playerid));
    mysql_query(dbhandle,query);
    mysql_store_result();
    if(mysql_num_rows())
    {
    //Multi
    mysql_free_result();
    return 1;
    }
    mysql_free_result();


    Merlin13: Hast du vielleicht schon zu viele Objekte im Server?

    Anscheinend lag es doch beim LoadHouses, es klappt nun einwandfrei!


    Ja, es wurde - wie der Log zeigt - mit jedem Spieler-Connect aufgerufen. Da wir nicht wissen warum, habe ich es jetzt so unterbunden, dass es nochmal aufgerufen wird.


    static bool:called; //Bleibt im Wert erhalten, da static
    if(called) return 1; //Wenn es einmal aufgerufen wurde, dann beende es sofort
    called = true; //Erster Aufruf, danach kommt er hier nicht mehr hin.


    Damit du auch weißt, warum es klappt.

    forward LoadHouse();
    public LoadHouse()
    {
    static bool:called;
    if(called) return 1;
    called = true;
    new num_fields, num_rows, str[128];
    cache_get_data(num_rows,num_fields,dbhandle);
    if(num_rows > 0)
    {
    for(new i = 0; i<num_rows; i++)
    {
    printf("Lade: %d", i);
    HouseInfo[i][h_id] = cache_get_field_content_int(i,"id",dbhandle);
    HouseInfo[i][hOwned] = cache_get_field_content_int(i,"Owned",dbhandle);
    new tmp_name[MAX_PLAYER_NAME];
    cache_get_field_content(i, "Owner", tmp_name, dbhandle);
    strmid(HouseInfo[i][hOwner], tmp_name, i, sizeof(tmp_name), sizeof(tmp_name));
    //HouseInfo[i][hDescr] =
    HouseInfo[i][hEntrx] = cache_get_field_content_float(i,"Enterx",dbhandle);
    HouseInfo[i][hEntry] = cache_get_field_content_float(i,"Entery",dbhandle);
    HouseInfo[i][hEntrz] = cache_get_field_content_float(i,"Enterz",dbhandle);
    HouseInfo[i][hIntx] = cache_get_field_content_float(i,"Intx",dbhandle);
    HouseInfo[i][hInty] = cache_get_field_content_float(i,"Inty",dbhandle);
    HouseInfo[i][hIntz] = cache_get_field_content_float(i,"Intz",dbhandle);
    HouseInfo[i][hInt] = cache_get_field_content_int(i,"hInt",dbhandle);
    HouseInfo[i][hRentable] = cache_get_field_content_int(i,"Rentable",dbhandle);
    HouseInfo[i][hPrice] = cache_get_field_content_int(i,"Price",dbhandle);
    HouseInfo[i][hRent] = cache_get_field_content_int(i,"Rent",dbhandle);
    HouseInfo[i][hIntid] = cache_get_field_content_int(i,"Intid",dbhandle);
    HouseInfo[i][hLocked] = cache_get_field_content_int(i,"Locked",dbhandle);
    HouseInfo[i][hKasse] = cache_get_field_content_int(i,"Kasse",dbhandle);
    HouseInfo[i][hDate] = cache_get_field_content_int(i,"Date",dbhandle);

    if(!HouseInfo[i][hOwned]) format(str, sizeof str, "%s\nZum Verkauf\nPreis: %d€", HouseInfo[i][hDescr], HouseInfo[i][hPrice]);
    else if(HouseInfo[i][hOwned] && HouseInfo[i][hRentable] == 0) format(str, sizeof str, "%s\nBesitzer: %s",HouseInfo[i][hDescr], HouseInfo[i][hOwner]);
    else if(HouseInfo[i][hOwned] && HouseInfo[i][hRentable] == 1) format(str, sizeof str, "%s\nBesitzer: %s\nMiete: %d$\n/mieten zum Mieten",HouseInfo[i][hDescr], HouseInfo[i][hOwner], HouseInfo[i][hRent]);
    HouseInfo[i][hLabel] = CreateDynamic3DTextLabel(str, COLOR_HOUSELABEL, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz], 15, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 15);
    printf("Label %d an %f / %f / %f erstellt.", _:HouseInfo[i][hLabel], HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
    if(!HouseInfo[i][hOwned]) HouseInfo[i][hPick] = CreatePickup(1273, 1,HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
    else HouseInfo[i][hPick] = CreatePickup(19522, 1, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
    }
    }
    return 1;
    }


    Dann sollte es so passen.
    Poste gegebenefalls nochmal den Log.

    Du ersetzt:
    AttachObjectToVehicle(fb[vid],vid,-0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
    mit:
    switch(GetVehicleModel(vid))
    {
    case 400: AttachObjectToVehicle(fb[vid],vid,-0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
    case 401: AttachObjectToVehicle(fb[vid],vid,-0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
    //...
    }


    Die Koordinaten passt du dann entsprechend an.

    Was steht so im Server Log?
    forward LoadHouse();
    public LoadHouse()
    {
    new num_fields, num_rows, str[128];
    cache_get_data(num_rows,num_fields,dbhandle);
    if(num_rows > 0)
    {
    for(new i = 0; i<num_rows; i++)
    {
    printf("Lade: %d", i);
    HouseInfo[i][h_id] = cache_get_field_content_int(i,"id",dbhandle);
    HouseInfo[i][hOwned] = cache_get_field_content_int(i,"Owned",dbhandle);
    new tmp_name[MAX_PLAYER_NAME];
    cache_get_field_content(i, "Owner", tmp_name, dbhandle);
    strmid(HouseInfo[i][hOwner], tmp_name, i, sizeof(tmp_name), sizeof(tmp_name));
    //HouseInfo[i][hDescr] =
    HouseInfo[i][hEntrx] = cache_get_field_content_float(i,"Enterx",dbhandle);
    HouseInfo[i][hEntry] = cache_get_field_content_float(i,"Entery",dbhandle);
    HouseInfo[i][hEntrz] = cache_get_field_content_float(i,"Enterz",dbhandle);
    HouseInfo[i][hIntx] = cache_get_field_content_float(i,"Intx",dbhandle);
    HouseInfo[i][hInty] = cache_get_field_content_float(i,"Inty",dbhandle);
    HouseInfo[i][hIntz] = cache_get_field_content_float(i,"Intz",dbhandle);
    HouseInfo[i][hInt] = cache_get_field_content_int(i,"hInt",dbhandle);
    HouseInfo[i][hRentable] = cache_get_field_content_int(i,"Rentable",dbhandle);
    HouseInfo[i][hPrice] = cache_get_field_content_int(i,"Price",dbhandle);
    HouseInfo[i][hRent] = cache_get_field_content_int(i,"Rent",dbhandle);
    HouseInfo[i][hIntid] = cache_get_field_content_int(i,"Intid",dbhandle);
    HouseInfo[i][hLocked] = cache_get_field_content_int(i,"Locked",dbhandle);
    HouseInfo[i][hKasse] = cache_get_field_content_int(i,"Kasse",dbhandle);
    HouseInfo[i][hDate] = cache_get_field_content_int(i,"Date",dbhandle);

    if(!HouseInfo[i][hOwned]) format(str, sizeof str, "%s\nZum Verkauf\nPreis: %d€", HouseInfo[i][hDescr], HouseInfo[i][hPrice]);
    else if(HouseInfo[i][hOwned] && HouseInfo[i][hRentable] == 0) format(str, sizeof str, "%s\nBesitzer: %s",HouseInfo[i][hDescr], HouseInfo[i][hOwner]);
    else if(HouseInfo[i][hOwned] && HouseInfo[i][hRentable] == 1) format(str, sizeof str, "%s\nBesitzer: %s\nMiete: %d$\n/mieten zum Mieten",HouseInfo[i][hDescr], HouseInfo[i][hOwner], HouseInfo[i][hRent]);
    HouseInfo[i][hLabel] = CreateDynamic3DTextLabel(str, COLOR_HOUSELABEL, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz], 15, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 15);
    printf("Label %d an %f / %f / %f erstellt.", _:HouseInfo[i][hLabel], HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
    if(!HouseInfo[i][hOwned]) HouseInfo[i][hPick] = CreatePickup(1273, 1,HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
    else HouseInfo[i][hPick] = CreatePickup(19522, 1, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
    }
    }
    return 1;
    }

    Nutze ein Array mit den Daten:
    new Float:ATMPos[][] =
    {
    {1014.1, -928.70001, 41.9},
    {2561.6873,1962.0399,-5.4011} //Das letzte Item darf kein Komma haben
    };


    Und dann eine Schleife:
    for(new i=0; i<sizeof(ATMPos); i++)
    {
    if(IsPlayerInRangeOfPoint(playerid, 0.5, ATMPos[i][0], ATMPos[i][1], ATMPos[i][2]))
    {
    //In der Nähe
    return 1;
    }
    }
    //Nicht in der Nähe



    EDIT:
    Merlin13: Öh ja, natürlich mit dem i-Index. Gut, dass du es hinbekommen hast! :thumbup:

    Dann machst du den Befehl so:
    dcmd_fb(playerid,params[])
    {
    new status[50];
    if(sscanf(params,"s",status))
    {
    return SendClientMessage(playerid,0xFF0000,"Benutzung: [an/aus]");
    }
    if(!IsACop(playerid))
    {
    SendClientMessage(playerid, COLOR_GRAD1, "Du bist kein Cop!");
    return 1;
    }
    if(IsPlayerInAnyVehicle(playerid))
    {
    new vid = GetPlayerVehicleID(playerid);
    if(strcmp(status,"an",true) == 0)
    {
    if(fban[vid] == true)return SendClientMessage(playerid,0xFF0000,"Dieses Fahrzeug hat bereits eine FB!");
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    fb[vid] = CreateObject(18646,x,y,z,0,0,0,100);
    AttachObjectToVehicle(fb[vid],vid,-0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
    fban[vid] = true;
    SendClientMessage(playerid,0xFF0000,"Du hast die FB angeschaltet!");
    }
    else
    if(strcmp(status,"aus",true) == 0)
    {
    if(fban[vid] == false)return SendClientMessage(playerid,0xFF0000,"Dieses Fahrzeug hat keine fb");
    DestroyObject(fb[vid]);
    fban[vid] =false;
    SendClientMessage(playerid,0xFF0000,"Du hast die FB ausgeschaltet!");
    }
    else
    if(strcmp(status,"deagle",true) == 0)
    {
    if(fban[vid] == false)return SendClientMessage(playerid,0xFF0000,"Du bist ein kleines Kind!");
    Kick(playerid);
    SendClientMessage(playerid,0xFF0000,"-------!");
    }
    }
    return 1;
    }


    AttachObjectToVehicle(fb[vid],vid,-0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
    Diese musst du anpassen, also die Koordinaten musst du zu den Koordinaten vorne am Fahrzeug ändern.
    Nutze gegebenenfalls einen Editor: http://forum.sa-mp.com/showthread.php?t=282883


    Und unter den Includes fügst du
    new bool:fban[MAX_VEHICLES];
    new fb[MAX_VEHICLES];
    hinzu (gleich wie new sirene...).



    PS: Der Pawn BB Code - Die richtige Anwendung

    Du hast immer nur Zeile 0 ausgelesen.
    Schreibe es so:
    forward LoadHouse();
    public LoadHouse()
    {
    new num_fields, num_rows, str[128];
    cache_get_data(num_rows,num_fields,dbhandle);
    if(num_rows > 0)
    {
    for(new i = 0; i<num_rows; i++)
    {
    HouseInfo[i][h_id] = cache_get_field_content_int(i,"id",dbhandle);
    HouseInfo[i][hOwned] = cache_get_field_content_int(i,"Owned",dbhandle);
    new tmp_name[MAX_PLAYER_NAME];
    cache_get_field_content(i, "Owner", tmp_name, dbhandle);
    strmid(HouseInfo[i][hOwner], tmp_name, i, sizeof(tmp_name), sizeof(tmp_name));
    //HouseInfo[i][hDescr] =
    HouseInfo[i][hEntrx] = cache_get_field_content_float(i,"Enterx",dbhandle);
    HouseInfo[i][hEntry] = cache_get_field_content_float(i,"Entery",dbhandle);
    HouseInfo[i][hEntrz] = cache_get_field_content_float(i,"Enterz",dbhandle);
    HouseInfo[i][hIntx] = cache_get_field_content_float(i,"Intx",dbhandle);
    HouseInfo[i][hInty] = cache_get_field_content_float(i,"Inty",dbhandle);
    HouseInfo[i][hIntz] = cache_get_field_content_float(i,"Intz",dbhandle);
    HouseInfo[i][hInt] = cache_get_field_content_int(i,"hInt",dbhandle);
    HouseInfo[i][hRentable] = cache_get_field_content_int(i,"Rentable",dbhandle);
    HouseInfo[i][hPrice] = cache_get_field_content_int(i,"Price",dbhandle);
    HouseInfo[i][hRent] = cache_get_field_content_int(i,"Rent",dbhandle);
    HouseInfo[i][hIntid] = cache_get_field_content_int(i,"Intid",dbhandle);
    HouseInfo[i][hLocked] = cache_get_field_content_int(i,"Locked",dbhandle);
    HouseInfo[i][hKasse] = cache_get_field_content_int(i,"Kasse",dbhandle);
    HouseInfo[i][hDate] = cache_get_field_content_int(i,"Date",dbhandle);

    if(!HouseInfo[i][hOwned]) format(str, sizeof str, "%s\nZum Verkauf\nPreis: %d€", HouseInfo[i][hDescr], HouseInfo[i][hPrice]);
    else if(HouseInfo[i][hOwned] && HouseInfo[i][hRentable] == 0) format(str, sizeof str, "%s\nBesitzer: %s",HouseInfo[i][hDescr], HouseInfo[i][hOwner]);
    else if(HouseInfo[i][hOwned] && HouseInfo[i][hRentable] == 1) format(str, sizeof str, "%s\nBesitzer: %s\nMiete: %d$\n/mieten zum Mieten",HouseInfo[i][hDescr], HouseInfo[i][hOwner], HouseInfo[i][hRent]);
    HouseInfo[i][hLabel] = CreateDynamic3DTextLabel(str, COLOR_HOUSELABEL, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz], 15, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 15);
    if(!HouseInfo[i][hOwned]) HouseInfo[i][hPick] = CreatePickup(1273, 1,HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);
    else HouseInfo[i][hPick] = CreatePickup(19522, 1, HouseInfo[i][hEntrx], HouseInfo[i][hEntry], HouseInfo[i][hEntrz]);

    }
    }
    return 1;
    }