Server Unknown Command

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
  • Hey
    Hab folgendes Problem:
    Mit /buycar kauf ich ein Car jedoch kommt immer Server Unknown Command.
    Code:
    if(strcmp("/buycar", cmd, true) == 0)
    {
    if(Spectating[playerid] != -1)
    {
    if(Carlist[playerid][CarKey[playerid]][Typ] == -1)
    {
    new preis = Kaufliste[Spectating[playerid]][Preis];
    if(preis <= PlayerInfo[playerid][pCash])
    {
    new autohaus = Kaufliste[Spectating[playerid]][Autohaus];
    GivePlayerMoneys(playerid, - preis);
    Carlist[playerid][CarKey[playerid]][Typ] = Spectating[playerid];
    Carlist[playerid][CarKey[playerid]][pos_x] = Autospawns[autohaus][pos_x];
    Carlist[playerid][CarKey[playerid]][pos_y] = Autospawns[autohaus][pos_y];
    Carlist[playerid][CarKey[playerid]][pos_z] = Autospawns[autohaus][pos_z];
    Carlist[playerid][CarKey[playerid]][z_angle] = Autospawns[autohaus][z_angle];
    Carlist[playerid][CarKey[playerid]][SpawnSaveX] = Autospawns[autohaus][pos_x];
    Carlist[playerid][CarKey[playerid]][SpawnSaveY] = Autospawns[autohaus][pos_y];
    Carlist[playerid][CarKey[playerid]][SpawnSaveZ] = Autospawns[autohaus][pos_z];
    Carlist[playerid][CarKey[playerid]][SpawnSaveRot] = Autospawns[autohaus][z_angle];
    Carlist[playerid][CarKey[playerid]][Status] = 0;
    Carlist[playerid][CarKey[playerid]][Lock] = 0;
    Carlist[playerid][CarKey[playerid]][TankVolumen] = 100;
    Carlist[playerid][CarKey[playerid]][Carid] = CreateTunedCar(playerid, CarKey[playerid]);
    Carlist[playerid][CarKey[playerid]][Meter] = 0;
    Gas[Carlist[playerid][CarKey[playerid]][Carid]] = Carlist[playerid][CarKey[playerid]][TankVolumen];
    SetPlayerCheckpoint(playerid,Carlist[playerid][CarKey[playerid]][pos_x],Carlist[playerid][CarKey[playerid]][pos_y],Carlist[playerid][CarKey[playerid]][pos_z],10.0);
    ForAllPlayers(i){
    if(IsPlayerConnected(i)){
    SetVehicleParamsForPlayer(Kaufliste[Spectating[playerid]][Carid], i, 0, 0);
    }}
    TogglePlayerControllable(playerid,1);
    RemovePlayerFromVehicle(playerid);
    format(string, sizeof(string), "Du hast dir erfolgreich für %s$ ein/einen %s gekauft!",GetPoint(preis),Kaufliste[Carlist[playerid][CarKey[playerid]][Typ]][Name]);
    SendClientMessage(playerid, COLOR_GREEN, "Mit /carlock kannst du dein Fahrzeug für andere Leute freigeben oder abschließen.");
    SendClientMessage(playerid, COLOR_GREEN, "Mehr Befehle kannst du unter /carhelp sehen.");
    SendClientMessage(playerid, COLOR_YELLOW, "Dein Auto steht am Ausgabepunkt(Roter Marker) bereit! Viel Spaß beim Fahren!");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(Kaufliste[Spectating[playerid]][Autohaus] == 2)
    {
    BizInfo[13][bTill] += (preis/100)*19;
    }
    Spectating[playerid] = -1;
    }
    else
    {
    format(string, sizeof(string), " Du hast nicht genug Geld für das Auto (benötigt: $%i)!", preis);
    SendClientMessage(playerid, COLOR_ERRORTEXT, string);
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Du besitzt bereits ein Auto auf dem ausgewählten Schlüssel!");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Du besichtigst kein Auto !");
    }
    return 1;
    }


    if(typ != -1){
    if(Kaufliste[typ][Autohaus] == 2 && PlayerInfo[playerid][pDonatorRank] != 2){
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Du hast keinen Donator Rank !");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    //TogglePlayerControllable(playerid,0);
    Spectating[playerid] = typ;
    ForAllPlayers(i){
    if(IsPlayerConnected(i)){
    SetVehicleParamsForPlayer(newcar, i, 0, 1);
    }}
    SendClientMessage(playerid, COLOR_GRÜN, "~*~ Autohaus ~*~");
    format(string,sizeof(string),"Name: %s",Kaufliste[typ][Name]);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string,sizeof(string),"Preis: %s$",GetPoint(Kaufliste[typ][Preis]));
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string,sizeof(string),"Reparaturkosten: %s$",GetPoint(Kaufliste[typ][Reparatur]));
    SendClientMessage(playerid, COLOR_YELLOW, string);
    SendClientMessage(playerid, COLOR_GREEN, "Dieses Fahrzeug ist zu verkaufen. Um es zu kaufen, benutze: /buycar");
    }


    enum ahSpawn
    {
    Float:pos_x,
    Float:pos_y,
    Float:pos_z,
    Float:z_angle,
    };
    new Autospawns[5][ahSpawn] =
    {
    {748.9752,-1345.8182,13.5155,270.000},//Intercars
    {-1639.3599,1198.1665,8.1,270.1},//Autohaus SF
    {2217.1833,1420.9259,14.1,90.1},//Spezialautohaus LV
    {1774.8820,-1703.2280,14.0,0.1},//Autohaus LS1
    {-553.2078,-1028.4569,24.1064,273.7115}//Gold....
    };


    enum ahModell
    {
    Name[128],
    Autohaus,
    Modelid,
    Carid,
    Preis,
    Reparatur,
    Float:pos_x,
    Float:pos_y,
    Float:pos_z,
    Float:z_angle,
    };


    new Kaufliste[45][ahModell] =
    {
    /////////////////////////////Intercars//////////////////////////////////
    {"Tampa",0,549,-1,6600,100,766.3573,-1378.6475,13.3541,269.4215}, //intercars
    {"Bobcat",0,422,-1,8600,100,766.2212,-1373.8983,13.5806,269.0165},
    {"Burrito",0,482,-1,12000,640,766.4193,-1368.8649,13.6737,266.4977},
    {"Nebula",0,516,-1,12500,150,766.1318,-1364.1688,13.3903,269.4459},
    {"Phoenix",0,603,-1,13500,250,766.2344,-1359.5094,13.4226,268.1375},
    {"Savanna",0,567,-1,13000,150,783.5147,-1367.2809,13.4088,92.8256},
    {"Slamvan",0,535,-1,30000,300,783.8260,-1356.5822,13.3273,90.1728},
    {"Voodoo",0,412,-1,25500,250,782.9839,-1335.4767,13.4323,88.8266},
    {"Tornado",0,576,-1,15000,175,783.2136,-1377.6055,13.2309,88.6873},
    {"Broadway",0,575,-1,9000,200,783.5681,-1372.7090,13.2070,94.9154},
    {"Balde",0,536,-1,150,15000,783.5160,-1361.8856,13.3241,89.2535},
    {"Remington",0,534,-1,12000,650,783.4966,-1351.3638,13.2953,88.0422},
    {"Buccaneer",0,518,-1,55000,1500,783.2993,-1346.0609,13.2515,79.4080},
    {"Esperanto",0,419,-1,8000,700,783.4002,-1340.4026,13.4123,91.5259},
    {"Hustler",0,545,-1,12500,300,771.0963,-1333.1886,13.2466,179.9259},
    {"Blista",0,496,-1,4500,350,766.1276,-1333.2665,13.2896,179.4678},
    {"Comet",0,480,-1,18000,80,761.2780,-1333.2695,13.3010,176.7838},
    {"Elegy",0,562,-1,20000,80,756.5835,-1333.0814,13.1270,182.4252},
    {"Huntley",0,579,-1,100000,1000,751.5070,-1334.0564,13.5520,182.1816},
    {"Mesa",0,500,-1,8000,250,746.6382,-1333.4875,13.6658,179.9870},
    {"Moonbeam",0,418,-1,15000,245,741.8511,-1333.5743,13.6650,180.3323},//intercars ende 21
    /////////////////////////////////Grottis//////////////////////////////////////
    {"Buffalo",1,402,-1,155000,350,558.8314,-1289.5635,17.0566,359.8489}, //Grottis
    {"Bullet",1,541,-1,180000,450,537.7307,-1289.6569,16.8788,359.9076},
    {"Cheetah",1,415,-1,185000,360,548.5411,-1289.2894,17.0168,6.7969},
    {"Banshee",1,429,-1,23000,150,563.1986,-1289.0668,16.9284,2.2992},
    {"Infernus",1,411,-1,50000,120,553.5667,-1289.6110,16.9802,4.0815},
    {"Turismo",1,451,-1,300000,680,542.7256,-1289.3339,16.9663,3.7311},
    {"Jester",1,559,-1,260000,150,532.2188,-1290.0289,16.9184,8.3362},
    {"Sultan",1,560,-1,27500,100,527.2485,-1290.7981,16.8880,1.5522},//Grottis Ende 8
    //////////////////////////////////2RadShop////////////////////////////////////
    {"Wayfarer",1,586,-1,11000,300,2117.6641,-1135.7371,24.7074,244.4122},
    {"BF-400",1,581,-1,12500,350,2117.6621,-1133.0946,24.7906,263.1818},
    {"NRG-500",1,522,-1,60000,450,2117.3479,-1130.3920,24.7793,255.9238},
    {"BMX",1,481,-1,1500,260,2118.0095,-1127.1219,24.7798,253.3480},
    {"Sanchez",0,468,-1,20000,75,2137.8049,-1139.0826,25.1447,104.7127},
    {"Freeway",0,463,-1,12000,100,2137.4783,-1136.2334,25.2795,105.0719},
    {"FRC-900",2,521,-1,15000,150,2117.8870,-1123.9498,24.8825,269.8976},
    {"PCJ-600",2,461,-1,10000,2002136.4927,-1127.3752,25.1272,102.8394},
    {"Faggio",2,462,-1,500000,200,2137.6379,-1131.5999,25.2480,108.6290},//9
    ////////////////////////////////Flugplatz///////////////////////////////////
    {"Maverick",2,487,-1,650000,200,1888.9150,-2624.0420,13.6997,0.2435},
    {"Dodo",2,593,-1,150000,200,1822.2716,-2625.2224,14.0106,359.9549},
    {"Shamal",2,519,-1,1200000,250,1754.4678,-2625.8228,14.4726,354.9949},//3
    ///////////////////////////////Gold/Traktoren/////////////////////////////
    {"Flatbed",4,455,-1,150000,250,-589.8594,-1078.3411,23.1886,241.0025},
    {"Willard",4,529,-1,25000,250,585.7016,-1072.6453,22.9929,235.4666},
    {"Traktore",4,531,-1,50000,150,-582.1254,-1066.7961,23.3816,235.8263},
    {"DFT-300",4,578,-1,120000,300,-563.4022,-1039.2424,24.7588,237.1086}//4
    };


    Danke im vorraus.
    Mfg,

  • Lade dir mal das crashdetect Plugin runter und füge es ein. Dann poste was im Server Log steht wenn du den Befehl ausführst.


    Foglendes:
    [16:16:56] [debug] Run time error 4: "Array index out of bounds"
    [16:16:56] [debug] Accessing element at index 3 past array upper bound 2
    [16:16:56] [debug] AMX backtrace:
    [16:16:56] [debug] #0 000c5664 in public ocmdOnPlayerCommandText () from RGR.amx
    [16:16:56] [debug] #1 00002134 in public OnPlayerCommandText () from RGR.amx

    Sowie:
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx
    [16:15:04] [debug] Run time error 4: "Array index out of bounds"
    [16:15:04] [debug] Accessing element at negative index -1
    [16:15:04] [debug] AMX backtrace:
    [16:15:04] [debug] #0 001e58e8 in public OnVehicleSpawn () from RGR.amx
    [16:15:04] [debug] #1 00094f90 in public OnGameModeInit () from RGR.amx


  • On Vehicle Spawn sieht so aus hat jedoch meiner Meinung mit /buycar nix zutun:
    public OnVehicleSpawn(vehicleid)
    {
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF);
    MotorSystemMotor[vehicleid] = false;
    MotorSystemLight[vehicleid] = false;
    if(sirene[vehicleid] != -1) {
    DestroyObject(sirene[vehicleid]);
    sirene[vehicleid] = -1;
    }
    if(sirene1[vehicleid] != -1) {
    DestroyObject(sirene1[vehicleid]);
    sirene1[vehicleid] = -1;
    }
    if(sirene2[vehicleid] != -1) {
    DestroyObject(sirene2[vehicleid]);
    sirene2[vehicleid] = -1;
    }
    if(sirene3[vehicleid] != -1) {
    DestroyObject(sirene3[vehicleid]);
    sirene3[vehicleid] = -1;
    }
    UCL[vehicleid] = 0;
    new string[50];
    format(string, sizeof(string), "{FFFF00}ERP-{21DD00}%d", vehicleid);
    SetVehicleNumberPlate(vehicleid,string);
    if(GetVehicleModel(vehicleid) == 427 || GetVehicleModel(vehicleid) == 601){
    SetVehicleHealth(vehicleid, 7500);
    }
    if(GetVehicleModel(vehicleid) == 490 && IsACopCar(vehicleid) || GetVehicleModel(vehicleid) == 528 && IsACopCar(vehicleid)){
    SetVehicleHealth(vehicleid, 2500);
    }
    if(IsAPlane(vehicleid) || IsABoat(vehicleid) || IsAFahrrad(vehicleid)){
    Gas[vehicleid] = 100;
    }


    for(new h = 0; h < sizeof(LSPDCars); h++){
    if(vehicleid == LSPDCars[h] && h <= 28){
    SetVehicleVirtualWorld(vehicleid,14);
    LinkVehicleToInterior(vehicleid,18);
    break;
    }}
    for(new h = 0; h < sizeof(FBICars); h++){
    if(vehicleid == FBICars[h] && h <= 28){
    SetVehicleVirtualWorld(vehicleid,7);
    LinkVehicleToInterior(vehicleid,18);
    break;
    }}
    if(vehicleid == LSPDCars[29] || vehicleid == LSPDCars[30])
    {
    SetVehicleHealth(vehicleid, 3000);
    }
    if(Locked[vehicleid] == 1){
    Locked[vehicleid] = 0;
    ForAllPlayers(i){
    SetVehicleParamsForPlayer(vehicleid,i, 0, 0);
    break;
    }}
    for(new i = 0; i < sizeof(MulmanInfo); i++){
    if(MulmanInfo[i][MmLeiher] == -1){
    if(MulmanInfo[i][MmCarID] == vehicleid){
    MullManOwned[MulmanInfo[i][MmLeiher]] = -1;
    MulmanInfo[i][MmLeiher] = -1;
    MulmanInfo[i][MmLadung] = 0;
    return 1;
    }}}
    return 1;
    }
    Finde dort nix kannste vielleicht per Teamviewer schnell kucken?

  • So, dann auch noch dem dritten innerhalb von 5 Minuten dem ich das sagen darf oder muss: Wenn du nicht machst, was man dir sagt das du machen sollst (Debugging), dann kannst du auch keine weitere Hilfe erwarten. Ich werde nicht über Teamviewer auf den Code schauen, da ich keinen Support via TeamViewer gebe.


    Du hast meine Frage nicht beantwortet und du hast den Code nicht debuggt noch sonst was gemacht.