Sirene erstellt sich 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
  • Hallo,
    ich habe ein problem.
    Icg führe das public nach einem aus jedoch erstellt sie sich nur selten..
    Also manchmal geht es und manchmal wieder nich..


    public sirenefw(playerid)
    {
    if(!IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
    if(IsACop(playerid) || IsAOrdnungsbeamter(playerid) || PlayerInfo[playerid][pTeam] == 4 || PlayerInfo[playerid][pAdmin] > 1) {
    new tmpcar = GetPlayerVehicleID(playerid);
    if(UCL[GetPlayerVehicleID(playerid)] == 0) {
    if(GetVehicleModel(tmpcar) == 560) {
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(19419,0,0,0,0,0,0,100);
    sirene2[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene3[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene4[GetPlayerVehicleID(playerid)] = CreateObject(19292,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.0,0.0,0.85,0,0,0);//Dach sirene


    UCL[GetPlayerVehicleID(playerid)] = 1;
    SendClientMessage(playerid,0xFF0000,"Das Blaulicht wurde eingeschalten!");
    } else if(GetVehicleModel(tmpcar) == 554) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.6,0.2,1.07,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 491) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.4,-0.2,0.75,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 415) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19292,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0,0.6,0.3,0,0,0);//Vorne Fenster
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.4,-0.2,0.65,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 533) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0,0.7,0.342,0,0,0);//Vorne Fenster
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 451) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19292,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0,0.6,0.2,0,0,0);//Vorne Fenster
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.45,-0.3,0.6,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 541) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19292,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0,0.8,0.3,0,0,0);//Vorne Fenster
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.45,-0.1,0.65,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 470) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene2[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.85,2.2,0.25,0,0,0);//Vorne Rechts
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.85,2.2,0.25,0,0,0);//Vorne Links
    AttachObjectToVehicle(sirene2[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.6,0.2,1.1,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 421) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0 ,2.6,0,0,0,0);//Vorne Mitte
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.4,0.2,0.72,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 405) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0 ,2.6,0,0,0,0);//Vorne Mitte
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.4,0,0.78,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 426) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0 ,2.6,0,0,0,0);//Vorne Mitte
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.5,0,0.88,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 517) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0 ,2.6,0,0,0,0);//Vorne Mitte
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.6,0,0.85,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 411) {
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(19419,0,0,0,0,0,0,100);
    sirene2[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene3[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.0,2.6,0,0,0,0);//Vorne Mitte
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.0,0.0,0.7,0,0,0);//Dach sirene
    AttachObjectToVehicle(sirene2[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.7,2.6,0,0,0,0);//Vorne Licht Beifahrerseite
    AttachObjectToVehicle(sirene3[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.7,2.6,0,0,0,0);//Vorne Licht Fahrerseite
    UCL[GetPlayerVehicleID(playerid)] = 1;
    SendClientMessage(playerid,0xFF0000,"Du hast das Blaulicht eingeschaltet!");
    } else if(GetVehicleModel(tmpcar) == 490) {
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(19419,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.0,0.0,1.10,0,0,0);//Dach sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    SendClientMessage(playerid,0xFF0000,"Du hast das Blaulicht eingeschaltet!");
    } else if(GetVehicleModel(tmpcar) == 561) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.4,0.1,0.85,0,0,0);//Dach Fahrer
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 579) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(19292,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.6,0,1.27,0,0,0);//Auf dem Dach
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0,0.7,0.7,0,0,0);//Mitte im Fenster
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 598 || GetVehicleModel(tmpcar) == 597 || GetVehicleModel(tmpcar) == 596) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene2[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene3[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.6,-1.5,0.5,0,0,0);//Hinten Links
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.6,-1.5,0.5,0,0,0);//Hinten Rechts
    AttachObjectToVehicle(sirene2[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.7,2.5,0,0,0,0);//Vorne Links
    AttachObjectToVehicle(sirene3[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.7,2.5,0,0,0,0);//Vorne Rechts
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 475) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene2[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.4,2.6,-0.1,0,0,0);//Vorne Links
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.4,2.6,-0.1,0,0,0);//Vorne Rechts
    AttachObjectToVehicle(sirene2[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.5,0,0.742,0,0,0);//Oben Sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else if(GetVehicleModel(tmpcar) == 402) {
    SendClientMessage(playerid, COLOR_GREEN, "Du hast das Undercoverlicht aufgesetzt.");
    sirene[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene1[GetPlayerVehicleID(playerid)] = CreateObject(19288,0,0,0,0,0,0,100);
    sirene2[GetPlayerVehicleID(playerid)] = CreateObject(18646,0,0,0,0,0,0,100);
    AttachObjectToVehicle(sirene[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.4,2.6,-0.1,0,0,0);//Vorne Links
    AttachObjectToVehicle(sirene1[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),0.4,2.6,-0.1,0,0,0);//Vorne Rechts
    AttachObjectToVehicle(sirene2[GetPlayerVehicleID(playerid)],GetPlayerVehicleID(playerid),-0.5,-0.3,0.78,0,0,0);//Oben Sirene
    UCL[GetPlayerVehicleID(playerid)] = 1;
    } else
    SendClientMessage(playerid, COLOR_BENUTZETEXT, "Du kannst kein Blaulicht / Undercoverlicht in diesem Fahrzeug benutzen!");
    }
    else if(UCL[GetPlayerVehicleID(playerid)] == 1) {
    SendClientMessage(playerid, COLOR_RED, "Du hast das Undercoverlicht abgesetzt.");
    if(sirene[GetPlayerVehicleID(playerid)] != -1) {
    DestroyObject(sirene[GetPlayerVehicleID(playerid)]);
    sirene[GetPlayerVehicleID(playerid)] = -1;
    }
    if(sirene1[GetPlayerVehicleID(playerid)] != -1) {
    DestroyObject(sirene1[GetPlayerVehicleID(playerid)]);
    sirene1[GetPlayerVehicleID(playerid)] = -1;
    }
    if(sirene2[GetPlayerVehicleID(playerid)] != -1) {
    DestroyObject(sirene2[GetPlayerVehicleID(playerid)]);
    sirene2[GetPlayerVehicleID(playerid)] = -1;
    }
    if(sirene3[GetPlayerVehicleID(playerid)] != -1) {
    DestroyObject(sirene3[GetPlayerVehicleID(playerid)]);
    sirene3[GetPlayerVehicleID(playerid)] = -1;
    }
    if(sirene4[GetPlayerVehicleID(playerid)] != -1) {
    DestroyObject(sirene3[GetPlayerVehicleID(playerid)]);
    sirene4[GetPlayerVehicleID(playerid)] = -1;
    }
    UCL[GetPlayerVehicleID(playerid)] = 0;
    }
    } else {
    SendClientMessage(playerid,COLOR_BENUTZETEXT,"Du darfst diesen Befehl nicht benutzen.");
    }
    return 1;
    }

  • Beitrag von xxGetterheroxx ()

    Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar.
  • Was heißt, es geht nur manchmal? Gibt es da irgendwelche Auffälligkeiten, wenn es nicht geht?
    Hast du alle diese Array-Variablen mit MAX_VEHICLES deklariert?


    new sirene[MAX_VEHICLES];
    new sirene1[MAX_VEHICLES];
    new sirene2[MAX_VEHICLES];
    new sirene3[MAX_VEHICLES];
    new sirene4[MAX_VEHICLES];
    new UCL[MAX_VEHICLES];


    Manchmal erstellt sie sich und manchmal nicht..

  • Das passt eigentlich.
    Naja, mit manchmal fange ich halt nichts an. Was durchaus sein könnte ist, dass du das Limit der Objekte überschritten hast, und deshalb die Objekte nicht erstellt werden.


    Wenn es nicht klappt, kommen die Meldungen im Chat trotzdem, und nur die Objekte sind nicht da?

  • Das passt eigentlich.
    Naja, mit manchmal fange ich halt nichts an. Was durchaus sein könnte ist, dass du das Limit der Objekte überschritten hast, und deshalb die Objekte nicht erstellt werden.


    Wenn es nicht klappt, kommen die Meldungen im Chat trotzdem, und nur die Objekte sind nicht da?

    Genau