Page 1 of 1

[CS:S/CS:GO] Autobhop

Posted: Tue Feb 14, 2017 8:18 pm
by JoJe3003
AutoBhop
By Velocity and JoJe3003

Description
This plugin will automatically bunnyhop for you. Simply type "!autobhop" to toggle the script ON/OFF ingame.

How to Install
1. You oviously need SourcePython installed on your server.
2. Extract the addons folder into the cstrike folder in your server.

Launch the script

Code: Select all

sp plugin load autobhop

(Either put innto autoexec.cfg or execute the code in the server window)

Re: [CS:S/CS:GO] Autobhop

Posted: Tue Feb 14, 2017 10:20 pm
by satoon101
Cool plugin!

A couple of tips. First, the info module is pointless, as you don't import it. But also, if you did try to import it, there would be an error. We recently updated PluginInfo for a number of reasons. The best way to handle the plugin's info is to now have 2 files:

  • info.py:

    Syntax: Select all

    # ../<plugin_name>/info.py

    """Provides/stores information about the plugin."""

    # =============================================================================
    # >> IMPORTS
    # =============================================================================
    # Source.Python
    from plugins.manager import plugin_manager


    # =============================================================================
    # >> PLUGIN INFO
    # =============================================================================
    info = plugin_manager.get_plugin_info(__name__)

  • info.ini:

    Syntax: Select all

    verbose_name = "Autobhop"
    author = "joje3003 and velocity"
    version = "1.0.0"
    url = "<some url>"

This will automatically create the PublicConVar instance, unless you specify public_convar = False in the ini file.

Also, I'm a little unsure why you bother casting the userid to a string. It should work fine as an integer, which it will be in both functions.

Syntax: Select all

# You are needlessly looping through every player in the following
if not player in PlayerIter('alive'):
return


# All you really need to do is
if player.dead:
return


If "jump" is always the only sub-key in the dictionary, what is the point of even using it? You can simply use:

Syntax: Select all

settings[userid] = True
settings[userid] = False

Notice above that I also switched using integers for booleans, since you are really only wanting true/false values.

Lastly, you are getting the userid and index of the player before you check whether or not the command was even used. You can either move those after the command check or instead of using player_say, use a SayCommand or TypedSayCommand, which will do that filtering for you.

Re: [CS:S/CS:GO] Autobhop

Posted: Tue Feb 14, 2017 11:15 pm
by JoJe3003
Thanks for the tips!

Re: [CS:S/CS:GO] Autobhop

Posted: Wed Feb 15, 2017 1:23 am
by decompile
Btw, will OnPlayerRunCmd be called when the player is dead?? If not, you probably dont need to check if hes alive.

Re: [CS:S/CS:GO] Autobhop

Posted: Wed Feb 15, 2017 6:03 am
by Ayuto
Yes, OnPlayerRunCmd will be called for dead players as well.

@satoon
You don't need to retrieve the plugin info if you don't use it. It's being created when the plugin is loaded and not when it's being retrieved.

Re: [CS:S/CS:GO] Autobhop

Posted: Sat Feb 18, 2017 7:07 pm
by satoon101
Ayuto wrote:@satoon
You don't need to retrieve the plugin info if you don't use it. It's being created when the plugin is loaded and not when it's being retrieved.

Yes, if you don't use the plugin's info within your plugin itself, there is no need for the info.py file at all. I use it in each of my plugins in one way or another, so I always create that file just in case.