Command /acar doesn't seem to work well.
#9

If the coordinates has been stored to the array (and the correct index) then it should've set the vehicle's position.

When you respawn vehicles, they go back to the place where they were created. I also added a check about being driver to use the command. Do some debugging:
pawn Код:
CMD:acar(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_REDD, "[ERROR] You do not have the right's to use this command!");
    if (isnull(params)) return SendClientMessage(playerid, COLOR_LGREEN, "[USAGE]{ffffff} /acar [park/help/etc]");
    if (!strcmp(params, "help", true))
    {
        SendClientMessage(playerid, COLOR_LGREEN, "/acar help {ffffff}- List of /acar commands");
        SendClientMessage(playerid, COLOR_LGREEN, "/acar park {ffffff}- Park the vehicle you are in!");
    }
    else if (!strcmp(params, "park", true))
    {
        if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_REDD, "You need to be driver");
        new vehicle, Float:x, Float:y, Float:z, Float:angle;
        vehicle = GetPlayerVehicleID(playerid);
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, angle);
        VehicleInfo[vehicle][vX] = x;
        VehicleInfo[vehicle][vY] = y;
        VehicleInfo[vehicle][vZ] = z;
        VehicleInfo[vehicle][vA] = angle;
        printf("park -> vehicle: %i | X: %f | Y: %f | Z: %f | A: %f", vehicle, x, y, z, angle);
        SaveVehicle(vehicle);
        SetTimerEx("loadcar", 1000, false, "i", vehicle);
        SetPlayerPos(playerid, x, y, z+3);
        SendClientMessage(playerid, COLOR_LGREEN, "[Acar]{ffffff} Vehicle parked!");
    }
    else SendClientMessage(playerid, COLOR_LGREEN, "Use:{ffffff} /acar help for more info!");
    return 1;
}
and
pawn Код:
forward loadcar(i);
public loadcar(i)
{
    printf("loadcar -> vehicle: %i | X: %f | Y: %f | Z: %f", i, VehicleInfo[i][vX], VehicleInfo[i][vY], VehicleInfo[i][vZ]);
    SetVehiclePos(i, VehicleInfo[i][vX], VehicleInfo[i][vY], VehicleInfo[i][vZ]);
}
Do they both print the same coordinates and vehicleid?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)