CAM1 CAM2 CAM3 CAM4 CAM5
else
{
ShowRegisterScreen(playerid);
pinfo[playerid][Banned] = 0;
CameraMovement[playerid] = 1;
ConnectionCamera[playerid] = SetTimerEx("ConnectionCameraMovement", 1000, 0, "i", playerid);
}
function ConnectionCameraMovement(playerid)
{
TogglePlayerSpectating(playerid, 1);
switch(CameraMovement[playerid])
{
case 1:
{
SendClientMessage(playerid, -1, "CAM1");
InterpolateCameraPos(playerid, 1977.940917, -1753.394165, 15.710048, 1683.647583, -1725.149780, 15.520676, 13000);
InterpolateCameraLookAt(playerid, 1972.946899, -1753.489624, 15.485646, 1688.493530, -1726.381225, 15.500365, 2000);
ConnectionCamera[playerid] = SetTimerEx("ConnectionCameraMovement", 15000, false, "i", playerid);
CameraMovement[playerid] = 2;
}
case 2:
{
SendClientMessage(playerid, -1, "CAM2");
InterpolateCameraPos(playerid, 905.286132, -1403.625976, 15.154844, 1353.317626, -1404.655395, 15.989136, 10000);
InterpolateCameraLookAt(playerid, 910.276306, -1403.326171, 15.062310, 1349.223632, -1401.786621, 15.892268, 2000);
ConnectionCamera[playerid] = SetTimerEx("ConnectionCameraMovement", 12000, false, "i", playerid);
CameraMovement[playerid] = 3;
}
case 3:
{
SendClientMessage(playerid, -1, "CAM3");
InterpolateCameraPos(playerid, 1584.561767, -1731.501708, 14.498149, 1334.697753, -1722.911621, 15.104587, 10000);
InterpolateCameraLookAt(playerid, 1579.567993, -1731.750732, 14.477837, 1338.359619, -1726.315917, 15.058754, 2000);
KillTimer(ConnectionCamera[playerid]);
ConnectionCamera[playerid] = SetTimerEx("ConnectionCameraMovement", 12000, false, "i", playerid);
CameraMovement[playerid] = 4;
}
case 4:
{
SendClientMessage(playerid, -1, "CAM4");
InterpolateCameraPos(playerid, 165.131668, -1885.581787, 1.454522, 636.477600, -1918.955688, 5.688834, 10000);
InterpolateCameraLookAt(playerid, 170.110122, -1885.167968, 1.663836, 631.661071, -1917.679565, 5.273429, 2000);
ConnectionCamera[playerid] = SetTimerEx("ConnectionCameraMovement", 12000, false, "i", playerid);
CameraMovement[playerid] = 5;
}
case 5:
{
SendClientMessage(playerid, -1, "CAM5");
InterpolateCameraPos(playerid, 1828.909790, -1602.995971, 13.485791, 1857.642089, -1431.320312, 16.744033, 10000);
InterpolateCameraLookAt(playerid, 1825.495117, -1599.407348, 14.165193, 1852.764038, -1432.402221, 16.557880, 2000);
ConnectionCamera[playerid] = SetTimerEx("ConnectionCameraMovement", 12000, false, "i", playerid);
CameraMovement[playerid] = 1;
}
}
return 1;
}
// Initialize
TogglePlayerSpectating(playerid, true);
CameraMovement[playerid] = 0;
KillTimer(ConnectionCamera[playerid]);
ConnectionCamera[playerid] = SetTimerEx("ConnectionCameraMovement", 1000, true, "i", playerid);
// Function
forward ConnectionCameraMovement(playerid);
public ConnectionCameraMovement(playerid)
{
switch(CameraMovement[playerid])
{
case 0:
{
InterpolateCameraPos(playerid, 1977.940917, -1753.394165, 15.710048, 1683.647583, -1725.149780, 15.520676, 13000);
InterpolateCameraLookAt(playerid, 1972.946899, -1753.489624, 15.485646, 1688.493530, -1726.381225, 15.500365, 2000);
CameraMovement[playerid] ++;
}
case 1:
{
InterpolateCameraPos(playerid, 905.286132, -1403.625976, 15.154844, 1353.317626, -1404.655395, 15.989136, 10000);
InterpolateCameraLookAt(playerid, 910.276306, -1403.326171, 15.062310, 1349.223632, -1401.786621, 15.892268, 2000);
CameraMovement[playerid] ++;
}
case 2:
{
InterpolateCameraPos(playerid, 1584.561767, -1731.501708, 14.498149, 1334.697753, -1722.911621, 15.104587, 10000);
InterpolateCameraLookAt(playerid, 1579.567993, -1731.750732, 14.477837, 1338.359619, -1726.315917, 15.058754, 2000);
CameraMovement[playerid] ++;
}
case 3:
{
InterpolateCameraPos(playerid, 165.131668, -1885.581787, 1.454522, 636.477600, -1918.955688, 5.688834, 10000);
InterpolateCameraLookAt(playerid, 170.110122, -1885.167968, 1.663836, 631.661071, -1917.679565, 5.273429, 2000);
CameraMovement[playerid] ++;
}
default:
{
InterpolateCameraPos(playerid, 1828.909790, -1602.995971, 13.485791, 1857.642089, -1431.320312, 16.744033, 10000);
InterpolateCameraLookAt(playerid, 1825.495117, -1599.407348, 14.165193, 1852.764038, -1432.402221, 16.557880, 2000);
CameraMovement[playerid] = 0;
}
}
return 1;
}
You could try using break; at the end of every case... Not sure I pawn but it helped me in c++ / java.
|
You could rewrite your code to something like below:
pawn Код:
Also, note that interpolate functions aren't fully accurate in terms of working. They do not always move your camera. You could replace its usage for SetPlayerCameraLookAt, using CAMERA_MOVE in the cut parameter, but you'd be sacrificing the control over time. |
Sorry for double post but it didn't really work out like that.. it just shows only one moving camera again.. it is just a different one this time.
|