Advertisement
Guest User

Untitled

a guest
Jul 4th, 2011
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.74 KB | None | 0 0
  1. // Airbreak filterscript made by Mean.
  2. // Credits:
  3. // Y_Less for GetXYInFrontOfPlayer
  4. // Zeex for ZCMD
  5. // Mean for making this
  6.  
  7. #include < a_samp >
  8. #include < zcmd >
  9.  
  10. public OnPlayerConnect( playerid ) {
  11.     SetPVarInt( playerid, "ab", 0 );
  12.     return 1;
  13. }
  14.  
  15. public OnPlayerDisconnect( playerid, reason ) {
  16.     DeletePVar( playerid, "ab" );
  17.     return 1;
  18. }
  19.  
  20. CMD:ab( playerid, params[ ] ) {
  21.     if( GetPVarInt( playerid, "ab" ) == 0 ) {
  22.         SetPVarInt( playerid, "ab", 1 );
  23.         TogglePlayerControllable( playerid, 0 );
  24.     }
  25.     else {
  26.         SetPVarInt( playerid, "ab", 0 );
  27.         TogglePlayerControllable( playerid, 1 );
  28.     }
  29.     return 1;
  30. }
  31.  
  32. GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  33. {
  34.     new Float:a;
  35.     GetPlayerPos(playerid, x, y, a);
  36.     GetPlayerFacingAngle(playerid, a);
  37.     if (GetPlayerVehicleID(playerid))
  38.     {
  39.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  40.     }
  41.     x += (distance * floatsin(-a, degrees));
  42.     y += (distance * floatcos(-a, degrees));
  43. }
  44.  
  45. GetXYBehindPlayer(playerid, &Float:x, &Float:y, Float:distance)
  46. {
  47.     new Float:a;
  48.     GetPlayerPos(playerid, x, y, a);
  49.     GetPlayerFacingAngle(playerid, a);
  50.     a = a - 180;
  51.     if (GetPlayerVehicleID(playerid))
  52.     {
  53.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  54.     }
  55.     x += (distance * floatsin(-a, degrees));
  56.     y += (distance * floatcos(-a, degrees));
  57. }
  58.  
  59. GetXYRightOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  60. {
  61.     new Float:a;
  62.     GetPlayerPos(playerid, x, y, a);
  63.     GetPlayerFacingAngle(playerid, a);
  64.     a = a - 90;
  65.     if (GetPlayerVehicleID(playerid))
  66.     {
  67.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  68.     }
  69.     x += (distance * floatsin(-a, degrees));
  70.     y += (distance * floatcos(-a, degrees));
  71. }
  72.  
  73. GetXYLeftOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  74. {
  75.     new Float:a;
  76.     GetPlayerPos(playerid, x, y, a);
  77.     GetPlayerFacingAngle(playerid, a);
  78.     a = a + 90;
  79.     if (GetPlayerVehicleID(playerid))
  80.     {
  81.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  82.     }
  83.     x += (distance * floatsin(-a, degrees));
  84.     y += (distance * floatcos(-a, degrees));
  85. }
  86.  
  87. public OnPlayerUpdate( playerid ) {
  88.     new Keys,ud,lr;
  89.     GetPlayerKeys(playerid,Keys,ud,lr);
  90.     if( ud < 0 ) {
  91.         if( GetPVarInt( playerid, "ab" ) == 1 ) {
  92.             new Float:x, Float:y;
  93.             new Float:x2, Float:y2, Float:z2;
  94.             GetXYInFrontOfPlayer( playerid, x, y, 1.5 );
  95.             GetPlayerPos( playerid, x2, y2, z2 );
  96.             #pragma unused x2
  97.             #pragma unused y2
  98.             SetPlayerPos( playerid, x, y, z2 );
  99.         }
  100.     }
  101.     if( ud > 0 ) {
  102.         if( GetPVarInt( playerid, "ab" ) == 1 ) {
  103.             new Float:x, Float:y;
  104.             new Float:x2, Float:y2, Float:z2;
  105.             GetXYBehindPlayer( playerid, x, y, 1.5 );
  106.             GetPlayerPos( playerid, x2, y2, z2 );
  107.             #pragma unused x2
  108.             #pragma unused y2
  109.             SetPlayerPos( playerid, x, y, z2 );
  110.         }
  111.     }
  112.     if( lr > 0 ) {
  113.         if( GetPVarInt( playerid, "ab" ) == 1 ) {
  114.             new Float:x, Float:y;
  115.             new Float:x2, Float:y2, Float:z2;
  116.             GetXYRightOfPlayer( playerid, x, y, 2.0 );
  117.             GetPlayerPos( playerid, x2, y2, z2 );
  118.             #pragma unused x2
  119.             #pragma unused y2
  120.             SetPlayerPos( playerid, x, y, z2 );
  121.         }
  122.     }
  123.     if( lr < 0 ) {
  124.         if( GetPVarInt( playerid, "ab" ) == 1 ) {
  125.             new Float:x, Float:y;
  126.             new Float:x2, Float:y2, Float:z2;
  127.             GetXYLeftOfPlayer( playerid, x, y, 2.0 );
  128.             GetPlayerPos( playerid, x2, y2, z2 );
  129.             #pragma unused x2
  130.             #pragma unused y2
  131.             SetPlayerPos( playerid, x, y, z2 );
  132.         }
  133.     }
  134.     if( Keys & KEY_SPRINT ) {
  135.         if( GetPVarInt( playerid, "ab" ) == 1 ) {
  136.             new Float:x, Float:y, Float:z;
  137.             GetPlayerPos( playerid, x, y, z );
  138.             SetPlayerPos( playerid, x, y, z + 2.0 );
  139.         }
  140.     }
  141.     if( Keys & KEY_JUMP ) {
  142.         if( GetPVarInt( playerid, "ab" ) == 1 ) {
  143.             new Float:x, Float:y, Float:z;
  144.             GetPlayerPos( playerid, x, y, z );
  145.             SetPlayerPos( playerid, x, y, z - 2.0 );
  146.         }
  147.     }
  148.     return 1;
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement