[CS:S/CS:GO] Autobhop

Release your plugins here!
User avatar
JoJe3003
Junior Member
Posts: 4
Joined: Sun Jul 31, 2016 7:20 pm

[CS:S/CS:GO] Autobhop

Postby JoJe3003 » Tue Feb 14, 2017 8:18 pm

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)
Attachments
autobhop.zip
(1.71 KiB) Downloaded 531 times
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

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

Postby satoon101 » Tue Feb 14, 2017 10:20 pm

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.
Image
User avatar
JoJe3003
Junior Member
Posts: 4
Joined: Sun Jul 31, 2016 7:20 pm

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

Postby JoJe3003 » Tue Feb 14, 2017 11:15 pm

Thanks for the tips!
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

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

Postby decompile » Wed Feb 15, 2017 1:23 am

Btw, will OnPlayerRunCmd be called when the player is dead?? If not, you probably dont need to check if hes alive.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

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

Postby Ayuto » Wed Feb 15, 2017 6:03 am

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

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

Postby satoon101 » Sat Feb 18, 2017 7:07 pm

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.
Image

Return to “Plugin Releases”

Who is online

Users browsing this forum: No registered users and 27 guests