Advertisement
toribio

toribio

May 14th, 2009
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. public OnFilterScriptInit()
  4. {
  5.     return 1;
  6. }
  7.  
  8. public OnPlayerCommandText(playerid, cmdtext[])
  9. {
  10.     if(!strcmp(cmdtext, "/lol", true))
  11.     {
  12.         new Float:x, Float:y, Float:z;
  13.         GetPlayerPos(playerid, x, y, z);
  14.         GetXYInSideOfPlayer(playerid, x, y, 5.0, false);
  15.         SetPlayerCameraPos(playerid, x, y, z);
  16.         GetPlayerPos(playerid, x, y, z);
  17.         SetPlayerCameraLookAt(playerid, x, y, z);
  18.         return 1;
  19.     }
  20.  
  21.     if(!strcmp(cmdtext, "/behind", true))
  22.     {
  23.         SetCameraBehindPlayer(playerid);
  24.         return 1;
  25.     }
  26.     return 0;
  27. }
  28.  
  29. stock GetXYInSideOfPlayer(playerid, &Float:x, &Float:y, Float:distance, bool:left=false)
  30. {
  31.     new Float:a;
  32.  
  33.     GetPlayerPos(playerid, x, y, a);
  34.     GetPlayerFacingAngle(playerid, a);
  35.  
  36.     if(IsPlayerInAnyVehicle(playerid))
  37.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  38.  
  39.     a += 90.0;
  40.     if(left)
  41.     {
  42.         x += (distance * floatsin(-a, degrees));
  43.         y += (distance * floatcos(-a, degrees));
  44.     } else {
  45.         x -= (distance * floatsin(-a, degrees));
  46.         y -= (distance * floatcos(-a, degrees));
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement