[FilterScript] Anti Bike Bunny Hop (Accurate)
#1

Introduction
Since loads of people requesting and posting about this, especially newbies, this might able to help them, this script is useful for Roleplay servers and I'm sure that this is accurate since I tested this loads of time before I released it

Anti Bike Bunny Hop | Code
pawn Code:
//----------------------------------[Credits]-----------------------------------
// pds2012 - creating this filterscript - Forum Account: http://forum.sa-mp.com/member.php?u=178953
// park4bmx - gave me usefull snippets - Forum Account: http://forum.sa-mp.com/member.php?u=74783
// Kalcor/Kyle - for the #include <a_samp>
//------------------------------------------------------------------------------

//----------------------------------[Include]-----------------------------------
#include <  a_samp  >
//------------------------------------------------------------------------------

//----------------------------------[Defines]-----------------------------------
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define SlapPlayer //If you want to slap the player out of the vehicle or using RemovePlayerFromVehicle function to remove the player
//------------------------------------------------------------------------------

public OnFilterScriptInit() return true;
public OnFilterScriptExit() return true;


new
    HoldingButton[ MAX_PLAYERS ][ 2 ] = 0,
    PlayerButtonTimer[ MAX_PLAYERS ]
;

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if( !IsPlayerConnected( playerid )) return true;

    new VehicleID = GetPlayerVehicleID(playerid);
   
    if( GetVehicleModel( VehicleID ) == 509 || GetVehicleModel( VehicleID ) == 481 || GetVehicleModel( VehicleID ) == 510 )
    {
        if( PRESSED ( KEY_ACTION ))
        {
            HoldingButton[ playerid ][ 0 ] = 1;
            HoldingButton[ playerid] [ 1 ] = KEY_ACTION;
            PlayerButtonTimer[ playerid ] = SetTimerEx("HoldingUpdate", 2500, false, "i", playerid);
            SendClientMessage(playerid, -1, "[DEBUG]: Timer HoldingUpdate time is running, and HoldingButton Variable has been set to 1 & Key Action");
            //SendClientMessage is for debug purposes, remove this when you've done testing it
        }
        else if( RELEASED ( KEY_ACTION ))
        {
            HoldingButton[ playerid ][ 0 ] = 0;
            KillTimer( PlayerButtonTimer[ playerid ] );
            SendClientMessage(playerid, -1, "[DEBUG]: Timer Killed and Variable HoldingButton has been set to 0");
            //SendClientMessage is for debug purposes, remove this when you've done testing it
        }
    }
    return true;
}

forward HoldingUpdate(playerid);
public HoldingUpdate(playerid)
{
    #if defined SlapPlayer
    new Float:PosX, Float:PosY, Float:PosZ;
    GetPlayerPos(playerid, PosX, PosY, PosZ);
    SetPlayerPos(playerid, PosX, PosY, PosZ+2);
    #else
    RemovePlayerFromVehicle(playerid);
    #endif

    HoldingButton[ playerid ][ 0 ] = 0;
    SendClientMessage(playerid, -1, "[DEBUG]: Variable HoldingButton has been set to 0");
    //SendClientMessage is for debug purposes, remove this when you've done testing it
    return true;
}
Video
http://www.youtube.com/watch?v=9U1lg...ature=*********

Bugs:None, if you found a bug feel free to comment below and I'll fix it as soon as possible

Best Regards,
pds2012
Any Positive/Negative comments will be appreciated
Reply
#2

Great !
Reply
#3

Well Good
Reply
#4

Quote:
Originally Posted by BodyBoardVEVO
View Post
Great !
Quote:
Originally Posted by Team_PRO
View Post
Well Good
Appreciate your comments guys
Reply
#5

very good!
Reply
#6

The best part is

if( IsPlayerConnected( playerid ) ) return 1;

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    // Player is connected script dont work
    if( IsPlayerConnected( playerid )) return 1;

    new VehicleID = GetPlayerVehicleID(playerid);

    // We dont need IsPlayerInAnyVehicle, you can use if(VehicleID) and why 3 times GetVehicleModel ? new Model = GetVehicleModel( VehicleID ); then replace all GetVehicleModel( VehicleID ) to Model
    if( IsPlayerInAnyVehicle(playerid) && GetVehicleModel( VehicleID ) == 509 || GetVehicleModel( VehicleID ) == 481 || GetVehicleModel( VehicleID ) == 510 )
    {
        if( PRESSED( KEY_ACTION ))
        {
            // HoldingButton ? wth is that and for what ? you dont use this in FS
            HoldingButton[ playerid ][ 0 ] = 1;
            HoldingButton[ playerid] [ 1 ] = KEY_ACTION;
            // SetTimerEx ? ehm
            PlayerButtonTimer[ playerid ] = SetTimerEx("HoldingUpdate", 2500, false, "i", playerid);
            SendClientMessage(playerid, -1, "[DEBUG]: Timer HoldingUpdate time is running, and HoldingButton Variable has been set to 1 & Key Action");
            //SendClientMessage is for debug purposes, remove this when you've done testing it
        }
        else if( RELEASED( KEY_ACTION ))
        {
            // HoldingButton ? wth is that and for what ? you dont use this in FS
            HoldingButton[ playerid ][ 0 ] = 0;
            KillTimer( PlayerButtonTimer[ playerid ] );
            SendClientMessage(playerid, -1, "[DEBUG]: Timer Killed and Variable HoldingButton has been set to 0");
            //SendClientMessage is for debug purposes, remove this when you've done testing it
        }
    }
    return 1;
}
Simply and very basic version:

pawn Code:
#include <a_samp>

#define SlapPlayer //If you want to slap the player out of the vehicle or using RemovePlayerFromVehicle function to remove the player

PunishPlayer(playerid)
{
    #if defined SlapPlayer
    new Float:PosX, Float:PosY, Float:PosZ;
    GetPlayerPos(playerid, PosX, PosY, PosZ);
    SetPlayerPos(playerid, PosX, PosY, PosZ+0.5);
    #else
    RemovePlayerFromVehicle(playerid);
    #endif
    return 0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

    new VehicleID = GetPlayerVehicleID(playerid);
    if(0 < VehicleID < MAX_VEHICLES) // or if(VehicleID)
    {
        new VehicleModel = GetVehicleModel( VehicleID );
        if( VehicleModel == 481 || VehicleModel == 509 || VehicleModel == 510 )
            if(oldkeys & KEY_ACTION)
                return PunishPlayer(playerid);
    }
    return 1;
}
Reply
#7

make anti cheat for better, just suggesting, up to you if you gonna make
Reply
#8

Quote:
Originally Posted by Jefff
View Post
The best part is
if( IsPlayerConnected( playerid ) ) return 1;
Just made a mistake right there , forgot to put an !(Exclamation Mark), Code Updated
Reply
#9

Good Work, mate!
Reply
#10

Nice job, well done!
Reply
#11

Quote:
Originally Posted by xganyx
View Post
Good Work, mate!
Quote:
Originally Posted by n0minal
View Post
Nice job, well done!
Cheers!
Reply
#12

not bad
Reply
#13

Quote:
Originally Posted by mini_mi
View Post
not bad
Thanks.
Reply
#14

goooooooooooooooooooooooooooooooooooooooood

niga
Reply
#15

Quote:
Originally Posted by Rube
View Post
goooooooooooooooooooooooooooooooooooooooood

niga
Cheers, LoL'ed at your comment.
Reply
#16

Nice job, seems interesting and quite cool for RP servers.
Reply
#17

Quote:
Originally Posted by DanishHaq
View Post
Nice job, seems interesting and quite cool for RP servers.
Thanks.
Reply
#18

Good job mate.
Reply
#19

Good work mate.
Reply
#20

It's good for RP servers as DanishHaq said . Well done nice job .
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)