Garage Exit System

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
  • Wenn ich den befehl /exitgarage eintippe dann falle ich durch die map.. Woran kann das liegen?


    if(strcmp(cmd, "/exitgarage", true) == 0 || strcmp(cmd, "/exitga", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    new Seat[MAX_PLAYERS], InCar[MAX_PLAYERS];
    new i = GetPlayerVirtualWorld(playerid), vehicleid;
    if(i == 0) return SendClientMessage(playerid, GREY, "You are not inside a garage.");
    if(GarageInfo[i][GarageLocked]) return SendClientMessage(playerid, GREY, "You've been locked inside the garage, tough luck.");
    if(IsPlayerInRangeOfPoint(playerid, 30.0, GarageInfo[i][GarageInsideX], GarageInfo[i][GarageInsideY], GarageInfo[i][GarageInsideZ]) && GetPlayerVirtualWorld(playerid) == i)
    {
    if(GetPlayerState(playerid) == 2)
    {
    vehicleid = GetPlayerVehicleID(playerid);
    for(new j = 0; j < MAX_PLAYERS; j++)
    {
    if(IsPlayerInVehicle(j, vehicleid))
    {
    InCar[j] = vehicleid;
    Seat[j] = GetPlayerVehicleSeat(playerid);
    SetPlayerInterior(j, 0);
    SetPlayerVirtualWorld(j, 0);
    SetPVarInt(j, "InGarage", 0);
    }
    }
    SetVehiclePos(vehicleid, GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ]);
    SetVehicleZAngle(vehicleid, GarageInfo[i][GarageExitA]);
    SetVehicleWorld(vehicleid, 0);
    SetVehicleInterior(vehicleid, 0);
    }
    SetPlayerPosEx(playerid, GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ]);
    SetPlayerFacingAngle(playerid, GarageInfo[i][GarageExitA]);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid, 0);
    if(vehicleid != 0)
    {
    for (new j = 0; j < MAX_PLAYERS; j++)
    {
    if (InCar[j] == 0) continue;
    if (InCar[j] == vehicleid)
    {
    PutPlayerInVehicle(j, vehicleid, Seat[j]);
    }
    }
    PutPlayerInVehicle(playerid, vehicleid, 0);
    }
    SetPVarInt(playerid, "InGarage", 0);
    return 1;
    }
    else
    {
    SendClientMessage(playerid, GREY, "You are not near a garage exit.");
    return 1;
    }
    }
    return 1;
    }

  • Dann poste bitte mal was im Server Log steht, wenn du es so schreibst und den Befehl dann eingibst:
    if(strcmp(cmd, "/exitgarage", true) == 0 || strcmp(cmd, "/exitga", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    new Seat[MAX_PLAYERS], InCar[MAX_PLAYERS];
    new i = GetPlayerVirtualWorld(playerid), vehicleid;
    if(i == 0) return SendClientMessage(playerid, GREY, "You are not inside a garage.");
    if(GarageInfo[i][GarageLocked]) return SendClientMessage(playerid, GREY, "You've been locked inside the garage, tough luck.");
    if(IsPlayerInRangeOfPoint(playerid, 30.0, GarageInfo[i][GarageInsideX], GarageInfo[i][GarageInsideY], GarageInfo[i][GarageInsideZ]) && GetPlayerVirtualWorld(playerid) == i)
    {
    if(GetPlayerState(playerid) == 2)
    {
    vehicleid = GetPlayerVehicleID(playerid);
    for(new j = 0; j < MAX_PLAYERS; j++)
    {
    if(IsPlayerInVehicle(j, vehicleid))
    {
    InCar[j] = vehicleid;
    Seat[j] = GetPlayerVehicleSeat(playerid);
    SetPlayerInterior(j, 0);
    SetPlayerVirtualWorld(j, 0);
    SetPVarInt(j, "InGarage", 0);
    }
    }
    SetVehiclePos(vehicleid, GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ]);
    SetVehicleZAngle(vehicleid, GarageInfo[i][GarageExitA]);
    SetVehicleWorld(vehicleid, 0);
    SetVehicleInterior(vehicleid, 0);
    }
    printf("Position: %f / %f / %f / %f", GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ], GarageInfo[i][GarageExitA]);
    SetPlayerPosEx(playerid, GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ]);
    SetPlayerFacingAngle(playerid, GarageInfo[i][GarageExitA]);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid, 0);
    if(vehicleid != 0)
    {
    for (new j = 0; j < MAX_PLAYERS; j++)
    {
    if (InCar[j] == 0) continue;
    if (InCar[j] == vehicleid)
    {
    PutPlayerInVehicle(j, vehicleid, Seat[j]);
    }
    }
    PutPlayerInVehicle(playerid, vehicleid, 0);
    }
    SetPVarInt(playerid, "InGarage", 0);
    return 1;
    }
    else
    {
    SendClientMessage(playerid, GREY, "You are not near a garage exit.");
    return 1;
    }
    }
    return 1;
    }

  • soweit nix..
    Steht nur das ich den Befehl ausgeführt hab..
    [00:18:39] [cmd] [Max_Mustermann] /exitgarage
    Manchmal flieg ich durch die Map und Manchmal spawn ich am 0 Punkt also sprich am Bauernhof da

  • Wenn du den Befehl eingibst, dann sollte der print eigentlich kommen, sonst würde SetPlayerPos nicht aufgerufen werden, somit würdest du auch nicht teleportiert werden.
    Sicher, dass du den Code kompiliert hast, und den Server neu gestartet hast?