Need SetCameraInFrontOfPlayer
#1

hey guys, I need the stock SetCameraInFrontOfPlayer. (The opposite from the function SetCameraBehindPlayer(playerid).

Thanks.
Reply
#2

You mean this?
pawn Код:
stock SetCameraInFrontOfPlayer(PlayerID, Float: Distance = 2.5, Float: Lift = 0.5) {
    if(IsPlayerConnected(PlayerID)) return false;
   
    new Float: X,
        Float: Y,
        Float: Z,
        Float: A;
    GetPlayerPos(PlayerID, X, Y, Z);
    if(IsPlayerInAnyVehicle(PlayerID)) {
        GetVehicleZAngle(GetPlayerVehicleID(PlayerID), A);
    } else {
        GetPlayerFacingAngle(PlayerID, A);
    }
    // GetPlayerPosition(PlayerID, W, I, X, Y, Z, A);

    SetPlayerCameraLookAt(playerid, X, Y, Z);

    // Credits to ****** for the GetXYInFrontOfPlayer function.
    X += (Distance * floatsin(-A, degrees));
    Y += (Distance * floatcos(-A, degrees));

    SetPlayerCameraPos(playerid, X, Y, (Z + Lift));
    return true;
}
EDIT: Credits to TheLazySloth.
Reply
#3

Quote:
Originally Posted by Stuffs
Посмотреть сообщение
You mean this?
pawn Код:
stock SetCameraInFrontOfPlayer(PlayerID, Float: Distance = 2.5, Float: Lift = 0.5) {
    if(IsPlayerConnected(PlayerID)) return false;
   
    new Float: X,
        Float: Y,
        Float: Z,
        Float: A;
    GetPlayerPos(PlayerID, X, Y, Z);
    if(IsPlayerInAnyVehicle(PlayerID)) {
        GetVehicleZAngle(GetPlayerVehicleID(PlayerID), A);
    } else {
        GetPlayerFacingAngle(PlayerID, A);
    }
    // GetPlayerPosition(PlayerID, W, I, X, Y, Z, A);

    SetPlayerCameraLookAt(playerid, X, Y, Z);

    // Credits to ****** for the GetXYInFrontOfPlayer function.
    X += (Distance * floatsin(-A, degrees));
    Y += (Distance * floatcos(-A, degrees));

    SetPlayerCameraPos(playerid, X, Y, (Z + Lift));
    return true;
}
EDIT: Credits to TheLazySloth.
yes, but this stock not working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)