Autohaus - System Error (Server)

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
  • Guten Tag ihr lieben... :D
    ich hab mal wieder nen Error im Server (vom Autohaus-System dies mal):

    Code
    [13:44:44] [chat] [***]: /car sell
    [13:45:43] [debug] Run time error 4: "Array index out of bounds"
    [13:45:43] [debug]  Accessing element at index 70 past array upper bound 69
    [13:45:43] [debug] AMX backtrace:
    [13:45:43] [debug] #0 00003428 in public OnPlayerCommandText (1, 522520) from Autohaus-System.amx


    dort steht: (zum Anfang):
    if(!strcmp(cmdtext,"/car",true,4))
    sollte ich es in:
    if(strcmp(cmdtext, "/car", true) == 0)
    umbenennen? oder liegt der Fehler woanders?



    MfG
    James.

  • Poste bitte den ganzen Befehl.

    Der ganze Code:

    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(!strcmp(cmdtext,"/car",true,4))
    {
    new pChoise[5];
    strpack(pChoise,strpart(cmdtext,1));
    if(!strlen(pChoise))
    {
    SendClientMessage(playerid,COLOR_GRAD1,"Verwendung: /car [Anwendung]");
    SendClientMessage(playerid,COLOR_GRAD1,"Anwendungen: lock, park, sell");
    return 1;
    }
    if(!strcmp(pChoise,"lock",true))
    {
    new vehtolock=0;
    if(!IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][0][pvID],2.0) || !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][1][pvID],2.0) || !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][2][pvID],2.0) || !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][3][pvID],2.0) || !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][4][pvID],2.0)) { return SendClientMessage(playerid,COLOR_GRAD1,"Du bist nicht bei deinem Fahrzeug!"); }
    if(!IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][0][pvID],2.0) || !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][1][pvID],2.0) || !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][2][pvID],2.0) || !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][3][pvID],2.0) || !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][4][pvID],2.0)) { vehtolock=1; }
    if(!VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]) { //falls der Wagen aufgeschlossen ist...:
    VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]=1;
    GameTextForPlayer(playerid,"~r~abgeschlossen",3000,6); }
    else { //...andernfalls...:
    VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]=0;
    GameTextForPlayer(playerid,"~g~aufgeschlossen",3000,6); }
    SetVehicleParamsForAll(PlayerVehicle[playerid][vehtolock][pvID],0,VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]);
    return 1;
    }
    if(!strcmp(pChoise,"sell",true))
    {
    new vehtosell,str[4],pName[MAX_PLAYER_NAME],string[64],i,File:csfile;
    if(!IsPlayerInRangeOfPoint(playerid,7.0,bpcoords[0],bpcoords[1],bpcoords[2]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID]))
    { return
    SendClientMessage(playerid,COLOR_GRAD1,"Du befindest dich nicht am Autohaus (Kaufpoint) und/oder im Fahrzeug!");
    }
    if(!IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID])) { vehtosell=1; }
    PlayerVehicle[playerid][vehtosell][pvModel]=0;
    PlayerVehicle[playerid][vehtosell][pvX]=0.0;
    PlayerVehicle[playerid][vehtosell][pvY]=0.0;
    PlayerVehicle[playerid][vehtosell][pvZ]=0.0;
    PlayerVehicle[playerid][vehtosell][pvA]=0.0;
    PlayerVehicle[playerid][vehtosell][pvColor1]=0;
    PlayerVehicle[playerid][vehtosell][pvColor2]=0;
    PlayerVehicle[playerid][vehtosell][pvPaintjob]=0;
    for(i=0;i<13;i++) {
    PlayerVehicle[playerid][vehtosell][pvModSlot][i]=0; }
    SetPlayerPos(playerid,carspawn[0],carspawn[1],carspawn[2]);
    DestroyVehicle(PlayerVehicle[playerid][vehtosell][pvID]);
    PlayerVehicle[playerid][vehtosell][pvID]=0;
    format(str,4,"[%d",vehtosell);
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof(string),"gFahrzeuge/%s.car",pName);
    csfile=fopen(string,io_read);
    for(i=0; fread(csfile,string); i++) { if(!strcmp(string,str,false,2)) { break; } }
    fclose(csfile);
    format(string,sizeof(string),"gFahrzeuge/%s.car",pName);
    fremoveline(string,i);
    csfile=fopen(string,io_read);
    fread(csfile,string),fclose(csfile);
    if(!strlen(string)) { format(string,sizeof(string),"gFahrzeuge/%s.car",pName); fremove(string); }
    for(i=0;i<MAX_CARS_AT_SHOP;i++) { if(ShopVehicle[i][svModel]==PlayerVehicle[playerid][vehtosell][pvModel]) break; }
    GivePlayerMoney(playerid,ShopVehicle[i][svCost]/2);
    SendClientMessage(playerid,COLOR_GREEN,"» Du hast dein Fahrzeug erfolgreich zurück an das Autohaus verkauft und hast die Hälfte des Fahrzeugwertes erhalten!");
    return 1;
    }
    if(!strcmp(pChoise,"park",true))
    {
    new vehtopark;
    if(!IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID])) { return SendClientMessage(playerid,COLOR_GRAD1,"Du bist nicht in der nähe des Autohauses (Verkaufspoint)!"); }
    if(!IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID])) { vehtopark=1; }
    GetVehiclePos(PlayerVehicle[playerid][0][pvID] || PlayerVehicle[playerid][1][pvID] || PlayerVehicle[playerid][2][pvID] || PlayerVehicle[playerid][3][pvID] || PlayerVehicle[playerid][4][pvID],PlayerVehicle[playerid][vehtopark][pvX],PlayerVehicle[playerid][vehtopark][pvY],PlayerVehicle[playerid][vehtopark][pvZ]);
    GetVehicleZAngle(PlayerVehicle[playerid][0][pvID],PlayerVehicle[playerid][vehtopark][pvA]);
    SendClientMessage(playerid,COLOR_WHITE,"» {FFFFFF}Du hast dein Fahrzeug {006600}erfolgreich{FFFFFF} an dieser Posistion geparkt!");
    SavePlayerVehicle(playerid);
    SendClientMessage(playerid,COLOR_WHITE,"» {FFFFFF}Du kannst dein Fahrzeug nun wenn du dich einloggst, immer hier finden!");
    return 1;
    }
    return 1;
    }
    return 0;


    }

  • Ok, dann ändere
    GivePlayerMoney(playerid,ShopVehicle[i][svCost]/2);
    zu:
    if(i == MAX_CARS_AT_SHOP) return SendClientMessage(playerid,COLOR_GRAD1,"Dieses Fahrzeug ist kein ShopVehicle-Model.");
    GivePlayerMoney(playerid,ShopVehicle[i][svCost]/2);

  • @Jeffry
    muss ich eig. bei zum beispiel:
    !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID])
    ein && oder ein | | setzen?


    und findest du noch irgendwelche Fehler? :S weil, irgendwie sieht das mit den | | und && komisch aus ?(
    muss das so sein?

  • Achso, ich dachte, dass war immer andersrum... naja, also nochmal alles umschreiben :D:S
    Danke Jeffry für deine Hilfe :)


    Edit:


    @Jeffry
    Ich brauche dich doch nochmal...
    ich habe nun das Problem, wenn ich das Auto geparkt habe (/car park), mich dann auslogge und wieder rein komme, steht es nicht an seiner eig. Park-Position, sondern am Ausgabepunkt des Autohauses, zudem wenn ich mir 2 Fahrzeuge kaufe, kann ich nur das zu erst gekaufte Fahrzeug aufmachen (mit /car lock). Am Anfang, wenn ich in das Autohaus rein gehe, und mir ein Auto aussuchen will, dann kommt auf einmal etwas mit der Geldwäsche, was eig. im GameMode-Script verbaut ist. Liegt es daran, dass das FS sich nicht mir dem GMS verträgt?


    Die Codes:

    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(!strcmp(cmdtext,"/car",true,4))
    {
    new pChoise[5];
    strpack(pChoise,strpart(cmdtext,1));
    if(!strlen(pChoise))
    {
    SendClientMessage(playerid,COLOR_GRAD1,"Verwendung: /car [Anwendung]");
    SendClientMessage(playerid,COLOR_GRAD1,"Anwendungen: lock, park, sell");
    return 1;
    }
    if(!strcmp(pChoise,"lock",true))
    {
    new vehtolock=0;
    if(!IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][0][pvID],2.0) && !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][1][pvID],2.0) && !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][2][pvID],2.0) && !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][3][pvID],2.0) && !IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][4][pvID],2.0)) { return SendClientMessage(playerid,COLOR_GRAD1,"Du bist nicht bei deinem Fahrzeug!"); }
    if(IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][0][pvID],2.0) && IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][1][pvID],2.0) && IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][2][pvID],2.0) && IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][3][pvID],2.0) && IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][4][pvID],2.0)) { vehtolock=1; }
    if(!VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]) { //falls der Wagen aufgeschlossen ist...:
    VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]=1;
    GameTextForPlayer(playerid,"~r~abgeschlossen",3000,6); }
    else { //...andernfalls...:
    VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]=0;
    GameTextForPlayer(playerid,"~g~aufgeschlossen",3000,6); }
    SetVehicleParamsForAll(PlayerVehicle[playerid][vehtolock][pvID],0,VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]);
    return 1;
    }
    if(!strcmp(pChoise,"sell",true))
    {
    new vehtosell,str[4],pName[MAX_PLAYER_NAME],string[64],i,File:csfile;
    if(!IsPlayerInRangeOfPoint(playerid,7.0,bpcoords[0],bpcoords[1],bpcoords[2]) || !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID]))
    { return
    SendClientMessage(playerid,COLOR_GRAD1,"Du befindest dich nicht am Autohaus (Kaufpoint) und/oder im Fahrzeug!");
    }
    if(IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID])) { vehtosell=1; }
    PlayerVehicle[playerid][vehtosell][pvModel]=0;
    PlayerVehicle[playerid][vehtosell][pvX]=0.0;
    PlayerVehicle[playerid][vehtosell][pvY]=0.0;
    PlayerVehicle[playerid][vehtosell][pvZ]=0.0;
    PlayerVehicle[playerid][vehtosell][pvA]=0.0;
    PlayerVehicle[playerid][vehtosell][pvColor1]=0;
    PlayerVehicle[playerid][vehtosell][pvColor2]=0;
    PlayerVehicle[playerid][vehtosell][pvPaintjob]=0;
    for(i=0;i<13;i++) {
    PlayerVehicle[playerid][vehtosell][pvModSlot][i]=0; }
    SetPlayerPos(playerid,carspawn[0],carspawn[1],carspawn[2]);
    DestroyVehicle(PlayerVehicle[playerid][vehtosell][pvID]);
    PlayerVehicle[playerid][vehtosell][pvID]=0;
    format(str,4,"[%d]",vehtosell);
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof(string),"gFahrzeuge/%s.car",pName);
    csfile=fopen(string,io_read);
    for(i=0; fread(csfile,string); i++) { if(!strcmp(string,str,false,2)) { break; } }
    fclose(csfile);
    format(string,sizeof(string),"gFahrzeuge/%s.car",pName);
    fremoveline(string,i);
    csfile=fopen(string,io_read);
    fread(csfile,string),fclose(csfile);
    if(!strlen(string)) { format(string,sizeof(string),"gFahrzeuge/%s.car",pName); fremove(string); }
    for(i=0;i<MAX_CARS_AT_SHOP;i++) { if(ShopVehicle[i][svModel]==PlayerVehicle[playerid][vehtosell][pvModel]) break; }
    if(i == MAX_CARS_AT_SHOP) return SendClientMessage(playerid,COLOR_GRAD1,"Dieses Fahrzeug ist kein ShopVehicle-Model.");
    GivePlayerMoney(playerid,ShopVehicle[i][svCost]/2);
    SendClientMessage(playerid,COLOR_GREEN,"» Du hast dein Fahrzeug erfolgreich zurück an das Autohaus verkauft und hast die Hälfte des Fahrzeugwertes erhalten!");
    return 1;
    }
    if(!strcmp(pChoise,"park",true))
    {
    new vehtopark;
    if(!IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID])) { return SendClientMessage(playerid,COLOR_GRAD1,"Du bist nicht in der nähe des Autohauses (Verkaufspoint)!"); }
    if(IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID])) { vehtopark=1; }
    GetVehiclePos(PlayerVehicle[playerid][0][pvID] && PlayerVehicle[playerid][1][pvID] && PlayerVehicle[playerid][2][pvID] && PlayerVehicle[playerid][3][pvID] && PlayerVehicle[playerid][4][pvID],PlayerVehicle[playerid][vehtopark][pvX],PlayerVehicle[playerid][vehtopark][pvY],PlayerVehicle[playerid][vehtopark][pvZ]);
    GetVehicleZAngle(PlayerVehicle[playerid][0][pvID] && PlayerVehicle[playerid][1][pvID] && PlayerVehicle[playerid][2][pvID] && PlayerVehicle[playerid][3][pvID] && PlayerVehicle[playerid][4][pvID],PlayerVehicle[playerid][vehtopark][pvA]);
    SendClientMessage(playerid,COLOR_WHITE,"» {FFFFFF}Du hast dein Fahrzeug {006600}erfolgreich{FFFFFF} an dieser Posistion geparkt!");
    SavePlayerVehicle(playerid);
    SendClientMessage(playerid,COLOR_WHITE,"» {FFFFFF}Du kannst dein Fahrzeug nun wenn du dich einloggst, immer hier finden!");
    return 1;
    }
    return 1;
    }
    return 0;
    }


    und wo das Fahrzeug gespeichert wird:

    stock SavePlayerVehicle(playerid) {
    new string[256],pName[MAX_PLAYER_NAME],File:pvfile;
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof(string),"gFahrzeuge/%s.car",pName);
    pvfile=fopen(string,io_write);
    for(new i=0; i<5; i++) {
    if(PlayerVehicle[playerid][i][pvModel]) {
    new str[2][64];
    format(string,sizeof(string),"[%d] %d %f %f %f %f %d %d %d ",i,PlayerVehicle[playerid][i][pvModel],PlayerVehicle[playerid][i][pvX],PlayerVehicle[playerid][i][pvY],PlayerVehicle[playerid][i][pvZ],PlayerVehicle[playerid][i][pvA],PlayerVehicle[playerid][i][pvColor1],PlayerVehicle[playerid][i][pvColor2],PlayerVehicle[playerid][i][pvPaintjob]);
    format(str[0],64,"%d %d %d %d %d %d %d ",PlayerVehicle[playerid][i][pvModSlot][0],PlayerVehicle[playerid][i][pvModSlot][1],PlayerVehicle[playerid][i][pvModSlot][2],PlayerVehicle[playerid][i][pvModSlot][3],PlayerVehicle[playerid][i][pvModSlot][4],PlayerVehicle[playerid][i][pvModSlot][5],PlayerVehicle[playerid][i][pvModSlot][6]);
    format(str[1],64,"%d %d %d %d %d %d %d\r\n",PlayerVehicle[playerid][i][pvModSlot][7],PlayerVehicle[playerid][i][pvModSlot][8],PlayerVehicle[playerid][i][pvModSlot][9],PlayerVehicle[playerid][i][pvModSlot][10],PlayerVehicle[playerid][i][pvModSlot][11],PlayerVehicle[playerid][i][pvModSlot][12],PlayerVehicle[playerid][i][pvModSlot][13]);
    strins(string,str[0],strlen(string)),strins(string,str[1],strlen(string));
    fwrite(pvfile,string); } }
    return fclose(pvfile); }

  • Liegt es daran, dass das FS sich nicht mir dem GMS verträgt?

    Ja, daran kann es liegen.
    Wenn du dir das Auto aussuchen willst, öffnet sich da ein Dialog? Wenn ja, dann schau mal im Code, welcher das ist und ändere dessen ID, zu einer die du im Gamemode nicht hast. Dann schau, ob es funktioniert.


    Sorry für die späte Antwort, bin erst grade heim gekommen.

  • @Jeffry
    Huhu Jeffry, biste gut Heim gekommen? :D;)
    also, wenn ich mir das Auto aussuchen will, welches ich mir kaufe dann kommt dieser Code:

    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    new string[64];
    if(pickupid==csPickup)
    {
    if(PlayerVehicle[playerid][0][pvModel] && PlayerVehicle[playerid][1][pvModel] && PlayerVehicle[playerid][2][pvModel] && PlayerVehicle[playerid][3][pvModel] && PlayerVehicle[playerid][4][pvModel]) { return SendClientMessage(playerid,COLOR_GREEN,"{33AA33}AUTOHAUS{FFFF00}:{33AA33} {FFFFFF}Du besitzt bereits 5 Fahrzeuge! Du musst erst einen verkaufen, wenn du einen anderen kaufen willst."); }
    SetPlayerVirtualWorld(playerid,playerid); //jeder Spieler hat die Virtuelle welt von seiner spielerid. so hat jeder seine eigene virtuelle welt, und so gibt es auch kein Weg dass 2 spieler sich treffen, während sie wagen auswählen =)
    TogglePlayerControllable(playerid,0);
    SetPlayerPos(playerid,VehicleReviewData[vrVehiclePos][0],VehicleReviewData[vrVehiclePos][1],(VehicleReviewData[vrVehiclePos][2]-5));
    SetPlayerCameraPos(playerid,VehicleReviewData[vrCameraPos][0],VehicleReviewData[vrCameraPos][1],VehicleReviewData[vrCameraPos][2]);
    SetPlayerCameraLookAt(playerid,VehicleReviewData[vrVehiclePos][0],VehicleReviewData[vrVehiclePos][1],VehicleReviewData[vrVehiclePos][2]);


    ShowingVehicle[playerid]=0;
    ReviewingVehicleID[playerid]=CreateVehicle(ShopVehicle[0][svModel],VehicleReviewData[vrVehiclePos][0],VehicleReviewData[vrVehiclePos][1],VehicleReviewData[vrVehiclePos][2],VehicleReviewData[vrVehiclePos][3],-1,-1,60);
    SetVehicleParamsForAll(ReviewingVehicleID[playerid],1,1);
    SetVehicleVirtualWorld(ReviewingVehicleID[playerid],playerid);
    SendClientMessage(playerid,COLOR_GREEN,"{33AA33}AUTOHAUS{FFFF00}:{33AA33} Verwende {FFFF00}Rechte & Linke Maustaste{33AA33} um dir die Fahrzeuge auswählen zu können!");
    SendClientMessage(playerid,COLOR_GREEN,"{33AA33}AUTOHAUS{FFFF00}:{33AA33} Verwende {FFFF00}Enter/Taste F{33AA33} um das Autohaus verlassen!");
    SendClientMessage(playerid,COLOR_GREEN,"{33AA33}AUTOHAUS{FFFF00}:{33AA33} Verwende die {FFFF00}Leertaste (Space){33AA33}, um das Fahrzeug zu kaufen, die du dir ansiehst!");
    format(string,sizeof(string),"~w~%s~n~~g~$%d",VehicleName[ShopVehicle[0][svModel]-400],ShopVehicle[0][svCost]);
    GameTextForPlayer(playerid,string,30000,4);
    }
    return 1;
    }


    allerdings habe ich keinen Code, welcher bestimmt welches Fahrzeug ich grad im Slot habe, sondern welches Fahrzeug grad in der nähe ist - das wird dann z.b. auf-/abgeschlossen

  • Scheint mir so als überschneiden sich da pickup-IDs.
    Versuche mal nach
    GameTextForPlayer(playerid,string,30000,4);
    ein
    return 0;
    einzufügen.
    Hilft das, bezüglich dem Geldwäsche-Dialog?


    Zwecks dem Lock:
    Versuche es so:
    if(!strcmp(pChoise,"lock",true))
    {
    new vehtolock=-1;
    for(new i = 0; i < sizeof(PlayerVehicle[]); i++)
    {
    if(IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][i][pvID],2.0))
    {
    vehtolock=i;
    break;
    }
    }
    if(vehtolock == -1) return SendClientMessage(playerid,COLOR_GRAD1,"Du bist nicht bei deinem Fahrzeug!");
    if(!VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]])
    {
    //falls der Wagen aufgeschlossen ist...:
    VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]=1;
    GameTextForPlayer(playerid,"~r~abgeschlossen",3000,6);
    }
    else
    {
    //...andernfalls...:
    VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]=0;
    GameTextForPlayer(playerid,"~g~aufgeschlossen",3000,6);
    }
    SetVehicleParamsForAll(PlayerVehicle[playerid][vehtolock][pvID],0,VehicleDoorStatus[PlayerVehicle[playerid][vehtolock][pvID]]);
    return 1;
    }

  • @Jeffry
    Juhu Danke, hat funktioniert :)
    nur ich habe jetzt das Problem, die Park-Positionen werden nicht gespeichert, und wenn ich mir ein neues Auto kaufen will, dann spawnt das andere wieder an dem Ausgabe-Point. :/
    der park-Dia.:

    if(!strcmp(pChoise,"park",true))
    {
    new vehtopark;
    if(!IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) && !IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID])) { return SendClientMessage(playerid,COLOR_GRAD1,"Du bist nicht in der nähe des Autohauses (Verkaufspoint)!"); }
    if(IsPlayerInVehicle(playerid,PlayerVehicle[playerid][0][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][1][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][2][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][3][pvID]) && IsPlayerInVehicle(playerid,PlayerVehicle[playerid][4][pvID])) { vehtopark=1; }
    GetVehiclePos(PlayerVehicle[playerid][0][pvID] && PlayerVehicle[playerid][1][pvID] && PlayerVehicle[playerid][2][pvID] && PlayerVehicle[playerid][3][pvID] && PlayerVehicle[playerid][4][pvID],PlayerVehicle[playerid][vehtopark][pvX],PlayerVehicle[playerid][vehtopark][pvY],PlayerVehicle[playerid][vehtopark][pvZ]);
    GetVehicleZAngle(PlayerVehicle[playerid][0][pvID] && PlayerVehicle[playerid][1][pvID] && PlayerVehicle[playerid][2][pvID] && PlayerVehicle[playerid][3][pvID] && PlayerVehicle[playerid][4][pvID],PlayerVehicle[playerid][vehtopark][pvA]);
    SendClientMessage(playerid,COLOR_WHITE,"» {FFFFFF}Du hast dein Fahrzeug {006600}erfolgreich{FFFFFF} an dieser Posistion geparkt!");
    SavePlayerVehicle(playerid);
    SendClientMessage(playerid,COLOR_WHITE,"» {FFFFFF}Du kannst dein Fahrzeug nun wenn du dich einloggst, immer hier finden!");
    return 1;
    }

  • Huhu Jeffry, biste gut Heim gekommen?

    Vorhin überlesen, ja bin ich, danke! :)


    Zwecks dem Parken:
    Das dürfte dann gleich funktionieren:
    if(!strcmp(pChoise,"park",true))
    {
    new vehtopark=-1;
    for(new i = 0; i < sizeof(PlayerVehicle[]); i++)
    {
    if(IsPlayerNearVehicle(playerid,PlayerVehicle[playerid][i][pvID],2.0))
    {
    vehtopark=i;
    break;
    }
    }
    if(vehtopark == -1) return SendClientMessage(playerid,COLOR_GRAD1,"Du bist nicht bei deinem Fahrzeug!");
    GetVehiclePos(PlayerVehicle[playerid][vehtopark][pvID],PlayerVehicle[playerid][vehtopark][pvX],PlayerVehicle[playerid][vehtopark][pvY],PlayerVehicle[playerid][vehtopark][pvZ]);
    GetVehicleZAngle(PlayerVehicle[playerid][vehtopark][pvID],PlayerVehicle[playerid][vehtopark][pvA]);
    SendClientMessage(playerid,COLOR_WHITE,"» {FFFFFF}Du hast dein Fahrzeug {006600}erfolgreich{FFFFFF} an dieser Posistion geparkt!");
    SavePlayerVehicle(playerid);
    SendClientMessage(playerid,COLOR_WHITE,"» {FFFFFF}Du kannst dein Fahrzeug nun wenn du dich einloggst, immer hier finden!");
    return 1;
    }

    3HZXdYd.png

    Einmal editiert, zuletzt von Jeffry ()

  • @Jeffry

    stock SavePlayerVehicle(playerid) {
    new string[256],pName[MAX_PLAYER_NAME],File:pvfile;
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof(string),"gFahrzeuge/%s.car",pName);
    pvfile=fopen(string,io_write);
    for(new i=0; i<5; i++) {
    if(PlayerVehicle[playerid][i][pvModel]) {
    new str[2][64];
    format(string,sizeof(string),"[%d] %d %f %f %f %f %d %d %d ",i,PlayerVehicle[playerid][i][pvModel],PlayerVehicle[playerid][i][pvX],PlayerVehicle[playerid][i][pvY],PlayerVehicle[playerid][i][pvZ],PlayerVehicle[playerid][i][pvA],PlayerVehicle[playerid][i][pvColor1],PlayerVehicle[playerid][i][pvColor2],PlayerVehicle[playerid][i][pvPaintjob]);
    format(str[0],64,"%d %d %d %d %d %d %d ",PlayerVehicle[playerid][i][pvModSlot][0],PlayerVehicle[playerid][i][pvModSlot][1],PlayerVehicle[playerid][i][pvModSlot][2],PlayerVehicle[playerid][i][pvModSlot][3],PlayerVehicle[playerid][i][pvModSlot][4],PlayerVehicle[playerid][i][pvModSlot][5],PlayerVehicle[playerid][i][pvModSlot][6]);
    format(str[1],64,"%d %d %d %d %d %d %d\r\n",PlayerVehicle[playerid][i][pvModSlot][7],PlayerVehicle[playerid][i][pvModSlot][8],PlayerVehicle[playerid][i][pvModSlot][9],PlayerVehicle[playerid][i][pvModSlot][10],PlayerVehicle[playerid][i][pvModSlot][11],PlayerVehicle[playerid][i][pvModSlot][12],PlayerVehicle[playerid][i][pvModSlot][13]);
    strins(string,str[0],strlen(string)),strins(string,str[1],strlen(string));
    fwrite(pvfile,string); } }
    return fclose(pvfile); }

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen