Blinker System funktioniert nicht, wie es soll.

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 hab ein System gescriptet, welches Blinker erstellt, die sich der Auto Größe anpassen.


    Nun werden die Blinker aber immer im "0-Punkt" des Autos attacht.
    Wie kann man das beheben?

    if(newkeys & KEY_LOOK_LEFT && IsPlayerInAnyVehicle(playerid) && InCar(playerid))
    {
    if(GetPVarInt(playerid, "BlinkerLinks") == -1)
    {
    new blinker1 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    new blinker2 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    new Float:v_x, Float:v_y, Float:v_z;
    GetVehicleModelInfo(GetPlayerVehicleID(playerid), VEHICLE_MODEL_INFO_SIZE, v_x, v_y, v_z);
    new Float:v_ex = v_x/2;
    new Float:v_ey = v_y/2;
    new Float:z1;
    GetVehicleModelInfo(GetPlayerVehicleID(playerid), VEHICLE_MODEL_INFO_REAR_BUMPER_Z, v_x, v_y, z1);
    new Float:z2;
    GetVehicleModelInfo(GetPlayerVehicleID(playerid), VEHICLE_MODEL_INFO_FRONT_BUMPER_Z, v_x, v_y, z2);
    AttachObjectToVehicle(blinker1, GetPlayerVehicleID(playerid), -v_ex, -v_ey, z1, 0.0, 0.0, 0.0);
    AttachObjectToVehicle(blinker2, GetPlayerVehicleID(playerid), -v_ex, v_ey, z2, 0.0, 0.0, 0.0);
    SetPVarInt(playerid, "BlinkerLinks", blinker1);
    SetPVarInt(playerid, "BlinkerLinks2", blinker2);
    } else {
    DestroyObject(GetPVarInt(playerid, "BlinkerLinks"));
    DestroyObject(GetPVarInt(playerid, "BlinkerLinks2"));
    SetPVarInt(playerid, "BlinkerLinks", -1);
    SetPVarInt(playerid, "BlinkerLinks2", -1);
    }
    }

  • Was wird geprintet, wenn du es so debuggst?
    if(newkeys & KEY_LOOK_LEFT && IsPlayerInAnyVehicle(playerid) && InCar(playerid))
    {
    if(GetPVarInt(playerid, "BlinkerLinks") == -1)
    {
    new blinker1 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    new blinker2 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    new Float:v_x, Float:v_y, Float:v_z;
    GetVehicleModelInfo(GetPlayerVehicleID(playerid), VEHICLE_MODEL_INFO_SIZE, v_x, v_y, v_z);
    new Float:v_ex = v_x/2.0;
    new Float:v_ey = v_y/2.0;
    new Float:z1;
    GetVehicleModelInfo(GetPlayerVehicleID(playerid), VEHICLE_MODEL_INFO_REAR_BUMPER_Z, v_x, v_y, z1);
    new Float:z2;
    GetVehicleModelInfo(GetPlayerVehicleID(playerid), VEHICLE_MODEL_INFO_FRONT_BUMPER_Z, v_x, v_y, z2);
    printf("v_x = %f / v_y = %f", v_x, v_y);
    printf("-v_ex = %f / v_ey = %f", -v_ex, v_ey);
    AttachObjectToVehicle(blinker1, GetPlayerVehicleID(playerid), -v_ex, -v_ey, z1, 0.0, 0.0, 0.0);
    AttachObjectToVehicle(blinker2, GetPlayerVehicleID(playerid), -v_ex, v_ey, z2, 0.0, 0.0, 0.0);
    SetPVarInt(playerid, "BlinkerLinks", blinker1);
    SetPVarInt(playerid, "BlinkerLinks2", blinker2);
    }
    else
    {
    DestroyObject(GetPVarInt(playerid, "BlinkerLinks"));
    DestroyObject(GetPVarInt(playerid, "BlinkerLinks2"));
    SetPVarInt(playerid, "BlinkerLinks", -1);
    SetPVarInt(playerid, "BlinkerLinks2", -1);
    }
    }