Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Airbreak filterscript made by Mean.
- // Credits:
- // Y_Less for GetXYInFrontOfPlayer
- // Zeex for ZCMD
- // Mean for making this
- #include < a_samp >
- #include < zcmd >
- public OnPlayerConnect( playerid ) {
- SetPVarInt( playerid, "ab", 0 );
- return 1;
- }
- public OnPlayerDisconnect( playerid, reason ) {
- DeletePVar( playerid, "ab" );
- return 1;
- }
- CMD:ab( playerid, params[ ] ) {
- if( GetPVarInt( playerid, "ab" ) == 0 ) {
- SetPVarInt( playerid, "ab", 1 );
- TogglePlayerControllable( playerid, 0 );
- }
- else {
- SetPVarInt( playerid, "ab", 0 );
- TogglePlayerControllable( playerid, 1 );
- }
- return 1;
- }
- GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
- {
- new Float:a;
- GetPlayerPos(playerid, x, y, a);
- GetPlayerFacingAngle(playerid, a);
- if (GetPlayerVehicleID(playerid))
- {
- GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
- }
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- }
- GetXYBehindPlayer(playerid, &Float:x, &Float:y, Float:distance)
- {
- new Float:a;
- GetPlayerPos(playerid, x, y, a);
- GetPlayerFacingAngle(playerid, a);
- a = a - 180;
- if (GetPlayerVehicleID(playerid))
- {
- GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
- }
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- }
- GetXYRightOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
- {
- new Float:a;
- GetPlayerPos(playerid, x, y, a);
- GetPlayerFacingAngle(playerid, a);
- a = a - 90;
- if (GetPlayerVehicleID(playerid))
- {
- GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
- }
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- }
- GetXYLeftOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
- {
- new Float:a;
- GetPlayerPos(playerid, x, y, a);
- GetPlayerFacingAngle(playerid, a);
- a = a + 90;
- if (GetPlayerVehicleID(playerid))
- {
- GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
- }
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- }
- public OnPlayerUpdate( playerid ) {
- new Keys,ud,lr;
- GetPlayerKeys(playerid,Keys,ud,lr);
- if( ud < 0 ) {
- if( GetPVarInt( playerid, "ab" ) == 1 ) {
- new Float:x, Float:y;
- new Float:x2, Float:y2, Float:z2;
- GetXYInFrontOfPlayer( playerid, x, y, 1.5 );
- GetPlayerPos( playerid, x2, y2, z2 );
- #pragma unused x2
- #pragma unused y2
- SetPlayerPos( playerid, x, y, z2 );
- }
- }
- if( ud > 0 ) {
- if( GetPVarInt( playerid, "ab" ) == 1 ) {
- new Float:x, Float:y;
- new Float:x2, Float:y2, Float:z2;
- GetXYBehindPlayer( playerid, x, y, 1.5 );
- GetPlayerPos( playerid, x2, y2, z2 );
- #pragma unused x2
- #pragma unused y2
- SetPlayerPos( playerid, x, y, z2 );
- }
- }
- if( lr > 0 ) {
- if( GetPVarInt( playerid, "ab" ) == 1 ) {
- new Float:x, Float:y;
- new Float:x2, Float:y2, Float:z2;
- GetXYRightOfPlayer( playerid, x, y, 2.0 );
- GetPlayerPos( playerid, x2, y2, z2 );
- #pragma unused x2
- #pragma unused y2
- SetPlayerPos( playerid, x, y, z2 );
- }
- }
- if( lr < 0 ) {
- if( GetPVarInt( playerid, "ab" ) == 1 ) {
- new Float:x, Float:y;
- new Float:x2, Float:y2, Float:z2;
- GetXYLeftOfPlayer( playerid, x, y, 2.0 );
- GetPlayerPos( playerid, x2, y2, z2 );
- #pragma unused x2
- #pragma unused y2
- SetPlayerPos( playerid, x, y, z2 );
- }
- }
- if( Keys & KEY_SPRINT ) {
- if( GetPVarInt( playerid, "ab" ) == 1 ) {
- new Float:x, Float:y, Float:z;
- GetPlayerPos( playerid, x, y, z );
- SetPlayerPos( playerid, x, y, z + 2.0 );
- }
- }
- if( Keys & KEY_JUMP ) {
- if( GetPVarInt( playerid, "ab" ) == 1 ) {
- new Float:x, Float:y, Float:z;
- GetPlayerPos( playerid, x, y, z );
- SetPlayerPos( playerid, x, y, z - 2.0 );
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement