SA-MP Forums Archive
Camera moves smoothly to the request class place - 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: Camera moves smoothly to the request class place (/showthread.php?tid=342318)



Camera moves smoothly to the request class place - pasha97 - 13.05.2012

New 0.3e function interpolatecamerapos and interpolatecameralookat are nice and usefull. But if you add them instead of old SetCameraPos and SetCameraLookAt in OnPlayerRequestClass camera moves from one place to another each time you switch class, but many people want camera to move to request class place one time and not to move when you choose class. I found a decicion:

PHP код:
new isreq[MAX_PLAYERS];
forward isreqtimer(playerid);
public 
OnPlayerRequestClass(playeridclassid)
{
    if(
isreq[playerid] == 0)
    {
    
InterpolateCameraPos(playerid2362.0256, -2658.9897101.20322108.0005, -2411.199716.31321500CAMERA_MOVE);
    
InterpolateCameraLookAt(playerid2042.0256, -2595.989760.20322107.0256, -2410.989716.20322000CAMERA_MOVE);
    
SetPlayerTimer("isreqtimer"100);
    }
    return 
1;
}
public 
OnPlayerRequestSpawn(playerid)
{
    
isreq[playerid] = 0;
return 
1;