Beiträge von Fabi.StaR

    stock loadCar(playerid)
    {
    GetPlayerName(playerid, pAutoInfo[playerid][sName], MAX_PLAYER_NAME);
    pAutoInfo[playerid][pKey] = mysql_GetInt("cars", "Key", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][pAUTOPoS_X] = mysql_GetFloat("cars", "AutoX", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][pAUTOPoS_Y] = mysql_GetFloat("cars", "AutoY", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][pAUTOPoS_Z] = mysql_GetFloat("cars", "AutoZ", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][pAUTOPoS_A] = mysql_GetFloat("cars", "AutoA", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][ModelID] = mysql_GetInt("cars", "ModelID", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][Farbe1] = mysql_GetInt("cars", "cFarbe1", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][Farbe2] = mysql_GetInt("cars", "cFabe2", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][Preis] = mysql_GetInt("cars", "VKPreis", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][Carid] = CreateVehicle(pAutoInfo[playerid][ModelID],pAutoInfo[playerid][pAUTOPoS_X],pAutoInfo[playerid][pAUTOPoS_Y],pAutoInfo[playerid][pAUTOPoS_Z],pAutoInfo[playerid][pAUTOPoS_A],pAutoInfo[playerid][Farbe1],pAutoInfo[playerid][Farbe2],-1);
    printf("--> Das Fahrzeug von %s wurde erfolgreich von der MySQL Datenbak geladen.", pAutoInfo[playerid][sName]);
    return 1;
    }
    stock SaveAuto(playerid)
    {
    GetPlayerName(playerid, pAutoInfo[playerid][sName], MAX_PLAYER_NAME);
    mysql_SetInt("cars", "Key",pAutoInfo[playerid][pKey], "Name", pAutoInfo[playerid][sName]);
    mysql_SetInt("cars","VKPreis",pAutoInfo[playerid][Preis], "Name", pAutoInfo[playerid][sName]);
    mysql_SetInt("cars","ModelID",pAutoInfo[playerid][ModelID], "Name",pAutoInfo[playerid][sName]);
    GetPlayerName(playerid, pAutoInfo[playerid][sName], MAX_PLAYER_NAME);
    mysql_SetFloat("cars", "AutoX",pAutoInfo[playerid][pAUTOPoS_X], "Name", pAutoInfo[playerid][sName]);
    mysql_SetFloat("cars", "AutoY",pAutoInfo[playerid][pAUTOPoS_Y], "Name", pAutoInfo[playerid][sName]);
    mysql_SetFloat("cars", "AutoZ",pAutoInfo[playerid][pAUTOPoS_Z], "Name", pAutoInfo[playerid][sName]);
    mysql_SetFloat("cars", "AutoA",pAutoInfo[playerid][pAUTOPoS_A], "Name", pAutoInfo[playerid][sName]);
    printf("--> Das Fahrzeug von %s wurde erfolgreich in der MySQL Datenbak gespeichert.", pAutoInfo[playerid][sName]);
    return 1;
    }

    Ich habe es so geht aber immer noch net ;(



    public OnVehicleRespray(playerid,vehicleid, color1, color2)
    {
    if(pAutoInfo[playerid][Carid]==GetPlayerVehicleID(playerid))
    {
    pAutoInfo[playerid][Farbe1]=color1;
    pAutoInfo[playerid][Farbe2]=color2;
    SaveAuto(playerid);
    }
    return 1;
    }

    CreateObject(1337,485.79998779,1103.59997559,1106.30004883,82.79302979,213.78192139,138.42773438); //sniper_
    CreateObject(1337,484.29998779,1103.59997559,1106.30004883,84.29528809,298.74060059,61.13934326); //shotgun


    Falls es dir nicht aufällt hab ich es mal in ROT makiert.


    die Object id ist bei beiden 1337 und schau mal bei MTA welches Object die id hat

    Guten Tag,


    Ich bin zeit gestern an einem Autohaus dran und habe probleme beim speichern, in der tabelle wird
    nix gespeichert hir der cod vom stock speichern und ocmd:buycar und ocmd:park:


    buycar:

    Spoiler anzeigen
    ocmd:buycar(playerid, params[])
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    for(new i=0; i<sizeof(autokauf); i++)
    {
    new cpreis =autokauf[i][CarPreis];
    new str[128];
    format(str,sizeof(str),"Du besitzt zuwenig geld du benötigst %i", cpreis);
    new autohaus=autokauf[i][Autohaus];
    if(pAutoInfo[playerid][pKey] == 0)
    {
    if(autokauf[i][VEHID]==GetPlayerVehicleID(playerid))
    {
    if(cpreis <= GetPlayerMoney(playerid))
    {
    GivePlayerMoney(playerid,-cpreis);
    pAutoInfo[playerid][pAUTOPoS_X]=Autospawns[autohaus][pos_x];
    pAutoInfo[playerid][pAUTOPoS_Y]=Autospawns[autohaus][pos_y];
    pAutoInfo[playerid][pAUTOPoS_Z]=Autospawns[autohaus][pos_z];
    pAutoInfo[playerid][pAUTOPoS_A]=Autospawns[autohaus][z_angle];
    pAutoInfo[playerid][Preis]=cpreis;
    pAutoInfo[playerid][ModelID]=autokauf[i][ModelID];
    pAutoInfo[playerid][pKey]=1;
    pAutoInfo[playerid][Carid] = AddStaticVehicle(pAutoInfo[playerid][ModelID],pAutoInfo[playerid][pAUTOPoS_X],pAutoInfo[playerid][pAUTOPoS_Y],pAutoInfo[playerid][pAUTOPoS_Z],pAutoInfo[playerid][pAUTOPoS_A],-1,-1);
    SendClientMessage(playerid, Gruen, "Mit /carlock kannst du dein Fahrzeug für andere Leute freigeben oder abschließen.");
    SendClientMessage(playerid, Gelb, "Dein Auto steht am Ausgabepunkt bereit! Viel Spaß beim Fahren! Und Beachte die StVo!");
    TogglePlayerControllable(playerid,1);
    RemovePlayerFromVehicle(playerid);
    CreateCar(playerid);
    SaveAuto(playerid);
    break;
    }
    else{SendClientMessage(playerid,Rot,str);}
    }
    }
    else{SendClientMessage(playerid,Rot,"** Du besitzt doch schon ein Fahrzeug.");}
    }
    }
    else{SendClientMessage(playerid,Rot,"Du bist in keinem Autohaus Auto!");}
    return 1;
    }


    park:

    Spoiler anzeigen
    ocmd:park(playerid, params[])
    {
    if(pAutoInfo[playerid][Carid]==GetPlayerVehicleID(playerid))
    {
    new Float:X,Float:Z,Float:Y,Float:A;
    GetVehiclePos(pAutoInfo[playerid][Carid],X,Y,Z);
    GetVehicleZAngle(pAutoInfo[playerid][Carid],A);
    pAutoInfo[playerid][pAUTOPoS_X] = X;
    pAutoInfo[playerid][pAUTOPoS_Y] = Y;
    pAutoInfo[playerid][pAUTOPoS_Z] = Z;
    pAutoInfo[playerid][pAUTOPoS_A] = A;
    SendClientMessage(playerid, Gruen, "Fahrzeug geparkt!");
    SaveAuto(playerid);
    }else{SendClientMessage(playerid,Rot,"Dieses Fahrzeug gehört dir nicht!");}
    return 1;
    }


    stock speichern und load:


    Spoiler anzeigen
    stock CreateCar(playerid)
    {
    new query[256],Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    mysql_real_escape_string(Name,Name);
    format(query, sizeof(query), "INSERT INTO `cars` (`Name`) VALUES ('%s')", Name);
    mysql_query(query);
    return true;
    }
    stock loadCar(playerid)
    {
    if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
    {
    if(GetPVarInt(playerid,"Eingeloggt") == 1)
    {
    GetPlayerName(playerid, pAutoInfo[playerid][sName], MAX_PLAYER_NAME);
    pAutoInfo[playerid][pKey] = mysql_GetInt("cars", "Key", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][pAUTOPoS_X] = mysql_GetFloat("cars", "AutoX", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][pAUTOPoS_Y] = mysql_GetFloat("cars", "AutoY", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][pAUTOPoS_Z] = mysql_GetFloat("cars", "AutoZ", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][pAUTOPoS_A] = mysql_GetFloat("cars", "AutoA", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][ModelID] = mysql_GetInt("cars", "ModelID", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][Farbe1] = mysql_GetInt("cars", "cFarbe1", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][Farbe2] = mysql_GetInt("cars", "cFabe2", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][Preis] = mysql_GetInt("cars", "VKPreis", "Name", pAutoInfo[playerid][sName]);
    pAutoInfo[playerid][Carid] = CreateVehicle(pAutoInfo[playerid][ModelID],pAutoInfo[playerid][pAUTOPoS_X],pAutoInfo[playerid][pAUTOPoS_Y],pAutoInfo[playerid][pAUTOPoS_Z],pAutoInfo[playerid][pAUTOPoS_A],pAutoInfo[playerid][Farbe1],pAutoInfo[playerid][Farbe2],-1);
    printf("--> The Vehicles from %s Loaded From MySQL", pAutoInfo[playerid][sName]);
    }
    }
    return 1;
    }
    stock SaveAuto(playerid)
    {
    if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
    {
    if(GetPVarInt(playerid,"Eingeloggt") == 1)
    {
    GetPlayerName(playerid, pAutoInfo[playerid][sName], MAX_PLAYER_NAME);
    mysql_SetInt("cars", "Key",pAutoInfo[playerid][pKey], "Name", pAutoInfo[playerid][sName]);
    mysql_SetInt("cars","VKPreis",pAutoInfo[playerid][Preis], "Name", pAutoInfo[playerid][sName]);
    mysql_SetInt("cars","ModelID",GetPlayerVehicleID(pAutoInfo[playerid][ModelID]), "Name",pAutoInfo[playerid][sName]);
    GetPlayerName(playerid, pAutoInfo[playerid][sName], MAX_PLAYER_NAME);
    mysql_SetFloat("cars", "AutoX",pAutoInfo[playerid][pAUTOPoS_X], "Name", pAutoInfo[playerid][sName]);
    mysql_SetFloat("cars", "AutoY",pAutoInfo[playerid][pAUTOPoS_Y], "Name", pAutoInfo[playerid][sName]);
    mysql_SetFloat("cars", "AutoZ",pAutoInfo[playerid][pAUTOPoS_Z], "Name", pAutoInfo[playerid][sName]);
    mysql_SetFloat("cars", "AutoA",pAutoInfo[playerid][pAUTOPoS_A], "Name", pAutoInfo[playerid][sName]);
    printf("--> The Vehicles from %s Save From MySQL", pAutoInfo[playerid][sName]);
    }
    }
    return 1;
    }


    Dank im vorraus.


    mfg. Fabi.StaR

    Guten Tag,


    Ich bin grade an einem Autohaus system dran und habe 2 Autohäuser Spawns gemacht und es buggt jetzt hir der code:


    enums:


    Spoiler anzeigen
    enum ahSpawn
    {
    Float:pos_x,
    Float:pos_y,
    Float:pos_z,
    Float:z_angle,
    };
    new Autospawns[2][ahSpawn] = {
    {739.7457,-1343.8668,13.2828,270.2592},
    {-1640.8845,1198.1356,6.9160,268.8890}
    };

    Spoiler anzeigen
    enum autoverkaufInfo
    {
    Autohaus,
    FahrzeugName[128],
    ModelID,
    CarPreis,
    Float:AUTOPoS_X,
    Float:AUTOPoS_Y,
    Float:AUTOPoS_Z,
    Float:AUTOPoS_A,
    VEHID
    }
    new autokauf[6][autoverkaufInfo] = {
    {0,"Sultan",560,60000,766.0,-1333.0,13.3,211.1,-1},
    {1,"SUPER GT",506,60000,-1651.6337,1208.2534,20.7991,305.1250,-1},
    {1,"Cheetah",415,60000,-1677.3573,1207.8119,13.4082,208.2588,-1},
    {1,"Bullet",541,60000,-1651.3844,1210.3466,6.9028,281.3334,-1},
    {1,"Blista Compact",496,60000,-1668.6449,1207.0374,7.0149,309.5804,-1},
    {1,"Buffalo",402,60000,-1663.6716,1215.3939,7.0511,274.0793,-1}
    };

    Spoiler anzeigen
    enum sAutoInfo
    {
    ModelID,
    Carid,
    Float:AUTOPoS_X,
    Float:AUTOPoS_Y,
    Float:AUTOPoS_Z,
    Float:AUTOPoS_A,
    Farbe1,
    Farbe2,
    }
    new pAutoInfo[MAX_PLAYERS][sAutoInfo];


    Hir OnPlayerStateChange:


    Spoiler anzeigen
    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(newstate == PLAYER_STATE_DRIVER)
    {
    for(new i=0; i<sizeof(autokauf); i++)
    {
    if(GetPlayerVehicleID(playerid)==autokauf[i][VEHID])
    {
    new string[128];
    TogglePlayerControllable(playerid,0);
    SendClientMessage(playerid, Gelb, "~*~ Autohaus ~*~");
    format(string,128,"Name: %s",autokauf[i][FahrzeugName]);
    SendClientMessage(playerid, Gelb, string);
    format(string,128,"Preis: $%i",autokauf[i][CarPreis]);
    SendClientMessage(playerid, Gelb, string);
    format(string,128,"Reparaturkosten: $0");
    SendClientMessage(playerid, Gelb, string);
    SendClientMessage(playerid, Gruen, "Dieses Fahrzeug ist zu verkaufen. Um es zu kaufen, benutze: /buycar");
    SendClientMessage(playerid, Gruen, "Um das Fahrzeug zu verlassen, benutze: /exitcar");
    }
    }
    }
    return 1;
    }


    Hir der befehl buycar:


    Spoiler anzeigen
    ocmd:buycar(playerid, params[])
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    for(new i=0; i<sizeof(autokauf); i++)
    {
    new preis =autokauf[i][CarPreis];
    GivePlayerMoney(playerid,preis);
    new autohaus=autokauf[i][Autohaus];
    pAutoInfo[playerid][AUTOPoS_X] = Autospawns[autohaus][pos_x];
    pAutoInfo[playerid][AUTOPoS_Y] = Autospawns[autohaus][pos_y];
    pAutoInfo[playerid][AUTOPoS_Z] = Autospawns[autohaus][pos_z];
    pAutoInfo[playerid][AUTOPoS_A] = Autospawns[autohaus][z_angle];
    pAutoInfo[playerid][ModelID] = autokauf[i][ModelID];
    pAutoInfo[playerid][Carid] = AddStaticVehicle(pAutoInfo[playerid][ModelID],pAutoInfo[playerid][AUTOPoS_X],pAutoInfo[playerid][AUTOPoS_Y],pAutoInfo[playerid][AUTOPoS_Z],pAutoInfo[playerid][AUTOPoS_A],-1,-1);
    SendClientMessage(playerid, Gruen, "Mit /carlock kannst du dein Fahrzeug für andere Leute freigeben oder abschließen.");
    SendClientMessage(playerid, Gelb, "Dein Auto steht am Ausgabepunkt bereit! Viel Spaß beim Fahren! Und Beachte die StVo!");
    TogglePlayerControllable(playerid,1);
    RemovePlayerFromVehicle(playerid);
    }
    }
    else{SendClientMessage(playerid,Rot,"Du bist in keinem Autohaus Auto!");}
    return 1;
    }


    wenn ich /buycar eingebe un ich bin im 2 autohaus dann kauf ich alle oO cars die es in diesem autohaus gibt oO.


    Ich dank schon mal im vorraus.


    mfg. Fabi.StaR

    Hir das müsste gehen (Nicht getestet):


    Spoiler anzeigen
    if(strcmp(cmd, "/aduty", true) == 0)
    {
    new string[256];
    if(AdminDuty[playerid] == 0)
    {
    AdminDuty[playerid] = 1;
    format(string, sizeof(string), "*** Admin %s hat sich zum Dienst angemeldet ***", PlayerName(playerid));
    SetPlayerColor(playerid,ROT);
    SendClientMessageToAll(ROT, string);
    return 1;
    }
    if(AdminDuty[playerid] == 1)
    {
    AdminDuty[playerid] = 0;
    format(string, sizeof(string), "*** Admin %s hat denn Admin Dienst verlassen ***", PlayerName(playerid));
    SetPlayerColor(playerid,WEIß);
    SendClientMessageToAll(ORANGE, string);
    return 1;
    }
    return 1;
    }

    //Für das mal gantz unten ein:
    stock PlayerName(playerid)
    {
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    return name;
    }

    mit 24 hab ich versucht kommt immer noch der error


    wenn ich aus :


    Spoiler anzeigen
    stock mysql_GetString(Table[], Field[], Where[], Is[])
    {
    new query[128], Get[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Is, Is);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row(Get);
    mysql_free_result();
    return Get;
    }


    das mache:


    Spoiler anzeigen
    stock mysql_GetString(Table[], Field[], Where[], Is[])
    {
    new query[128], Get[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Is, Is);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row(Get);
    mysql_free_result();
    return true;
    }


    mach bekomme ich keine Errors