System umschreiben (MySQL R39-2)

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Wie erstellst du die Zonen denn? In deiner Datenbank stehen ja keine Daten, entsprechend müssen die Daten ja von irgendwo her kommen. Hast du da einen ERSTELLEN Befehl, oder wie willst du die Daten der Zonen in die Datenbank bekommen?

  • ocmd:creategangzone(playerid,params[])
    {
    if(!IsPlayerAdmin(playerid))return 1;
    if(M_IsPlayerInAnyZone(playerid))return SCMF(playerid,Rot,"Du kannst hier keine Ganguone erstellen!");
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    CZ[playerid][min_x] = x, CZ[playerid][min_y] = y, CZ[playerid][create] = 1;
    SCMF(playerid,Blau,"Bitte überquere jetzt die Zone um die Zone richtig zu erstellen.");
    return SCMF(playerid,Rot,"Wenn du die Zone überquert hast, tippe '/zoneende'.");
    }


    ocmd:zoneende(playerid,params[])
    {
    if(CZ[playerid][create] != 1)return SCMF(playerid,Rot,"Um eine Gangzone zu erstellen, benutze '/creategangzone'!");
    new Float:x,Float:y,Float:z,i,str[64];
    GetPlayerPos(playerid,x,y,z);
    CZ[playerid][max_x] = x,CZ[playerid][max_y] = y;
    for(; i<MAX_GZ; i++)
    {
    if(GZ[i][erstellt] == 1)continue;
    GZ[i][min_x] = CZ[playerid][min_x],GZ[i][min_y] = CZ[playerid][min_y],GZ[i][max_x] = CZ[playerid][max_x],GZ[i][max_y] = CZ[playerid][max_y];
    GZ[i][erstellt] = 1,GZ[i][owner] = 0;
    format(str,64,"%i| Besitzer: '%s'",GZ[i][zid],FrakName(GZ[i][owner]));
    M_CreateZone(GZ[i][min_x],GZ[i][min_y],GZ[i][max_x],GZ[i][max_y],FrakColor(GZ[i][owner]),str,FrakColor(GZ[i][owner]));
    new zone = M_GetPlayerCurrentZone(playerid);
    GZ[i][zid] = zone,CZ[playerid][zid] = zone;
    break;
    }
    return SCMF(playerid,Blau,"Nun gehe zum Angriffspunkt hin und tippe '/cflagge'.");
    }


    ocmd:cflagge(playerid,params[])
    {
    if(CZ[playerid][create] != 1)return SCMF(playerid,Rot,"Um eine Gangzone zu erstellen, benutze '/creategangzone'!");
    if(!M_IsPlayerInAnyZone(playerid))return SCMF(playerid,Rot,"Du bist in keiner Gangzone!");
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    GZ[CZ[playerid][zid]][flagge_x] = x, GZ[CZ[playerid][zid]][flagge_y] = y, GZ[CZ[playerid][zid]][flagge_z] = z,CZ[playerid][create] = 0;
    GZ[CZ[playerid][zid]][pickup] = CreatePickup(1314,1,x,y,z,0);
    GZ[CZ[playerid][zid]][label] = Create3DTextLabel("Tippe '/angriff', um das Gebiet anzugreifen.\nTippe '/flagge' | Y/Z, um die Flagge zu erobern.",Rot,x,y,z,20,0);
    return SCMF(playerid,Blau,"Du hast die Zone erfolgreich erstellt.");
    }

  • Schuldigung, das ich mich jetzt erst wieder melde. Hatte wegen den Feiertagen und anderen problemen keine Zeit. Nun bin ich wieder aktiv bei der sache dabei.


    Nun ich wollte wissen, was dieser Error hier bedeutet, da er oben in der Fehlererklärbär nicht vorhanden ist.


    C:\Users\Eddy\Desktop\GTA\GTA - Selfmade\gamemodes\Gangwar.pwn(567 -- 568) : error 091: ambiguous constant; tag override is required (symbol "zid")
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    1 Error.


    ocmd:cflagge(playerid,params[])
    {
    new query[500];
    if(CZ[playerid][create] != 1)return SCMF(playerid,Rot,"Um eine Gangzone zu erstellen, benutze '/creategangzone'!");
    if(!M_IsPlayerInAnyZone(playerid))return SCMF(playerid,Rot,"Du bist in keiner Gangzone!");
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    GZ[CZ[playerid][zid]][flagge_x] = x, GZ[CZ[playerid][zid]][flagge_y] = y, GZ[CZ[playerid][zid]][flagge_z] = z,CZ[playerid][create] = 0;
    GZ[CZ[playerid][zid]][pickup] = CreatePickup(1314,1,x,y,z,0);
    GZ[CZ[playerid][zid]][label] = Create3DTextLabel("Tippe '/angriff', um das Gebiet anzugreifen.\nTippe '/flagge' | Y/Z, um die Flagge zu erobern.",Rot,x,y,z,20,0);
    format(query, sizeof(query), "INSERT INTO gangfight (id, owner, maxX, maxY, minX, minY, flaggeX, flaggeY, flaggeZ, erstellt) VALUES ('%d', '%s', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%d')",
    zid, GZ[CZ[playerid][zid]][owner], GZ[CZ[playerid][zid]][max_x], GZ[CZ[playerid][zid]][max_y], GZ[CZ[playerid][zid]][min_x], GZ[CZ[playerid][zid]][min_y], GZ[CZ[playerid][zid]][flagge_x], GZ[CZ[playerid][zid]][flagge_y], GZ[CZ[playerid][zid]][flagge_z], CZ[playerid][zid]);
    mysql_pquery(handle, query);
    return SCMF(playerid,Blau,"Du hast die Zone erfolgreich erstellt.");
    }


    Mit freundlichen Grüßen
    Grapefruit

  • enum eGZ
    {
    Float:max_x,
    Float:max_y,
    Float:min_x,
    Float:min_y,
    Float:flagge_x,
    Float:flagge_y,
    Float:flagge_z,
    owner,
    zid,
    erstellt,
    Text3D:label,
    pickup,
    ruhe,
    ruhetimer
    };


    enum eC
    {
    Float:min_x,
    Float:min_y,
    Float:max_x,
    Float:max_y,
    zid,
    create
    };

  • Dann schreibe es so:
    format(query, sizeof(query), "INSERT INTO gangfight (owner, maxX, maxY, minX, minY, flaggeX, flaggeY, flaggeZ, erstellt) VALUES ('%s', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%d')",
    GZ[CZ[playerid][zid]][owner], GZ[CZ[playerid][zid]][max_x], GZ[CZ[playerid][zid]][max_y], GZ[CZ[playerid][zid]][min_x], GZ[CZ[playerid][zid]][min_y], GZ[CZ[playerid][zid]][flagge_x], GZ[CZ[playerid][zid]][flagge_y], GZ[CZ[playerid][zid]][flagge_z], CZ[playerid][zid]);


    Und setze "id" auf AUTO_INCREMENT in der Datenbank.

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Die Zonen warden genauso geladen wie die Flaggen.


    forward LoadGZ();
    public LoadGZ()
    {
    new rows, fields, str[64], Counter = 0;
    cache_get_data(rows, fields);
    for(new i = 0; i < rows; i++)
    {
    GZ[i][zid] = i;
    GZ[i][owner] = cache_get_field_content_int(i, "owner", handle);
    GZ[i][max_x] = cache_get_field_content_float(i, "maxX", handle);
    GZ[i][max_y] = cache_get_field_content_float(i, "maxY", handle);
    GZ[i][min_x] = cache_get_field_content_float(i, "minX", handle);
    GZ[i][min_y] = cache_get_field_content_float(i, "minY", handle);
    GZ[i][flagge_x] = cache_get_field_content_float(i, "flaggeX", handle);
    GZ[i][flagge_y] = cache_get_field_content_float(i, "flaggeY", handle);
    GZ[i][flagge_z] = cache_get_field_content_float(i, "flaggeZ", handle);
    GZ[i][erstellt] = true;
    M_CreateZone(GZ[i][min_x],GZ[i][min_y],GZ[i][max_x],GZ[i][max_y],FrakColor(GZ[i][owner]),str,FrakColor(GZ[i][owner]));
    GZ[i][pickup] = CreatePickup(1314,1,GZ[i][flagge_x],GZ[i][flagge_y],GZ[i][flagge_z],0);
    GZ[i][label] = Create3DTextLabel("Tippe '/angriff', um das Gebiet anzugreifen.\nTippe '/flagge' | Y/Z, um die Flagge zu erobern.",Rot,GZ[i][flagge_x],GZ[i][flagge_y],GZ[i][flagge_z],20,0);
    Counter++;
    }
    return printf(" '%d' Gangzone(n) wurde(n) erfolgreich erstellt und geladen.",Counter);
    }


    stock LoadGZ_(zoneid)
    {
    new str[64];
    GZ[zoneid][zid] = zoneid;
    GZ[zoneid][owner] = cache_get_field_content_int(0, "owner", handle);
    GZ[zoneid][max_x] = cache_get_field_content_float(0, "maxX", handle);
    GZ[zoneid][max_y] = cache_get_field_content_float(0, "maxY", handle);
    GZ[zoneid][min_x] = cache_get_field_content_float(0, "minX", handle);
    GZ[zoneid][min_y] = cache_get_field_content_float(0, "minY", handle);
    GZ[zoneid][flagge_x] = cache_get_field_content_float(0, "flaggeX", handle);
    GZ[zoneid][flagge_y] = cache_get_field_content_float(0, "flaggeY", handle);
    GZ[zoneid][flagge_z] = cache_get_field_content_float(0, "flaggeZ", handle);
    GZ[zoneid][erstellt] = cache_get_field_content_int(0, "erstellt", handle);
    M_CreateZone(GZ[zoneid][min_x],GZ[zoneid][min_y],GZ[zoneid][max_x],GZ[zoneid][max_y],FrakColor(GZ[zoneid][owner]),str,FrakColor(GZ[zoneid][owner]));
    GZ[zoneid][pickup] = CreatePickup(1314,1,GZ[zoneid][flagge_x],GZ[zoneid][flagge_y],GZ[zoneid][flagge_z],0);
    GZ[zoneid][label] = Create3DTextLabel("Tippe '/angriff', um das Gebiet anzugreifen.\nTippe '/flagge' | Y/Z, um die Flagge zu erobern.",Rot,GZ[zoneid][flagge_x],GZ[zoneid][flagge_y],GZ[zoneid][flagge_z],20,0);
    return 1;
    }

  • [19:48:00] [DEBUG] mysql_errno - connection: 1
    [19:48:00] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `gangfight` ORDER BY id ASC", callback: "LoadGZ", format: "(null)"
    [19:48:00] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
    [19:48:00] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
    [19:48:00] [DEBUG] CMySQLConnection::Connect - connection was successful
    [19:48:00] [DEBUG] CMySQLConnection::Connect - connection was successful
    [19:48:00] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
    [19:48:00] [DEBUG] CMySQLConnection::Connect - connection was successful
    [19:48:00] [DEBUG] CMySQLQuery::Execute[LoadGZ] - starting query execution
    [19:48:00] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
    [19:48:00] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
    [19:48:00] [DEBUG] CMySQLQuery::Execute[LoadGZ] - query was successfully executed within 0.331 milliseconds
    [19:48:00] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
    [19:48:00] [DEBUG] Calling callback "LoadGZ"..
    [19:48:00] [DEBUG] cache_get_data - connection: 1
    [19:48:00] [DEBUG] cache_get_field_content_int - row: 0, field_name: "owner", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "owner", data: ""
    [19:48:00] [ERROR] cache_get_field_content_int - invalid datatype
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "maxX", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "maxX", data: "144.975"
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "maxY", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "maxY", data: "-84.1551"
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "minX", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "minX", data: "134.394"
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "minY", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "minY", data: "-73.3813"
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "flaggeX", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "flaggeX", data: "138.958"
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "flaggeY", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "flaggeY", data: "-79.496"
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "flaggeZ", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "flaggeZ", data: "1.57812"
    [19:48:00] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor call

  • SQL
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "maxX", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "maxX", data: "144.975"
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "maxY", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "maxY", data: "-84.1551"
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "minX", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "minX", data: "134.394"
    [19:48:00] [DEBUG] cache_get_field_content_float - row: 0, field_name: "minY", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "minY", data: "-73.3813"


    maxY und minY sind verkehrt herum. -84 ist kleiner als -73.


    Außerdem:

    SQL
    [19:48:00] [DEBUG] cache_get_field_content_int - row: 0, field_name: "owner", connection: 1
    [19:48:00] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "owner", data: ""
    [19:48:00] [ERROR] cache_get_field_content_int - invalid datatype


    Owner muss in der Tabelle zum Datentyp "INT" geändert werden.