[Include] nCamera - Simple Moving Camera Functionality
#1

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
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)