Moving camera help
#1

Hi guys this is my first post ever in samp forums.
Am an avrage scripter and i need some help with moving camera
SUBJECT
In Normal class sections when you press next or proceed to next team the camera cuts and switchs to the other place
So what i want is when you proceed an other team the camera travles showing the way meaning that it won't cut (sorry if you didn't get it)
If there is already a tuto or a script for this give me link please.
Thanks for reading
Reply
#2

You are talking about the function InterpolateCameraPos.

https://sampwiki.blast.hk/wiki/InterpolateCameraPos

This function was added in 0.3e, you can also use InterpolateCameraLookAt

Use this under OnPlayerRequestClass.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
        InterpolateCameraPos(playerid, X, Y, Z...
        //etc. code continues...
Read this thread for a more detailed version:
https://sampforum.blast.hk/showthread.php?tid=378307
Reply
#3

Thanks for the code thats exactly what i meant but when i tried it , it wouldn't work properly
Here is the class section code if you could help me
//====================================
case 0:
{
gTeam[playerid] = TEAM_1;
SetPlayerCameraPos(playerid, 35.9920,1884.5764,42.3456);
SetPlayerCameraLookAt(playerid, 35.9920,1884.5764,42.3456);

}

case 1:
{
gTeam[playerid] = TEAM_2;
SetPlayerCameraPos(playerid,439.6949,2440.1316,52. 3627);
SetPlayerCameraLookAt(playerid,344.9974,2529.0916, 24.7922);

}
case 2:
{
gTeam[playerid] = TEAM_3;
SetPlayerCameraPos(playerid,-516.0133,2197.3232,107.2081);
SetPlayerCameraLookAt(playerid,-386.4378,2223.5171,69.1000);

}
case 3:
{
gTeam[playerid] = TEAM_4;
SetPlayerCameraPos(playerid,-1506.0865,2402.5066,96.2128 );
SetPlayerCameraLookAt(playerid,-1505.4207,2576.4299,77.2175);

}
case 4:
{
gTeam[playerid] = TEAM_5;
SetPlayerCameraPos(playerid,-889.5547,1669.2301,46.0407);
SetPlayerCameraLookAt(playerid,-815.8898,1628.3547,39.4258 );

}
Reply
#4

Try this:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerCameraPos(playerid, x, y, z);
    new Float:X, Float:Y, Float:Z;
    GetPlayerCameraFrontVector(playerid, X, Y, Z);
    TogglePlayerSpectating(playerid, 1);
    switch(classid)
    {
        case 0:
        {
            gTeam[playerid] = TEAM_1;
            InterpolateCameraPos(playerid, x, y, z, 35.9920,1884.5764,42.3456, 5000, CAMERA_MOVE);
            InterpolateCameraLookAt(playerid, X, Y, Z, 35.9920,1884.5764,42.3456, 5000, CAMERA_MOVE);
        }
        case 1:
        {
            gTeam[playerid] = TEAM_2;
            InterpolateCameraPos(playerid, x, y, z, 439.6949,2440.1316,52.3627, 5000, CAMERA_MOVE);
            InterpolateCameraLookAt(playerid, X, Y, Z, 344.9974,2529.0916, 24.7922, 5000, CAMERA_MOVE);
        }
        case 2:
        {
            gTeam[playerid] = TEAM_3;
            InterpolateCameraPos(playerid, x, y, z, -516.0133,2197.3232,107.2081, 5000, CAMERA_MOVE);
            InterpolateCameraLookAt(playerid, X, Y, Z, -386.4378,2223.5171,69.1000, 5000, CAMERA_MOVE);
        }
        case 3:
        {
            gTeam[playerid] = TEAM_4;
            InterpolateCameraPos(playerid, x, y, z, -1506.0865,2402.5066,96.2128, 5000, CAMERA_MOVE);
            InterpolateCameraLookAt(playerid, X, Y, Z, -1505.4207,2576.4299,77.2175, 5000, CAMERA_MOVE);
        }
        case 4:
        {
            gTeam[playerid] = TEAM_5;
            InterpolateCameraPos(playerid, x, y, z, -889.5547,1669.2301,46.0407, 5000, CAMERA_MOVE);
            InterpolateCameraLookAt(playerid, X, Y, Z, -815.8898,1628.3547,39.4258, 5000, CAMERA_MOVE);
        }
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    TogglePlayerSpectating(playerid, 0);
    SetCameraBehindPlayer(playerid);
    return 1;
}
Reply
#5

I removed TogglePlayerSpectating(playerid, 1); and TogglePlayerSpectating(playerid, 0); And now its working awesomely
Thanks!!+rep
Reply
#6

I added those lines because I thought you might have needed to stream in objects when moving camera positions. But good to hear it anyway
Reply
#7

Btw is there any way vehicules can be shown in class section?
Reply
#8

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
Btw is there any way vehicules can be shown in class section?
yes the players need to be put into the vehicle and then removed !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)