Abfragen ob Vehicle an einer bestimmten position steht

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
  • Was ist jetzt hier Falsch?:
    if(tx == floatround(1424.5999756) && ty == floatround(974.2999878) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz); }
    else if(tx == floatround(1461.8000488) && ty == floatround(974.0999756) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz); }
    else if(tx == floatround(1424.5999756) && ty == floatround(974.2000122) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz); }
    else if(tx == floatround(1469.5000000) && ty == floatround(1038.9000244) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz); }
    else if(tx == floatround(1469.6992188) && ty == floatround(1029.5996094) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz); }
    else if(tx == floatround(1469.5999756) && ty == floatround(1067.0000000) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz); }
    Selfmade.pwn(10430) : warning 202: number of arguments does not match definition
    Selfmade.pwn(10431) : warning 202: number of arguments does not match definition
    Selfmade.pwn(10432) : warning 202: number of arguments does not match definition
    Selfmade.pwn(10433) : warning 202: number of arguments does not match definition
    Selfmade.pwn(10434) : warning 202: number of arguments does not match definition
    Selfmade.pwn(10435) : warning 202: number of arguments does not match definition

  • Zitat

    SetPlayerCheckpoint(playerid,tx,ty,tz); }

    :O Was sehe ich? Du hast die größe des Checkpoints am Ende vergessen!
    SetPlayerCheckpoint(playerid,tx,ty,tz,4); }//Mach einfach überall am ende die größe des checkpoints rein!

  • for(new i = 0; i < MAX_VEHICLES; i++)
    {
    if(IsATrailer(i))
    {
    new Float:tx, Float:ty, Float:tz;
    GetVehiclePos(i,tx,ty,tz);
    if(tx == floatround(1424.5999756) && ty == floatround(974.2999878) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz,10); }
    if(tx == floatround(1461.8000488) && ty == floatround(974.0999756) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz,10); }
    if(tx == floatround(1424.5999756) && ty == floatround(974.2000122) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz,10); }
    if(tx == floatround(1469.5000000) && ty == floatround(1038.9000244) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz,10); }
    if(tx == floatround(1469.6992188) && ty == floatround(1029.5996094) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz,10); }
    if(tx == floatround(1469.5999756) && ty == floatround(1067.0000000) && tz == floatround(10.8999996)){ SetPlayerCheckpoint(playerid,tx,ty,tz,10); }
    else{SendClientMessage(playerid,COLOR_GREY," Momentan sind keine Anhänger frei."); return 1;}
    }
    }


    Wieso kommt jetzt das kein Anhänger frei obwohl alle an ihren positionen stehen?

  • Das liegt dann an der Positionsabfrage, da diese dann genau den angegebenen Werten gleichen müsste, was quasi unmöglich ist.


    GetVehicleDistanceFromPoint nutzen!

    the ones who are crazy enough to think that they can change the world, are the ones who do
    - Steve Jobs

  • Ich mach es dir, kein Bock zu erklären, vll. verstehst du es ja, wenn es fertig ist.


    /e:
    Bitteschön

    for(new i = 1; i <= MAX_VEHICLES; i++)
    {
    if(IsATrailer(i))
    {
    if(GetVehicleDistanceFromPoint(i, 1424.5999756, 974.2999878, 10.8999996) <= 5){ SetPlayerCheckpoint(playerid,1424.5999756, 974.2999878, 10.8999996,10); }
    else if(GetVehicleDistanceFromPoint(i, 1461.8000488, 974.0999756, 10.8999996) <= 5){ SetPlayerCheckpoint(playerid,1461.8000488, 974.0999756, 10.8999996,10); }
    else if(GetVehicleDistanceFromPoint(i, 1424.5999756, 974.2000122, 10.8999996) <= 5){ SetPlayerCheckpoint(playerid,1424.5999756, 974.2000122, 10.8999996,10); }
    else if(GetVehicleDistanceFromPoint(i, 1469.5000000, 1038.9000244, 10.8999996) <= 5){ SetPlayerCheckpoint(playerid,1469.5000000, 1038.9000244, 10.8999996,10); }
    else if(GetVehicleDistanceFromPoint(i, 1469.6992188, 1029.5996094, 10.8999996) <= 5){ SetPlayerCheckpoint(playerid,1469.6992188, 1029.5996094, 10.8999996,10); }
    else if(GetVehicleDistanceFromPoint(i, 1469.5999756, 1067.0000000, 10.8999996) <= 5){ SetPlayerCheckpoint(playerid,1469.5999756, 1067.0000000, 10.8999996,10); }
    else{SendClientMessage(playerid,COLOR_GREY," Momentan sind keine Anhänger frei."); return 1;}
    }
    }

    the ones who are crazy enough to think that they can change the world, are the ones who do
    - Steve Jobs

    Einmal editiert, zuletzt von ATzeGER_ ()