Sirene mit einem Befehl an / aus

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 Community. Ich habe es soweit gescriptet, blos ich weiss nicht wie ich Abrage ob sie an/aus ist.



    if(strcmp(cmdtext,"/sirene",true) == 0)
    {
    if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
    {
    new vehid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehid) == 560 && sfl1[vehid] == 0) // Sultan
    {
    sfl1[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
    sfl2[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
    sfl3[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
    sfl4[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
    sfl5[vehid] = CreateObject(18646,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(sfl1[vehid],vehid,-0.365000,2.250000,0.049999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl2[vehid],vehid,0.405000,2.250000,0.049999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl3[vehid],vehid,0.270000,2.275000,0.019999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl4[vehid],vehid,-0.304999,2.275000,0.019999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl5[vehid],vehid,-0.589999,-0.069999,0.869999,0.000000,0.000000,0.000000);
    SendClientMessage(playerid,"Du hast die Sirene eingeschalten!");
    }
    if(GetVehicleModel(vehid) == 541 && sfl1[vehid] == 0) // Bullet
    {
    sfl1[vehid] = CreateObject(19419,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(sfl1[vehid], vehid, -0.000000, -0.704999, 0.544999, 0.000000, 0.000000, 0.000000); //Object Model: 19420 |
    SendClientMessage(playerid,"Du hast die Sirene eingeschalten!");
    }
    if(GetVehicleModel(vehid) == 451 && sfl1[vehid] == 0) // Turismo
    {
    sfl1[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
    sfl2[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
    sfl3[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
    sfl4[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
    sfl5[vehid] = CreateObject(19419,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(sfl1[vehid],vehid,-0.000000,2.250000,0.049999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl2[vehid],vehid,0.000000,2.250000,0.049999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl3[vehid],vehid,0.000000,2.275000,0.019999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl4[vehid],vehid,-0.000000,2.275000,0.019999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl5[vehid], vehid, -0.000000, -0.704999, 0.544999, 0.000000, 0.000000, 0.000000);
    SendClientMessage(playerid,"Du hast die Sirene eingeschalten!");
    }
    else
    {
    DestroyObject(sfl1[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl2[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl3[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl4[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl5[GetPlayerVehicleID(playerid)]);
    sfl1[GetPlayerVehicleID(playerid)] = 0;
    sfl2[GetPlayerVehicleID(playerid)] = 0;
    sfl3[GetPlayerVehicleID(playerid)] = 0;
    sfl4[GetPlayerVehicleID(playerid)] = 0;
    sfl5[GetPlayerVehicleID(playerid)] = 0;

    SendClientMessage(playerid,"Du hast die Sirene ausgeschalten!");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist kein Beamter" );
    }
    return 1;
    }

  • du erstellst dir einen bool.


    Oben im Script :
    new bool:sirene[MAX_PLAYERS] = false // sirene ist aus.


    dann fragst du in deinem befehl ab ob sie an oder aus ist :


    if(sirene[playerid] == false)
    {
    // Hier wird die sirene an gemacht
    sirene[playerid] = true;
    }
    else if(sirene[playerid] == true)
    {
    // Hier wird die sirene ausgemacht
    sirene[playerid] = false;
    }

  • C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(538) : error 001: expected token: ";", but found "new"
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(34395) : error 035: argument type mismatch (argument 2)
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(34401) : error 035: argument type mismatch (argument 2)
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(34415) : error 035: argument type mismatch (argument 2)
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(34431) : error 035: argument type mismatch (argument 2)
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(40436) : error 017: undefined symbol "sirenean"
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(40436) : warning 215: expression has no effect
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(40436) : error 001: expected token: ";", but found "]"
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(40436) : error 029: invalid expression, assumed zero
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(40436) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    9 Errors.

  • if(strcmp(cmdtext,"/sirene",true) == 0)
    {
    if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
    {
    if(sirene[playerid] == false)
    {
    new vehid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehid) == 560 && sfl1[vehid] == 0) // Sultan
    {
    sfl1[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
    sfl2[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
    sfl3[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
    sfl4[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
    sfl5[vehid] = CreateObject(18646,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(sfl1[vehid],vehid,-0.365000,2.250000,0.049999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl2[vehid],vehid,0.405000,2.250000,0.049999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl3[vehid],vehid,0.270000,2.275000,0.019999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl4[vehid],vehid,-0.304999,2.275000,0.019999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl5[vehid],vehid,-0.589999,-0.069999,0.869999,0.000000,0.000000,0.000000);
    SendClientMessage(playerid,"Du hast die Sirene eingeschalten!");
    }
    if(GetVehicleModel(vehid) == 541 && sfl1[vehid] == 0) // Bullet
    {
    sfl1[vehid] = CreateObject(19419,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(sfl1[vehid], vehid, -0.000000, -0.704999, 0.544999, 0.000000, 0.000000, 0.000000); //Object Model: 19420 |
    SendClientMessage(playerid,"Du hast die Sirene eingeschalten!");
    }
    if(GetVehicleModel(vehid) == 451 && sfl1[vehid] == 0) // Turismo
    {
    sfl1[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
    sfl2[vehid] = CreateObject(19292,0,0,-1000,0,0,0,100);
    sfl3[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
    sfl4[vehid] = CreateObject(19290,0,0,-1000,0,0,0,100);
    sfl5[vehid] = CreateObject(19419,0,0,-1000,0,0,0,100);
    AttachObjectToVehicle(sfl1[vehid],vehid,-0.000000,2.250000,0.049999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl2[vehid],vehid,0.000000,2.250000,0.049999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl3[vehid],vehid,0.000000,2.275000,0.019999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl4[vehid],vehid,-0.000000,2.275000,0.019999,0.000000,0.000000,0.000000);
    AttachObjectToVehicle(sfl5[vehid], vehid, -0.000000, -0.704999, 0.544999, 0.000000, 0.000000, 0.000000);
    SendClientMessage(playerid,"Du hast die Sirene eingeschalten!");
    sirene[playerid] = true;
    }
    else if(sirene[playerid] == true)
    {
    DestroyObject(sfl1[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl2[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl3[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl4[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl5[GetPlayerVehicleID(playerid)]);
    sfl1[GetPlayerVehicleID(playerid)] = 0;
    sfl2[GetPlayerVehicleID(playerid)] = 0;
    sfl3[GetPlayerVehicleID(playerid)] = 0;
    sfl4[GetPlayerVehicleID(playerid)] = 0;
    sfl5[GetPlayerVehicleID(playerid)] = 0;
    sirene[playerid] = false;
    SendClientMessage(playerid,"Du hast die Sirene ausgeschalten!");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist kein Beamter" );
    }
    return 1;


    }
    }
    if(strcmp(cmdtext,"/sireneaus",true) == 0)
    {
    if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
    {
    DestroyObject(sfl1[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl2[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl3[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl4[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl5[GetPlayerVehicleID(playerid)]);
    DestroyObject(sfl6[GetPlayerVehicleID(playerid)]);
    sfl1[GetPlayerVehicleID(playerid)] = 0;
    sfl2[GetPlayerVehicleID(playerid)] = 0;
    sfl3[GetPlayerVehicleID(playerid)] = 0;
    sfl4[GetPlayerVehicleID(playerid)] = 0;
    sfl5[GetPlayerVehicleID(playerid)] = 0;
    sfl6[GetPlayerVehicleID(playerid)] = 0;
    }
    else
    {
    SendClientMessage(playerid,0xFF0000FF,"Du bist kein Beamter" );
    }
    return 1;
    }


    Errors:


    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(34395) : error 035: argument type mismatch (argument 2)
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(34401) : error 035: argument type mismatch (argument 2)
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(34415) : error 035: argument type mismatch (argument 2)
    C:\Users\felix\Desktop\RL\rl\gamemodes\RoG1.pwn(34431) : error 035: argument type mismatch (argument 2)
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.

  • Hab erstmal die SendClientMessage raus gehauen. Erstmal Script hochladen und dann mal testen. Wenn es klappt sage ich euch bescheid und auch wenn nicht. Ich werde danach die SendClientMessage wieder rein hauen.
    mfg


    //
    Sagen wir mal jain
    Es geht, blos wenn ich die Sirene ausschalten will also mit /sirene kommt Du bist kein Beamter.

    Einmal editiert, zuletzt von Icy1337 ()