Advertisement
Meta__

OnPlayerCamera ... v0.1b

Mar 12th, 2012
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.84 KB | None | 0 0
  1. /*=========================================================*\
  2. |                                                           |
  3. |   OnPlayerCameraMoved & OnPlayerCameraLookMoved by Meta   |
  4. |                                                           |
  5. \*=========================================================*/
  6.  
  7. forward OnPlayerCameraMoved(playerid, Float:FromX, Float:FromY, Float:FromZ, Float:ToX, Float:ToY, Float:ToZ, time, cut);
  8. stock OnPlayerCameraMoved_SYS(playerid, Float:FromX, Float:FromY, Float:FromZ, Float:ToX, Float:ToY, Float:ToZ, time, cut)
  9. {
  10.     DeletePVar(playerid, "InterpolateCameraPosTimer");
  11.     if(funcidx("OnPlayerCameraMoved_SYS") != -1)
  12.     {
  13.         CallLocalFunction("OnPlayerCameraMoved", "dffffffdd", playerid, FromX, FromY, FromZ, ToX, ToY, ToZ, time, cut);
  14.     }
  15. }
  16.  
  17. #if defined _ALS_OnPlayerCameraMoved_SYS
  18.     #undef OnPlayerCameraMoved_SYS
  19. #else
  20.     #define _ALS_OnPlayerCameraMoved_SYS
  21. #endif
  22. #define OnPlayerCameraMoved_SYS OnPlayerCameraMoved
  23.  
  24. forward OnPlayerCameraLookMoved(playerid, Float:FromX, Float:FromY, Float:FromZ, Float:ToX, Float:ToY, Float:ToZ, time, cut);
  25. stock OnPlayerCameraLookMoved_SYS(playerid, Float:FromX, Float:FromY, Float:FromZ, Float:ToX, Float:ToY, Float:ToZ, time, cut)
  26. {
  27.     DeletePVar(playerid, "InterpolateCameraLookAtTimer");
  28.     if(funcidx("OnPlayerCameraMoved_SYS") != -1)
  29.     {
  30.         CallLocalFunction("OnPlayerCameraLookMoved", "dffffffdd", playerid, FromX, FromY, FromZ, ToX, ToY, ToZ, time, cut);
  31.     }
  32. }
  33.  
  34. stock InterpolateCameraPosEx(playerid, Float:FromX, Float:FromY, Float:FromZ, Float:ToX, Float:ToY, Float:ToZ, time, cut = CAMERA_CUT)
  35. {
  36.     if(GetPVarType(playerid, "InterpolateCameraPosTimer"))
  37.     {
  38.         KillTimer(GetPVarInt(playerid, "InterpolateCameraPosTimer"));
  39.     }
  40.     InterpolateCameraPos(playerid, FromX, FromY, FromZ, ToX, ToY, ToZ, time, cut);
  41.     SetPVarInt(playerid, "InterpolateCameraPosTimer", SetTimerEx("OnPlayerCameraMoved", time, 0, "dffffffdd", playerid, FromX, FromY, FromZ, ToX, ToY, ToZ, time, cut));
  42. }
  43.  
  44. #if defined _ALS_InterpolateCameraPos
  45.     #undef InterpolateCameraPos
  46. #else
  47.     #define _ALS_InterpolateCameraPos
  48. #endif
  49. #define InterpolateCameraPos InterpolateCameraPosEx
  50.  
  51. stock InterpolateCameraLookAtEx(playerid, Float:FromX, Float:FromY, Float:FromZ, Float:ToX, Float:ToY, Float:ToZ, time, cut = CAMERA_CUT)
  52. {
  53.     if(GetPVarType(playerid, "InterpolateCameraLookAtTimer"))
  54.     {
  55.         KillTimer(GetPVarInt(playerid, "InterpolateCameraLookAtTimer"));
  56.     }
  57.     InterpolateCameraLookAt(playerid, FromX, FromY, FromZ, ToX, ToY, ToZ, time, cut);
  58.     SetPVarInt(playerid, "InterpolateCameraLookAtTimer", SetTimerEx("OnPlayerCameraLookMoved", time, 0, "dffffffdd", playerid, FromX, FromY, FromZ, ToX, ToY, ToZ, time, cut));
  59. }
  60.  
  61. #if defined _ALS_InterpolateCameraLookAt
  62.     #undef InterpolateCameraLookAt
  63. #else
  64.     #define _ALS_InterpolateCameraLookAt
  65. #endif
  66. #define InterpolateCameraLookAt InterpolateCameraLookAtEx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement