Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't move, when var_velocity modified. #7

Closed
bjallamo opened this issue May 27, 2016 · 2 comments
Closed

don't move, when var_velocity modified. #7

bjallamo opened this issue May 27, 2016 · 2 comments

Comments

@bjallamo
Copy link

bjallamo commented May 27, 2016

I made a modification to serfreeman's plugin, but when i'm in the second jump, the character don't move anywhere.
I have tried the code with bitstop flag "~" too.
Here's a video of the problem:
https://www.youtube.com/watch?v=yXIYLEyuuG4

#include <amxmodx>
#include <reapi>

#define MAXJUMPS    2           // maximum jumps

#define IN_JUMP         (1<<1)
#define FL_ONGROUND     (1<<9)


new const PLUGIN[] = "Multijump"
new const VERSION[] = "1.0"
new const AUTHOR[] = "serfreeman1337"   // Reapi modification by mforce


enum _:jdata {
    bool:DOJUMP,
    JUMPCOUNT
}

new player_jumps[33][jdata]

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    RegisterHookChain(RG_CBasePlayer_Jump, "Hook_PlayerJump");
}

public Hook_PlayerJump(id) {
    static oldButtons
    oldButtons = get_entvar(id, var_oldbuttons)

    if(!(get_entvar(id, var_flags) & FL_ONGROUND) && !(oldButtons & IN_JUMP)) {
        if(player_jumps[id][JUMPCOUNT] < MAXJUMPS - 1) {
            player_jumps[id][DOJUMP] = true
            player_jumps[id][JUMPCOUNT] ++
        }
    }
    else if(get_entvar(id, var_flags) & FL_ONGROUND) {
        player_jumps[id][JUMPCOUNT] = 0
    }

    if(player_jumps[id][DOJUMP]) {
        static Float:velocity[3]
        get_entvar(id, var_velocity, velocity)
        velocity[2] = random_float(265.0,285.0)
        set_entvar(id, var_velocity, velocity)

        player_jumps[id][DOJUMP] = false
    }
}

public client_disconnect(id) {
    arrayset(player_jumps[id], 0, jdata)
}

Original: http://1337.uz/download/plugins/sf_multijump.sma

@s1lentq
Copy link
Owner

s1lentq commented May 31, 2016

Try last build

@bjallamo
Copy link
Author

Everything perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants