[Frage] Sirenen zB auf Bullet

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
  • Das alles ist unter Public.
    {
    if(newkeys == (KEY_CROUCH))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(Sirene[playerid] = false)
    {
    Sirene[playerid] = true;
    new vehicle = GetPlayerVehicleID(playerid);
    Sirenen[0] = CreateObject(18646,0,0,0,0,0,0);
    AttachObjectToVehicle(Sirenen[0],vehicle, -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
    }
    else
    {
    DestroyObject(Sirenen[0]);
    Sirene[playerid] = false;
    }
    {
    if(newkeys == 16 && InCargo[playerid])
    {
    new Float:X, Float:Y, Float:Z;
    GetVehiclePos(InCargo[playerid], X, Y, Z);
    SetPlayerPos(playerid, X+4, Y, Z);
    SetPlayerInterior(playerid, 0);
    InCargo[playerid] = 0;
    }
    if(newkeys == 16 && InLevi[playerid])
    {
    new Float:X, Float:Y, Float:Z;
    GetVehiclePos(InLevi[playerid], X, Y, Z);
    SetPlayerPos(playerid, X+4, Y, Z);
    SetPlayerInterior(playerid, 0);
    InLevi[playerid] = 0;
    }
    if(dtc_AutohausCat[playerid] != 2000)
    {
    new autohaus = dtc_AutohausCat[playerid];
    new AhCars;
    for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
    {
    if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
    {
    AhCars ++;
    }
    }
    if(newkeys == KEY_ANALOG_RIGHT || newkeys == KEY_LOOK_RIGHT) //right (6 Numpad/e)
    {
    new carid = dtc_AutohausCar[playerid] +1;
    if(carid >= AhCars)
    {
    carid = 0;
    }
    new car,preis,counter;
    for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
    {
    if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
    {
    if( counter == carid)
    {
    car = dtcKaufliste[ah][dtc_CarModel];
    preis = dtcKaufliste[ah][dtc_CarPreis];
    }
    counter ++;
    }
    }
    new c1 = random(120);
    new c2 = random(120);
    DestroyVehicle(dtc_AutohausSCar[playerid]);
    dtc_AutohausSCar[playerid] = CreateVehicle(car, DtcSonstiges[autohaus][1][0],DtcSonstiges[autohaus][1][1],DtcSonstiges[autohaus][1][2],DtcSonstiges[autohaus][1][3],c1,c2,-1);
    SetVehicleVirtualWorld(dtc_AutohausSCar[playerid],55+playerid);
    new string[246];
    TextDrawHideForPlayer(playerid,CarKauf[playerid]);
    TextDrawDestroy(CarKauf[playerid]);
    format(string,sizeof(string),"~r~---------- AUTOHAUS ----------~n~~g~Fahrzeug: ~w~%s~n~~g~Preis: ~w~$%d~n~~b~Auswaehlen:~n~~w~ <Num 4<~b~&~w~>Num 6> ~n~~b~Kaufen:~w~ Enter ~n~~b~Abbrechen:~w~ Tab",CarName[car-400],preis);
    CarKauf[playerid] = TextDrawCreate(200,310,string);
    TextDrawAlignment(CarKauf[playerid],1);
    TextDrawUseBox(CarKauf[playerid],1);
    TextDrawBoxColor(CarKauf[playerid],0x000000FF);
    TextDrawBackgroundColor(CarKauf[playerid],COLOR_BLACK);
    TextDrawSetOutline(CarKauf[playerid],1);
    TextDrawFont(CarKauf[playerid], 2);
    //TextDrawSetProportional(CarKauf[playerid], 2);
    TextDrawTextSize(CarKauf[playerid],450,410);
    TextDrawShowForPlayer(playerid,CarKauf[playerid]);
    dtc_AutohausCar[playerid] = carid;
    }
    if(newkeys == KEY_ANALOG_LEFT || newkeys == KEY_LOOK_LEFT) //left (4 Numpad/q)
    {
    new carid = dtc_AutohausCar[playerid] -1;
    if(carid < 0)
    {
    carid = AhCars;
    }
    new car,preis,counter;
    for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
    {
    if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
    {
    if( counter == carid)
    {
    car = dtcKaufliste[ah][dtc_CarModel];
    preis = dtcKaufliste[ah][dtc_CarPreis];
    }
    counter ++;
    }
    }
    new c1 = random(120);
    new c2 = random(120);
    DestroyVehicle(dtc_AutohausSCar[playerid]);
    dtc_AutohausSCar[playerid] = CreateVehicle(car, DtcSonstiges[autohaus][1][0],DtcSonstiges[autohaus][1][1],DtcSonstiges[autohaus][1][2],DtcSonstiges[autohaus][1][3],c1,c2,-1);
    SetVehicleVirtualWorld(dtc_AutohausSCar[playerid],55+playerid);
    new string[246];
    TextDrawHideForPlayer(playerid,CarKauf[playerid]);
    TextDrawDestroy(CarKauf[playerid]);
    format(string,sizeof(string),"~r~---------- AUTOHAUS ----------~n~~g~Fahrzeug: ~w~%s~n~~g~Preis: ~w~$%d~n~~b~Auswaehlen:~n~~w~ <Num 4<~b~&~w~>Num 6> ~n~~b~Kaufen:~w~ Enter ~n~~b~Abbrechen:~w~ Tab",CarName[car-400],preis);
    CarKauf[playerid] = TextDrawCreate(200,310,string);
    TextDrawAlignment(CarKauf[playerid],1);
    TextDrawUseBox(CarKauf[playerid],1);
    TextDrawBoxColor(CarKauf[playerid],0x000000FF);
    TextDrawSetOutline(CarKauf[playerid],1);
    TextDrawBackgroundColor(CarKauf[playerid],COLOR_BLACK);
    TextDrawFont(CarKauf[playerid], 2);
    //TextDrawSetProportional(CarKauf[playerid], 2);
    TextDrawTextSize(CarKauf[playerid],450,410);
    TextDrawShowForPlayer(playerid,CarKauf[playerid]);
    dtc_AutohausCar[playerid] = carid;
    }
    if(newkeys == 16)//Enter
    {
    new carid = dtc_AutohausCar[playerid];
    new car,preis,counter;
    for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
    {
    if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
    {
    if( counter == carid)
    {
    car = dtcKaufliste[ah][dtc_CarModel];
    preis = dtcKaufliste[ah][dtc_CarPreis];
    }
    counter ++;
    }
    }
    if(GetPlayerMoney(playerid) < preis){SendClientMessage(playerid,COLOR_GREY,"Du hast nicht genug Geld um dieses Fahrzeug zu kaufen!");} else {OnPlayerBuyCar(playerid,car,preis,autohaus);}
    //ResetPlayer
    DestroyVehicle(dtc_AutohausSCar[playerid]);
    SetPlayerPos(playerid, DtcSonstiges[autohaus][4][0],DtcSonstiges[autohaus][4][1],DtcSonstiges[autohaus][4][2]);
    SetPlayerFacingAngle(playerid,DtcSonstiges[autohaus][4][3]);
    dtc_AutohausCar[playerid] = 0;
    dtc_AutohausCat[playerid] = 2000;
    SetPlayerVirtualWorld(playerid,0);
    TextDrawHideForPlayer(playerid,CarKauf[playerid]);
    TextDrawDestroy(CarKauf[playerid]);
    TogglePlayerControllable(playerid,1);
    SetCameraBehindPlayer(playerid);
    }
    if(newkeys == KEY_ACTION) //Tab
    {
    //ResetPlayer
    DestroyVehicle(dtc_AutohausSCar[playerid]);
    SetPlayerPos(playerid, DtcSonstiges[autohaus][4][0],DtcSonstiges[autohaus][4][1],DtcSonstiges[autohaus][4][2]);
    SetPlayerFacingAngle(playerid,DtcSonstiges[autohaus][4][3]);
    dtc_AutohausCar[playerid] = 0;
    dtc_AutohausCat[playerid] = 2000;
    SetPlayerVirtualWorld(playerid,0);
    TextDrawHideForPlayer(playerid,CarKauf[playerid]);
    TextDrawDestroy(CarKauf[playerid]);
    TogglePlayerControllable(playerid,1);
    SetCameraBehindPlayer(playerid);
    }
    }
    if(newkeys & KEY_SUBMISSION)
    {


    if(IsPlayerInRangeOfPoint(playerid,15.0,1588.6610,-1638.5031,13.3795))
    {
    OnPlayerCommandText(playerid,"/pd1");
    }


    if(IsPlayerInRangeOfPoint(playerid,10.0,1545.2229,-1627.4520,13.3828))
    {
    OnPlayerCommandText(playerid,"/pd2");
    }


    if(IsPlayerInRangeOfPoint(playerid,15.0,-1631.8907,690.0701,7.1875))
    {
    OnPlayerCommandText(playerid,"/sfpdtor");
    }


    if(IsPlayerInRangeOfPoint(playerid,15.0,135.2632,1941.1360,19.5111))
    {
    OnPlayerCommandText(playerid,"/armylift1");
    }


    if(IsPlayerInRangeOfPoint(playerid,15.0,285.6308,1821.0627,17.7795))
    {
    OnPlayerCommandText(playerid,"/armylift2");
    }


    if(IsPlayerInRangeOfPoint(playerid,15.0,213.6029,1876.4932,13.1406))
    {
    OnPlayerCommandText(playerid,"/army1");
    }


    if(IsPlayerInRangeOfPoint(playerid,5.0,225.8057,1872.3940,13.7421))
    {
    OnPlayerCommandText(playerid,"/army2");
    }


    if(IsPlayerInRangeOfPoint(playerid,5.0,2095.8030,-1448.1106,23.5593))
    {
    OnPlayerCommandText(playerid,"/medic1");
    }


    if(IsPlayerInRangeOfPoint(playerid,5.0,2000.7635,-1358.1760,23.5345))
    {
    OnPlayerCommandText(playerid,"/medic2");
    }


    if(IsPlayerInRangeOfPoint(playerid,25.0,1997.0819,-1450.3594,13.5598))
    {
    OnPlayerCommandText(playerid,"/medic3");
    }
    if(IsPlayerInRangeOfPoint(playerid,5.0,367.3445,193.5131,1008.3828))
    {
    OnPlayerCommandText(playerid,"/präsibüro");
    }
    if(IsPlayerInRangeOfPoint(playerid,5.0,-2047.5688,-102.3382,39.2918))
    {
    OnPlayerCommandText(playerid,"/lehrerlift");
    }
    if(IsPlayerInRangeOfPoint(playerid,10.0,960.2383,-1434.2980,13.5527))
    {
    OnPlayerCommandText(playerid,"/fw");
    }
    if(IsPlayerInRangeOfPoint(playerid,15.0,924.185730, -1223.406982, 16.036469))
    {
    OnPlayerCommandText(playerid,"/oamtls");
    }
    }
    return 1;
    }
    MfG xAdy

  • if(newkeys == (KEY_CROUCH))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(Sirene[playerid] = false)
    {
    Sirene[playerid] = true;
    new vehicle = GetPlayerVehicleID(playerid);
    Sirenen[0] = CreateObject(18646,0,0,0,0,0,0);
    AttachObjectToVehicle(Sirenen[0],vehicle, -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
    }
    else
    {
    DestroyObject(Sirenen[0]);
    Sirene[playerid] = false;
    }
    {

    Was fällt auf?

  • Die Klammerpaare sind nicht gleich?
    if(newkeys == (KEY_CROUCH))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(Sirene[playerid] = false)
    {
    Sirene[playerid] = true;
    new vehicle = GetPlayerVehicleID(playerid);
    Sirenen[0] = CreateObject(18646,0,0,0,0,0,0);
    AttachObjectToVehicle(Sirenen[0],vehicle, -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
    }
    else
    {
    DestroyObject(Sirenen[0]);
    Sirene[playerid] = false;
    }
    }
    }

  • Hmmm Notepad zeigt nix an ^^ kannst dus mal koriegieren und einfügen xD pls
    MfG xADy

  • Wo kan ich nun die "Z" Cord ändern?



    (objectid, vehicleid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:RotZ)



    objectid The objectid you want to attach to the vehicle.
    vehicleid The vehicledid which is linked with the object.
    Float:OffsetX The distance between the vehicle and the object in the X direction.
    Float:OffsetY The distance between the vehicle and the object in the Y direction.
    Float:OffsetZ The distance between the vehicle and the object in the Z direction.
    Float:RotX The X rotation between the object and the vehicle.
    Float:RotY The Y rotation between the object and the vehicle.
    Float:RotZ The Z rotation between the object and the vehicle.

    Quelle: http://wiki.sa-mp.com/wiki/AttachObjectToVehicle

  • hmmm
    ich bekomme folgende errors:


    J:\GTA SA\Script0.3c\pawno\Aktuell.pwn(5946) : error 017: undefined symbol "Sirene"
    J:\GTA SA\Script0.3c\pawno\Aktuell.pwn(5946) : error 001: expected token: ";", but found "]"
    J:\GTA SA\Script0.3c\pawno\Aktuell.pwn(5946) : error 029: invalid expression, assumed zero
    J:\GTA SA\Script0.3c\pawno\Aktuell.pwn(5946) : fatal error 107: too many error messages on one line


    was denn falsch?

  • Sowas passiert bei C&P xD



    Im Header bereich


    new Sirene[1];

  • Ich blick jetzt irgendwie nichts mehr bei dem Thread kann mir jemand vll das richtige schicken das es auch klappt und nur cops dies machen können?

  • danke für die Antorten, habe das Problem selber behoben, so nun habe ich andere Errors:


    J:\GTA SA\Script 0.3c\pawno\Aktuell.pwn(3207) : warning 235: public function lacks forward declaration (symbol "IsASirenenCar")
    J:\GTA SA\Script 0.3c\pawno\Aktuell.pwn(5961) : error 017: undefined symbol "carid"
    J:\GTA SA\Script 0.3c\pawno\Aktuell.pwn(5963) : warning 211: possibly unintended assignment


    Hier der Quelltext:


    if(newkeys == (KEY_CROUCH))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(IsASirenenCar(carid))
    {
    if(Sirene[playerid] = false)
    {
    Sirene[playerid] = true;
    new vehicle = GetPlayerVehicleID(playerid);
    Sirenen[0] = CreateObject(18646,0,0,0,0,0,0);
    AttachObjectToVehicle(Sirenen[0],vehicle, -0.5, -0.2, 0.8, 2.0, 2.0, 3.0);
    }
    else
    {
    DestroyObject(Sirenen[0]);
    Sirene[playerid] = false;
    }
    }
    }
    }


    ____________________
    Und der hier:


    public IsASirenenCar(carid)
    {
    for(new i = 0; i < sizeof(SirenenCar); i++)
    {
    if(carid == SirenenCar)
    {
    SetVehicleHealth(carid,3000.0);
    return 1;
    }
    }
    return 0;
    }



    Was ist der Fehler?

  • Hey ich hab n problem s funktioniert zwar alles mehr oder weniger aber wenn ich einmal die sirene entferne dann kann ich keine mehr aufs auto machen was hab ich falsch bekomm keine errors...
    public OnPlayerCommandText(playerid, cmdtext[])
    {


    //sirene
    if(strcmp(cmdtext,"/san", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    new vehicle = GetPlayerVehicleID(playerid);
    if(IsACop(playerid))
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 415)
    {
    AttachObjectToVehicle(sirene,vehicle, -0.5, 0, 0.60,0,0, 0);
    SendClientMessage(playerid, COLOR_RED, "Du hast eine Sirene an einen Cheetah angebracht");


    }
    else if(IsACop(playerid))
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 432)
    {
    AttachObjectToVehicle(sirene,vehicle, -0.5, 0, 2, 0,0,0);
    SendClientMessage(playerid, COLOR_RED, "Du hast eine Sirene an einen Panzer angebracht");

    }
    else if(IsACop(playerid))
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 433)
    {
    AttachObjectToVehicle(sirene,vehicle, -0.5, 0, 0.70,0,0, 0);
    SendClientMessage(playerid, COLOR_RED, "Du hast eine Sirene an einen Barrack angebracht");

    }
    else if(IsACop(playerid))
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 451)
    {
    AttachObjectToVehicle(sirene,vehicle, -0.5, 0, 0.60,0,0, 0);
    SendClientMessage(playerid, COLOR_RED, "Du hast eine Sirene an einen Turismo angebracht");

    }
    else if(IsACop(playerid))
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 522)
    {
    AttachObjectToVehicle(sirene,522, -0.5, 0, 0.70, 0,0,0);
    SendClientMessage(playerid, COLOR_RED, "Du hast eine Sirene an eine NRG angebracht");

    }
    else if(IsACop(playerid))
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 541)
    {
    AttachObjectToVehicle(sirene,vehicle, -0.5, 0, 0.70, 0,0,0);
    SendClientMessage(playerid, COLOR_RED, "Du hast eine Sirene an einen Bullet angebracht");

    }
    else if(IsACop(playerid))
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 560)
    {
    AttachObjectToVehicle(sirene,vehicle, -0.5, 0, 0.70, 0,0,0);
    SendClientMessage(playerid, COLOR_RED, "Du hast eine Sirene an einen Sultan angebracht");


    }
    else
    SendClientMessage(playerid, COLOR_RED, "Du Hast nicht das recht den befehl zu benutzen oder sitz in keinem auto aufdem eine sirene platz hat");
    return 1;
    }
    }
    if(strcmp(cmdtext,"/saus",true) == 0)
    {
    if(IsACop(playerid))
    DestroyObject(sirene);
    SendClientMessage(playerid, COLOR_RED, "Du hast die Sirene entfernt");
    return 1;
    }