SA-MP Forums Archive
[Include] nCamera - Simple Moving Camera Functionality - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] nCamera - Simple Moving Camera Functionality (/showthread.php?tid=295764)



nCamera - Simple Moving Camera Functionality - Norn - 07.11.2011

nCamera - Simple Moving Camera Functionality

pawn Код:
forward OnPlayerCameraFinish(playerid); // Callback, calls when the movement has complete.
forward DestroyCameraForPlayer(playerid); // Destroys the camera before a cycle has finished.
forward UpdatePlayerCameraPosition(playerid); // Include only function, no use to scripter.
forward LastCameraPos(playerid, &Float:x, &Float:y, &Float:z); // Returns the last finished movement cam position.
SetCameraPosForPlayer(playerid, Float:startx, Float:starty, Float:startz, Float:endx, Float:endy, Float:endz, Float:speed, bool:sync_surroundings=false, bool:rand_vw=false); // sync_surroundings means it'll set the player near the camera but out of view so everything surrounding loads in high detail, rand_vw if true puts them in a random virtual world until the cycle is complete otherwise players will see the player floating randomly to the camera position.
Example Usage: OnPlayerConnect()
pawn Код:
SetCameraPosForPlayer(playerid, 1812.8744,-1853.0919,13.4141, 1812.4706,-1857.3477,13.4141, 5.0, true);
pawn Код:
public OnPlayerCameraFinish(playerid) {
    new Float:x, Float:y, Float:z;
    switch(S_CAMERA[playerid]) {
        case 0: {
            LastCameraPos(playerid, x, y, z);
            SetCameraPosForPlayer(playerid, x, y, z, 1726.2292,-1857.5374,13.4141, 5.0, true), S_CAMERA[playerid]++;
        }
        case 1: {
            LastCameraPos(playerid, x, y, z);
            SetCameraPosForPlayer(playerid, x, y, z, 1726.1542,-1852.1835,13.4141, 5.0, true), S_CAMERA[playerid]++;
        }
        case 2: {
            LastCameraPos(playerid, x, y, z);
            SetCameraPosForPlayer(playerid, x, y, z, 1812.8744,-1853.0919,13.4141, 5.0, true), S_CAMERA[playerid]++;
        }
        case 3: {
            LastCameraPos(playerid, x, y, z);
            SetCameraPosForPlayer(playerid, x, y, z, 1812.4706,-1857.3477,13.4141, 5.0, true), S_CAMERA[playerid] = 0;
        }
    }
    return true;
}
The above code cycles all of the points.

Download
Download - Pastebin


Re: nCamera - Simple Moving Camera Functionality - FireCat - 07.11.2011

Nice one, Corn!


Re: nCamera - Simple Moving Camera Functionality - iNorton - 07.11.2011

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Nice one, Corn!
lol Corn xD

Like always Norn "splendid" work xD keep on doing them :3 who know what useful script you will make


Re: nCamera - Simple Moving Camera Functionality - dadadaamy - 07.11.2011

Cool! FireCat's Real name is james !


10/10 for the script! Good job norm! or corn or whatever it is..


Re: nCamera - Simple Moving Camera Functionality - FireCat - 07.11.2011

Quote:
Originally Posted by dadadaamy
Посмотреть сообщение
Cool! FireCat's Real name is james !


10/10 for the script! Good job norm! or corn or whatever it is..
ujelly?


Re: nCamera - Simple Moving Camera Functionality - juraska - 08.11.2011

I search something like that, and i found.
Great script Norn!


Re: nCamera - Simple Moving Camera Functionality - Michael@Belgium - 08.11.2011

Good


Re: nCamera - Simple Moving Camera Functionality - playbox12 - 08.11.2011

Good job, I often find lot of people stuck with getting a system similar to work smooth.


Re: nCamera - Simple Moving Camera Functionality - Norn - 08.11.2011

Quote:
Originally Posted by playbox12
Посмотреть сообщение
Good job, I often find lot of people stuck with getting a system similar to work smooth.
I tried a lot to make it work smooth, the smoothest I could find was by creating an invisible player object and setting the camera to follow the object.


Re: nCamera - Simple Moving Camera Functionality - Kar - 13.11.2011

Could you possibly add some way to make a custom angle at the end of endx, endy, endz?