Finde den Fehler nicht

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
  • Hi.


    Ich habe den Befehl "/carsell" Leider buggt dieser irgendwie rum. Hier mal der Code:


    else if(strcmp("/carsell", cmd, true, 10) == 0)
    {
    if (Carlist[playerid][Carid] == GetPlayerVehicleID(playerid))
    {
    if (IsPlayerInVehicle(playerid,Carlist[playerid][Carid]))
    {
    RemovePlayerFromVehicle(playerid);
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));


    GivePlayerCash(playerid, Kaufliste[Carlist[playerid][Typ]][Preis]/2);
    DestroyVehicle(Carlist[playerid][Carid]);


    Carlist[playerid][Typ]=-1; Carlist[playerid][CarX]=0.0; Carlist[playerid][CarY]=0.0; Carlist[playerid][CarZ]=0.0;
    Carlist[playerid][CarRotation]=0.0; Carlist[playerid][Status]=0; Carlist[playerid][Lock]=0; Carlist[playerid][Carid]=-1;
    Carlist[playerid][Farbe1]=-1; Carlist[playerid][Farbe2]=-1; Carlist[playerid][mod1]=-1; Carlist[playerid][mod2]=-1;
    Carlist[playerid][mod3]=-1; Carlist[playerid][mod4]=-1; Carlist[playerid][mod5]=-1; Carlist[playerid][mod6]=-1;
    Carlist[playerid][mod7]=-1; Carlist[playerid][mod8]=-1; Carlist[playerid][mod9]=-1; Carlist[playerid][mod10]=-1;
    Carlist[playerid][mod11]=-1; Carlist[playerid][mod12]=-1; Carlist[playerid][mod13]=-1; Carlist[playerid][mod14]=-1;
    Carlist[playerid][mod15]=-1; Carlist[playerid][mod16]=-1; Carlist[playerid][mod17]=-1; Carlist[playerid][Paintjob]=-1;


    format(string,128,"Du hast erfolgreich dein Auto für $%i verkauft!",Kaufliste[Carlist[playerid][Typ]][Preis]/2);
    SendClientMessage(playerid, COLOR_RED, string);


    mysql_SetInt("privatcars","AH_Typ", -1,"Name",playername);
    mysql_SetFloat("privatcars","AH_X", -1, "Name", playername);
    mysql_SetFloat("privatcars","AH_Y", -1, "Name", playername);
    mysql_SetFloat("privatcars","AH_Z", -1, "Name", playername);
    mysql_SetFloat("privatcars","AH_Rot", -1, "Name", playername);
    mysql_SetInt("privatcars","AH_Status", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Lock", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Paintjob", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Farbe1", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Farbe2", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod1", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod2", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod3", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod4", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod5", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod6", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod7", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod8", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod9", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod10", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod11", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod12", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod13", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod14", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod15", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod16", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod17", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Fill", -1, "Name",playername);
    return true;
    }
    else SendClientMessage(playerid, COLOR_GREY, "Fehler: Du musst in deinem Fahrzeug sitzen!");
    return 1;
    }
    else SendClientMessage(playerid, COLOR_GREY, "Fehler: Du besitzt kein Auto!");
    return 1;
    }


    Wenn ich in meinem Auto sitze, und /carsell eingebe, sagt er mir im Chat "SERVER Unkown Command" weis einer wieso?


    Gruß Tim

  • Wieso else if(strcmp("/carsell", cmd, true, 10) == 0)

  • Müsste trotzdem gehen.
    Unter OnPlayerCommandText werden die Befehle der Reihe nach abgefragt, und verglichen was man eingegeben hat,
    daher ist else if schon in Ordnung

  • Habe es nunmal ins ocmd gebracht. Leider sagt er dort auch, das er den Befehl nicht kennt. Das ist aber erst wenn man im Auto sitzt. Steht man daneben sagt er, ich habe kein Auto.


    Noch wer ne Idee?


    ocmd:carsell(playerid, params[])
    {
    if (Carlist[playerid][Carid] == GetPlayerVehicleID(playerid))
    {
    if (IsPlayerInVehicle(playerid,Carlist[playerid][Carid]))
    {
    RemovePlayerFromVehicle(playerid);
    new playername[MAX_PLAYER_NAME];
    new str[75];
    GetPlayerName(playerid, playername, sizeof(playername));


    GivePlayerCash(playerid, Kaufliste[Carlist[playerid][Typ]][Preis]/2);
    DestroyVehicle(Carlist[playerid][Carid]);


    Carlist[playerid][Typ]=-1; Carlist[playerid][CarX]=0.0; Carlist[playerid][CarY]=0.0; Carlist[playerid][CarZ]=0.0;
    Carlist[playerid][CarRotation]=0.0; Carlist[playerid][Status]=0; Carlist[playerid][Lock]=0; Carlist[playerid][Carid]=-1;
    Carlist[playerid][Farbe1]=-1; Carlist[playerid][Farbe2]=-1; Carlist[playerid][mod1]=-1; Carlist[playerid][mod2]=-1;
    Carlist[playerid][mod3]=-1; Carlist[playerid][mod4]=-1; Carlist[playerid][mod5]=-1; Carlist[playerid][mod6]=-1;
    Carlist[playerid][mod7]=-1; Carlist[playerid][mod8]=-1; Carlist[playerid][mod9]=-1; Carlist[playerid][mod10]=-1;
    Carlist[playerid][mod11]=-1; Carlist[playerid][mod12]=-1; Carlist[playerid][mod13]=-1; Carlist[playerid][mod14]=-1;
    Carlist[playerid][mod15]=-1; Carlist[playerid][mod16]=-1; Carlist[playerid][mod17]=-1; Carlist[playerid][Paintjob]=-1;


    format(str,128,"Du hast erfolgreich dein Auto für $%i verkauft!",Kaufliste[Carlist[playerid][Typ]][Preis]/2);
    SendClientMessage(playerid, COLOR_RED, str);


    mysql_SetInt("privatcars","AH_Typ", -1,"Name",playername);
    mysql_SetFloat("privatcars","AH_X", -1, "Name", playername);
    mysql_SetFloat("privatcars","AH_Y", -1, "Name", playername);
    mysql_SetFloat("privatcars","AH_Z", -1, "Name", playername);
    mysql_SetFloat("privatcars","AH_Rot", -1, "Name", playername);
    mysql_SetInt("privatcars","AH_Status", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Lock", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Paintjob", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Farbe1", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Farbe2", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod1", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod2", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod3", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod4", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod5", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod6", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod7", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod8", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod9", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod10", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod11", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod12", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod13", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod14", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod15", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod16", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_mod17", -1,"Name",playername);
    mysql_SetInt("privatcars","AH_Fill", -1, "Name",playername);
    return 1;
    }
    else SendClientMessage(playerid, COLOR_GREY, "Fehler: Du musst in deinem Fahrzeug sitzen!");
    return 1;
    }
    else SendClientMessage(playerid, COLOR_GREY, "Fehler: Du besitzt kein Auto!");
    return 1;
    }