View Single Post
Old 11/08/2011, 06:32 AM   #3
Scenario's Avatar
Join Date: Feb 2010
Location: Heaven
Posts: 7,809
Reputation: 701
Default Re: Set a players camera inside them?

Sure, one command:

pawn Code:

That's a joke. You could use this function and perhaps reverse the coordinates:

pawn Code:
stock SetPlayerCameraInFrontOfPlayer(playerid, Float:distance, Float:heightoffset) // iPLEOMAX
    new Float:P[3];
    GetPlayerPos(playerid, P[0], P[1], P[2]);
    SetPlayerCameraLookAt(playerid, P[0], P[1], P[2]);
    GetXYInFrontOfPlayer(playerid, P[0], P[1], distance);
    SetPlayerCameraPos(playerid, P[0], P[1], P[2]+heightoffset);

stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{                                                 // Created by ******
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid)) { GetVehicleZAngle(GetPlayerVehicleID(playerid), a); }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
Scenario is offline