Carkey Öffnet sich nicht | Fahrzeuge verdoppeln sich

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
  • Hallo.
    Ein Freund von mir hat ein Problem.
    Er hat einen /carkey Befehl und manchmal öffnet er sich bei den Spielern, und manchmal öffnet er sich nicht und es kommt halt Unknown Command.
    Er weiß aber net wieso.
    Hier der Befehl:
    CMD:carkey(playerid)
    {
    new key1[128], key2[128], key3[128], key4[128], key5[128];
    if(CarSlotInUse[playerid][0]){
    if(Vehicle[playerid][0][vState] == 0){
    format(key1, sizeof(key1), COLOR_HEX_WHITE"%s", CarName[Vehicle[playerid][0][vModelID]-400]);
    }else{
    format(key1, sizeof(key1), COLOR_HEX_WHITE"%s "COLOR_HEX_BLUE"(Verwahrstelle)", CarName[Vehicle[playerid][0][vModelID]-400]);
    }
    }else{
    format(key1, sizeof(key1), COLOR_HEX_WHITE"--");
    }
    if(CarSlotInUse[playerid][1]){
    if(Vehicle[playerid][1][vState] == 0){
    format(key2, sizeof(key2), COLOR_HEX_WHITE"%s", CarName[Vehicle[playerid][1][vModelID]-400]);
    }else{
    format(key2, sizeof(key2), COLOR_HEX_WHITE"%s "COLOR_HEX_BLUE"(Verwahrstelle)", CarName[Vehicle[playerid][1][vModelID]-400]);
    }
    }else{
    format(key2, sizeof(key2), COLOR_HEX_WHITE"--");
    }
    if(CarSlotInUse[playerid][2]){
    if(Vehicle[playerid][2][vState] == 0){
    format(key3, sizeof(key3), COLOR_HEX_WHITE"%s", CarName[Vehicle[playerid][2][vModelID]-400]);
    }else{
    format(key3, sizeof(key3), COLOR_HEX_WHITE"%s "COLOR_HEX_BLUE"(Verwahrstelle)", CarName[Vehicle[playerid][2][vModelID]-400]);
    }
    }else{
    format(key3, sizeof(key3), COLOR_HEX_WHITE"--");
    }
    if(CarSlotInUse[playerid][3]){
    if(Vehicle[playerid][3][vState] == 0){
    format(key4, sizeof(key4), COLOR_HEX_WHITE"%s", CarName[Vehicle[playerid][3][vModelID]-400]);
    }else{
    format(key4, sizeof(key4), COLOR_HEX_WHITE"%s "COLOR_HEX_BLUE"(Verwahrstelle)", CarName[Vehicle[playerid][3][vModelID]-400]);
    }
    }else{
    format(key4, sizeof(key4), COLOR_HEX_WHITE"--");
    }
    if(CarSlotInUse[playerid][4]){
    if(Vehicle[playerid][4][vState] == 0){
    format(key5, sizeof(key5), COLOR_HEX_WHITE"%s", CarName[Vehicle[playerid][4][vModelID]-400]);
    }else{
    format(key5, sizeof(key5), COLOR_HEX_WHITE"%s "COLOR_HEX_BLUE"(Verwahrstelle)", CarName[Vehicle[playerid][4][vModelID]-400]);
    }
    }else{
    format(key5, sizeof(key5), COLOR_HEX_WHITE"--");
    }
    strdel(DialogString, 0, sizeof(DialogString));
    format(DialogString, sizeof(DialogString), "%s\n%s\n%s\n%s\n%s", key1, key2, key3, key4, key5);
    ShowPlayerDialog(playerid, DIALOG_CARKEY, DIALOG_STYLE_LIST, "Fahrzeug Schlüssel", DialogString, "Auswählen", "Abbrechen");
    return 1;
    }


    Dann hat er noch ein Problem dass sich bei einem User die Fahrzeuge mal verdoppelt haben, er weiß aber auch nicht wieso.
    Sprich sie waren 2x da, und wurden aber erst gelöscht nachdem der Server restartet wurde.
    Wenn man sich ausgeloggt hat waren sie nurnoch 1x da, aber niemand konnte damit fahren.


    Hier SavePrivateVehicles-Stock
    stock SavePrivateVehicles(playerid)
    {
    new query[512];
    for(new x=0;x<MAX_PRIVATE_VEHICLES;x++)
    {
    if(CarSlotInUse[playerid][x])
    {
    DestroyVehicle(Vehicle[playerid][x][vCarID]);
    DestroyDynamicObject(Vehicle[playerid][x][vObjectIDNeon1]);
    DestroyDynamicObject(Vehicle[playerid][x][vObjectIDNeon2]);
    format(query, sizeof(query), "UPDATE `privatecars` SET ModelID=%d, X=%f, Y=%f, Z=%f, A=%f, Color1=%d, Color2=%d, Nitro=%d, Hyd=%d, Wheel=%d WHERE CarOwner = '%s' AND AutoID = '%d'",
    Vehicle[playerid][x][vModelID], Vehicle[playerid][x][vX], Vehicle[playerid][x][vY], Vehicle[playerid][x][vZ], Vehicle[playerid][x][vA], Vehicle[playerid][x][vColor1],
    Vehicle[playerid][x][vColor2], Vehicle[playerid][x][vNitro], Vehicle[playerid][x][vHyd], Vehicle[playerid][x][vWheel], GetName(playerid), x);
    mysql_query(query);
    format(query, sizeof(query), "UPDATE `privatecars` SET Ausp=%d, SideL=%d, SideR=%d, FB=%d, RB=%d, Spoiler=%d, Roof=%d, Hood=%d, Vents1=%d WHERE CarOwner = '%s' AND AutoID = '%d'",
    Vehicle[playerid][x][vAusp], Vehicle[playerid][x][vSideL], Vehicle[playerid][x][vSideR], Vehicle[playerid][x][vFB], Vehicle[playerid][x][vRB], Vehicle[playerid][x][vSpoiler],
    Vehicle[playerid][x][vRoof], Vehicle[playerid][x][vHood], Vehicle[playerid][x][vVents1], GetName(playerid), x);
    mysql_query(query);
    format(query, sizeof(query), "UPDATE `privatecars` SET Vents2=%d, Lamps=%d, PJ=%d, Preis=%d, Bass=%d, RearBars=%d, FrontBars=%d, State=%d WHERE CarOwner = '%s' AND AutoID = '%d'",
    Vehicle[playerid][x][vVents2], Vehicle[playerid][x][vLamps], Vehicle[playerid][x][vPJ], Vehicle[playerid][x][vPreis], Vehicle[playerid][x][vBass], Vehicle[playerid][x][vRearBars],
    Vehicle[playerid][x][vFrontBars], Vehicle[playerid][x][vState], GetName(playerid), x);
    mysql_query(query);
    format(query, sizeof(query), "UPDATE `privatecars` SET Abschlepper='%s', Kaution=%d, vFuel=%f, Neon1=%d, Neon2=%d WHERE CarOwner = '%s' AND AutoID = '%d'",
    Vehicle[playerid][x][vAbschlepper], Vehicle[playerid][x][vKaution], vehFuel[Vehicle[playerid][x][vCarID]], Vehicle[playerid][x][vNeon1], Vehicle[playerid][x][vNeon2],
    GetName(playerid), x);
    mysql_query(query);
    Vehicle[playerid][x][vCarID] = INVALID_VEHICLE_ID;
    Vehicle[playerid][x][vModelID] = 0;
    Vehicle[playerid][x][vX] = 0.0;
    Vehicle[playerid][x][vY] = 0.0;
    Vehicle[playerid][x][vZ] = 0.0;
    Vehicle[playerid][x][vA] = 0.0;
    Vehicle[playerid][x][vColor1] = 0;
    Vehicle[playerid][x][vColor2] = 0;
    Vehicle[playerid][x][vNitro] = 0;
    Vehicle[playerid][x][vHyd] = 0;
    Vehicle[playerid][x][vWheel] = 0;
    Vehicle[playerid][x][vAusp] = 0;
    Vehicle[playerid][x][vSideL] = 0;
    Vehicle[playerid][x][vSideR] = 0;
    Vehicle[playerid][x][vFB] = 0;
    Vehicle[playerid][x][vRB] = 0;
    Vehicle[playerid][x][vSpoiler] = 0;
    Vehicle[playerid][x][vRoof] = 0;
    Vehicle[playerid][x][vHood] = 0;
    Vehicle[playerid][x][vVents1] = 0;
    Vehicle[playerid][x][vVents2] = 0;
    Vehicle[playerid][x][vLamps] = 0;
    Vehicle[playerid][x][vPJ] = 3;
    Vehicle[playerid][x][vPreis] = 0;
    Vehicle[playerid][x][vBass] = 0;
    Vehicle[playerid][x][vRearBars] = 0;
    Vehicle[playerid][x][vFrontBars] = 0;
    Vehicle[playerid][x][vState] = 0;
    strdel(Vehicle[playerid][x][vAbschlepper], 0, MAX_PLAYER_NAME);
    Vehicle[playerid][x][vKaution] = 0;
    Vehicle[playerid][x][vFuel] = 0.0;
    Vehicle[playerid][x][vNeon1] = 0;
    Vehicle[playerid][x][vNeon2] = 0;
    Vehicle[playerid][x][vObjectIDNeon1] = INVALID_OBJECT_ID;
    Vehicle[playerid][x][vObjectIDNeon2] = INVALID_OBJECT_ID;
    CarSlotInUse[playerid][x] = 0;
    }
    }
    }


    Danke^^


    © by me :D