Raised This Month: $ Target: $400
 0% 

block event +jump (prevent from jumping)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mephisto_aka_Snake
Junior Member
Join Date: Nov 2008
Old 10-04-2009 , 20:46   block event +jump (prevent from jumping)
Reply With Quote #1

Hey,
is it possible to hook the +jump event anyhow? I want to set jumping velocities manually and prevent from original jumping, because im aiming to code a charged jump where you have to hold down your jump button and the longer you hold it down, the higher you can jump.
Please help me!
greets
Mephisto_aka_Snake is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 10-05-2009 , 03:16   Re: block event +jump (prevent from jumping)
Reply With Quote #2

Like this? I made it fast and seems to work fine, and i like the idea too.
PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Alka"

#define DEFAULT_JUMP_VEL 250.0

#define MAX_JUMP_VEL 600.0

new Float:g_fJumpVel[33] = {DEFAULT_JUMP_VEL, ...};

public 
plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink"0);
}

public 
fwd_PlayerPreThink(id)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;
    
    static 
iFlagsiButtoniOldButton;
    
iFlags pev(idpev_flags);
    
iButton pev(idpev_button);
    
iOldButton pev(idpev_oldbuttons);
    
    if(!(
iFlags FL_ONGROUND))
        return 
FMRES_IGNORED;
    
    if((
iButton IN_JUMP) && (iOldButton IN_JUMP))
    {
        static 
Float:vVel[3];
        
pev(idpev_velocityvVel);
        
        if(
g_fJumpVel[id] < MAX_JUMP_VEL)
        {
            
g_fJumpVel[id] += 50.0;
        }
        
vVel[2] = g_fJumpVel[id];
        
set_pev(idpev_velocityvVel);
    }
    else
    {
        
g_fJumpVel[id] = DEFAULT_JUMP_VEL;
    }
    return 
FMRES_IGNORED;

__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 10-05-2009 , 06:27   Re: block event +jump (prevent from jumping)
Reply With Quote #3

Sry for the offtopic but man, rly good idea o.o, and gj for the code alka.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Mephisto_aka_Snake
Junior Member
Join Date: Nov 2008
Old 10-05-2009 , 09:05   Re: block event +jump (prevent from jumping)
Reply With Quote #4

well, thx Alka, but i already got, what you've got, your code isnt blocking the first jump, you know? you hold down jump button, but you will jump and when you land it starts charging... but i wanted to avoid that jump before charge... but i dont know how it should work with FMRES_SUPERCEDE or something....
well but actually its not that bad as my code is at the moment... yeah well... just to let you know ^^ it is for a new character in a mod...
so if anyone knows how to avoid that first little jump before you can charge pls tell me
thx!
Mephisto_aka_Snake is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode