SA-MP Forums Archive
InCar Camera View... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: InCar Camera View... (/showthread.php?tid=302511)



InCar Camera View... - Mrki_Drakula - 09.12.2011

Is this possible? I mean when you enter in the car it automatically switch the camera to incar view....And if its possible, on what way, i mean how can i do that. I just don't have idea on what way to do that.
Is there any CameraFollowPlayer or SetPlayerCameraPosThenFollow function?


Re: InCar Camera View... - KingHual - 09.12.2011

Make a timer with interval of 50 ms. and put "setplayercamerapos" inside it


Re: InCar Camera View... - Mrki_Drakula - 09.12.2011

I dont get it..i place SetPlayerCameraPos in car and then SetCameraFacingAngle, but how i can make that camera follow the car

-EDIT- I got an idea..


Re: InCar Camera View... - KingHual - 09.12.2011

Like i said, use a timer


Re: InCar Camera View... - Mrki_Drakula - 09.12.2011

Let me do something..gonna check


Re: InCar Camera View... - Mrki_Drakula - 09.12.2011

Doesn't work...can someone make a quick script for this?


Re: InCar Camera View... - MadeMan - 09.12.2011

pawn Код:
public UpdateCarCamera()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInAnyVehicle(i))
            {
                new vehicleid = GetPlayerVehicleID(i);
                new Float:x, Float:y, Float:z, Float:angle;
                GetVehiclePos(vehicleid, x, y, z);
                z += 0.5;
                SetPlayerCameraPos(i, x, y, z);
                GetVehicleZAngle(vehicleid, angle);
                x += floatsin(-angle, degrees);
                y += floatcos(-angle, degrees);
                SetPlayerCameraLookAt(i, x, y, z);
            }
        }
    }
}
pawn Код:
SetTimer("UpdateCarCamera", 100, true);



Re: InCar Camera View... - Mrki_Drakula - 09.12.2011

is it just me or its not working...let me check...but when i put it then commands aren't working...any of them.


Re: InCar Camera View... - MadeMan - 09.12.2011

Put the SetTimer in OnGameModeInit.


Re: InCar Camera View... - Mrki_Drakula - 09.12.2011

Its working. But lags like a shit.